btclock_v3/src/lib/config.hpp

107 lines
2.7 KiB
C++
Raw Normal View History

#pragma once
#include <MCP23017.h>
#include <Arduino.h>
2023-11-30 22:38:01 +01:00
#include <Preferences.h>
#include <WiFiClientSecure.h>
#include <WiFiManager.h>
#include <base64.h>
#include <esp_task_wdt.h>
2024-09-16 21:50:28 +02:00
#include <nvs_flash.h>
#include <map>
2023-11-07 01:11:12 +01:00
#include "lib/block_notify.hpp"
2023-11-07 21:26:15 +01:00
#include "lib/button_handler.hpp"
2023-11-30 22:38:01 +01:00
#include "lib/epd.hpp"
// #include "lib/improv.hpp"
2023-11-08 12:18:59 +01:00
#include "lib/led_handler.hpp"
2023-11-30 22:38:01 +01:00
#include "lib/ota.hpp"
2024-07-11 22:08:42 +02:00
#include "lib/nostr_notify.hpp"
2024-07-29 20:49:46 +02:00
#include "lib/bitaxe_fetch.hpp"
2024-12-17 20:17:21 -06:00
#include "lib/mining_pool_stats_fetch.hpp"
2024-07-11 22:08:42 +02:00
#include "lib/v2_notify.hpp"
2023-11-30 22:38:01 +01:00
#include "lib/price_notify.hpp"
#include "lib/screen_handler.hpp"
#include "lib/shared.hpp"
#include "lib/webserver.hpp"
2024-04-27 16:48:06 +02:00
#ifdef HAS_FRONTLIGHT
#include "PCA9685.h"
2024-06-29 02:19:25 +02:00
#include "BH1750.h"
2024-04-27 16:48:06 +02:00
#endif
2023-11-07 01:11:12 +01:00
#include "shared.hpp"
#include "defaults.hpp"
2023-11-07 21:26:15 +01:00
#define NTP_SERVER "pool.ntp.org"
#define DEFAULT_TIME_OFFSET_SECONDS 3600
2024-06-28 17:36:46 +02:00
#ifndef MCP_DEV_ADDR
2023-11-07 21:26:15 +01:00
#define MCP_DEV_ADDR 0x20
2024-06-28 17:36:46 +02:00
#endif
2023-11-07 21:26:15 +01:00
2023-11-08 12:18:59 +01:00
2023-11-07 01:11:12 +01:00
void setup();
2024-04-12 00:17:40 +02:00
void syncTime();
uint getLastTimeSync();
2023-11-07 01:11:12 +01:00
void setupPreferences();
void setupWebsocketClients(void *pvParameters);
2023-11-07 21:26:15 +01:00
void setupHardware();
2024-09-10 11:12:14 +02:00
void setupWifi();
2023-11-07 21:26:15 +01:00
void setupTimers();
void finishSetup();
void setupMcp();
2024-04-27 16:48:06 +02:00
#ifdef HAS_FRONTLIGHT
2025-01-05 21:19:28 +01:00
extern BH1750 bh1750;
extern bool hasLuxSensor;
2024-06-29 02:19:25 +02:00
float getLightLevel();
bool hasLightLevel();
2024-04-27 16:48:06 +02:00
#endif
2023-11-28 01:30:36 +01:00
String getMyHostname();
2024-07-29 20:49:46 +02:00
std::vector<ScreenMapping> getScreenNameMap();
2023-11-07 21:26:15 +01: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);
//void addCurrencyMappings(const std::vector<std::string>& currencies);
std::vector<std::string> getActiveCurrencies();
std::vector<std::string> getAvailableCurrencies();
bool isActiveCurrency(std::string &currency);
2024-05-18 23:00:08 +02:00
void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info);
2024-05-19 17:49:39 +02:00
String getHwRev();
2024-06-09 00:45:46 +02:00
bool isWhiteVersion();
2024-07-29 20:49:46 +02:00
String getFsRev();
bool debugLogEnabled();
2024-07-29 20:49:46 +02:00
void addScreenMapping(int value, const char* name);
// void addScreenMapping(int value, const String& name);
// void addScreenMapping(int value, const std::string& name);
2024-09-10 11:12:14 +02:00
int findScreenIndexByValue(int value);
String replaceAmbiguousChars(String input);
const char* getFirmwareFilename();
const char* getWebUiFilename();
// void loadIcons();
extern Preferences preferences;
extern MCP23017 mcp1;
#ifdef IS_BTCLOCK_V8
extern MCP23017 mcp2;
#endif
2025-01-05 21:19:28 +01:00
#ifdef HAS_FRONTLIGHT
extern PCA9685 flArray;
#endif
// Expose DataSourceType enum
extern DataSourceType getDataSource();
extern void setDataSource(DataSourceType source);