2024-03-10 19:24:55 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-07 00:11:12 +00:00
|
|
|
#include <Adafruit_MCP23X17.h>
|
2023-11-10 18:52:06 +00:00
|
|
|
#include <Arduino.h>
|
2023-11-30 21:38:01 +00:00
|
|
|
#include <Preferences.h>
|
|
|
|
#include <WiFiClientSecure.h>
|
|
|
|
#include <WiFiManager.h>
|
|
|
|
#include <base64.h>
|
|
|
|
#include <esp_task_wdt.h>
|
2023-11-30 21:56:50 +00:00
|
|
|
|
2023-11-08 14:27:22 +00:00
|
|
|
#include <map>
|
2023-11-07 00:11:12 +00:00
|
|
|
|
|
|
|
#include "lib/block_notify.hpp"
|
2023-11-07 20:26:15 +00:00
|
|
|
#include "lib/button_handler.hpp"
|
2023-11-30 21:38:01 +00:00
|
|
|
#include "lib/epd.hpp"
|
|
|
|
#include "lib/improv.hpp"
|
2023-11-08 11:18:59 +00:00
|
|
|
#include "lib/led_handler.hpp"
|
2023-11-30 21:38:01 +00:00
|
|
|
#include "lib/ota.hpp"
|
|
|
|
#include "lib/price_notify.hpp"
|
|
|
|
#include "lib/screen_handler.hpp"
|
|
|
|
#include "lib/shared.hpp"
|
|
|
|
#include "lib/webserver.hpp"
|
2024-04-27 14:48:06 +00:00
|
|
|
#ifdef HAS_FRONTLIGHT
|
|
|
|
#include "PCA9685.h"
|
2024-06-29 00:19:25 +00:00
|
|
|
#include "BH1750.h"
|
2024-04-27 14:48:06 +00:00
|
|
|
#endif
|
2023-11-07 00:11:12 +00:00
|
|
|
|
2023-11-07 20:26:15 +00:00
|
|
|
#define NTP_SERVER "pool.ntp.org"
|
2024-07-11 12:08:37 +00:00
|
|
|
#define DEFAULT_TIME_OFFSET_SECONDS 3600
|
2024-06-28 15:36:46 +00:00
|
|
|
#define USER_AGENT "BTClock/3.0"
|
|
|
|
#ifndef MCP_DEV_ADDR
|
2023-11-07 20:26:15 +00:00
|
|
|
#define MCP_DEV_ADDR 0x20
|
2024-06-28 15:36:46 +00:00
|
|
|
#endif
|
2023-11-07 20:26:15 +00:00
|
|
|
|
2023-11-08 11:18:59 +00:00
|
|
|
|
2023-11-07 00:11:12 +00:00
|
|
|
void setup();
|
2024-04-11 22:17:40 +00:00
|
|
|
void syncTime();
|
|
|
|
uint getLastTimeSync();
|
2023-11-07 00:11:12 +00:00
|
|
|
void setupPreferences();
|
2023-11-10 12:02:05 +00:00
|
|
|
void setupWebsocketClients(void *pvParameters);
|
2023-11-07 20:26:15 +00:00
|
|
|
void setupHardware();
|
|
|
|
void tryImprovSetup();
|
|
|
|
void setupTimers();
|
|
|
|
void finishSetup();
|
2023-11-25 23:51:54 +00:00
|
|
|
void setupMcp();
|
2024-04-27 14:48:06 +00:00
|
|
|
#ifdef HAS_FRONTLIGHT
|
|
|
|
void setupFrontlight();
|
2024-06-29 00:19:25 +00:00
|
|
|
float getLightLevel();
|
|
|
|
bool hasLightLevel();
|
2024-04-27 14:48:06 +00:00
|
|
|
extern PCA9685 flArray;
|
|
|
|
#endif
|
|
|
|
|
2023-11-28 00:30:36 +00:00
|
|
|
String getMyHostname();
|
2023-11-08 19:29:06 +00:00
|
|
|
std::vector<std::string> getScreenNameMap();
|
2023-11-07 20:26:15 +00:00
|
|
|
|
|
|
|
std::vector<std::string> getLocalUrl();
|
|
|
|
bool improv_connectWifi(std::string ssid, std::string password);
|
|
|
|
void improvGetAvailableWifiNetworks();
|
|
|
|
bool onImprovCommandCallback(improv::ImprovCommand cmd);
|
|
|
|
void onImprovErrorCallback(improv::Error err);
|
|
|
|
void improv_set_state(improv::State state);
|
|
|
|
void improv_send_response(std::vector<uint8_t> &response);
|
|
|
|
void improv_set_error(improv::Error error);
|
2023-11-12 23:33:48 +00:00
|
|
|
|
2024-05-18 21:00:08 +00:00
|
|
|
void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info);
|
2024-05-19 15:49:39 +00:00
|
|
|
String getHwRev();
|
2024-06-08 22:45:46 +00:00
|
|
|
bool isWhiteVersion();
|
|
|
|
String getFsRev();
|