2023-11-07 00:11:12 +00:00
|
|
|
#pragma once;
|
2023-11-10 12:02:05 +00:00
|
|
|
#include <WiFiManager.h>
|
|
|
|
#include "base64.h"
|
|
|
|
|
2023-11-07 00:11:12 +00:00
|
|
|
#include <WiFiClientSecure.h>
|
|
|
|
#include <Preferences.h>
|
|
|
|
#include <Adafruit_MCP23X17.h>
|
|
|
|
|
2023-11-10 18:52:06 +00:00
|
|
|
#include <Arduino.h>
|
2023-11-07 00:11:12 +00:00
|
|
|
#include "shared.hpp"
|
|
|
|
#include "epd.hpp"
|
2023-11-07 20:26:15 +00:00
|
|
|
#include "improv.hpp"
|
2023-11-08 14:49:16 +00:00
|
|
|
#include "esp_task_wdt.h"
|
|
|
|
|
2023-11-08 14:27:22 +00:00
|
|
|
#include <map>
|
2023-11-07 00:11:12 +00:00
|
|
|
|
2023-11-10 22:18:14 +00:00
|
|
|
#include "ota.hpp"
|
2023-11-07 00:11:12 +00:00
|
|
|
#include "lib/screen_handler.hpp"
|
|
|
|
#include "lib/webserver.hpp"
|
|
|
|
#include "lib/block_notify.hpp"
|
|
|
|
#include "lib/price_notify.hpp"
|
2023-11-07 20:26:15 +00:00
|
|
|
#include "lib/button_handler.hpp"
|
2023-11-08 11:18:59 +00:00
|
|
|
#include "lib/led_handler.hpp"
|
2023-11-07 00:11:12 +00:00
|
|
|
|
2023-11-07 20:26:15 +00:00
|
|
|
#define NTP_SERVER "pool.ntp.org"
|
|
|
|
#define DEFAULT_MEMPOOL_INSTANCE "mempool.space"
|
|
|
|
#define TIME_OFFSET_SECONDS 3600
|
|
|
|
#define USER_AGENT "BTClock/2.0"
|
|
|
|
#define MCP_DEV_ADDR 0x20
|
2023-11-08 14:27:22 +00:00
|
|
|
#define DEFAULT_SECONDS_BETWEEN_PRICE_UPDATE 30
|
2023-11-14 18:46:29 +00:00
|
|
|
#define DEFAULT_MINUTES_FULL_REFRESH 60
|
2023-11-07 20:26:15 +00:00
|
|
|
|
2023-11-08 11:18:59 +00:00
|
|
|
#define DEFAULT_FG_COLOR GxEPD_WHITE
|
|
|
|
#define DEFAULT_BG_COLOR GxEPD_BLACK
|
|
|
|
|
2023-11-07 00:11:12 +00:00
|
|
|
void setup();
|
|
|
|
void setupTime();
|
|
|
|
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-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
|
|
|
|
2023-11-20 17:59:33 +00:00
|
|
|
void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info);
|