mirror of
https://git.btclock.dev/btclock/btclock_v3
synced 2025-06-23 16:05:26 +00:00
Compare commits
3 Commits
2ac2a62c61
...
3149259309
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3149259309 | ||
![]() |
b185d86186 | ||
![]() |
7853bf3e06 |
2
data
2
data
@ -1 +1 @@
|
||||
Subproject commit 8389ed8e36a9a1a7a39ca31f53324a0949aedb1d
|
||||
Subproject commit f5a9133cabfbab82325275575545c12f7aacf8f2
|
@ -40,7 +40,7 @@ lib_deps =
|
||||
bblanchon/ArduinoJson@^7.4.1
|
||||
esp32async/ESPAsyncWebServer @ 3.7.7
|
||||
robtillaart/MCP23017@^0.9.1
|
||||
adafruit/Adafruit NeoPixel@^1.12.5
|
||||
adafruit/Adafruit NeoPixel@^1.15.1
|
||||
https://github.com/dsbaars/universal_pin#feature/mcp23017_rt
|
||||
https://github.com/dsbaars/GxEPD2#universal_pin
|
||||
https://github.com/tzapu/WiFiManager.git#v2.0.17
|
||||
|
@ -86,6 +86,7 @@
|
||||
#define DEFAULT_CUSTOM_ENDPOINT "ws-staging.btclock.dev"
|
||||
#define DEFAULT_CUSTOM_ENDPOINT_DISABLE_SSL false
|
||||
#define DEFAULT_MOW_MODE false
|
||||
#define DEFAULT_SCREEN_RESTORE_AFTER_ZAP true
|
||||
|
||||
// Define data source types
|
||||
enum DataSourceType {
|
||||
|
@ -10,6 +10,14 @@ boolean nostrIsSubscribing = true;
|
||||
|
||||
String subIdZap;
|
||||
|
||||
void screenRestoreAfterZapCallback(TimerHandle_t xTimer)
|
||||
{
|
||||
Serial.println("Restoring screen after zap");
|
||||
int screenBeforeZap = (int)(uintptr_t)pvTimerGetTimerID(xTimer);
|
||||
ScreenHandler::setCurrentScreen(screenBeforeZap);
|
||||
xTimerDelete(xTimer, 0);
|
||||
}
|
||||
|
||||
void setupNostrNotify(bool asDatasource, bool zapNotify)
|
||||
{
|
||||
nostr::esp32::ESP32Platform::initNostr(false);
|
||||
@ -288,6 +296,7 @@ void handleNostrZapCallback(const String &subId, nostr::SignedNostrEvent *event)
|
||||
}
|
||||
|
||||
uint64_t timerPeriod = 0;
|
||||
int screenBeforeZap = ScreenHandler::getCurrentScreen();
|
||||
if (isTimerActive())
|
||||
{
|
||||
// store timer periode before making inactive to prevent artifacts
|
||||
@ -306,6 +315,10 @@ void handleNostrZapCallback(const String &subId, nostr::SignedNostrEvent *event)
|
||||
{
|
||||
esp_timer_start_periodic(screenRotateTimer,
|
||||
timerPeriod * usPerSecond);
|
||||
} else if (preferences.getBool("scrnRestoreZap", DEFAULT_SCREEN_RESTORE_AFTER_ZAP)) {
|
||||
TimerHandle_t screenRestoreAfterZapTimer = xTimerCreate("screenRestoreAfterZap", pdMS_TO_TICKS(getTimerSeconds() * msPerSecond), pdFALSE, (void*)(uintptr_t)screenBeforeZap, screenRestoreAfterZapCallback);
|
||||
Serial.println("Starting screen restore after zap");
|
||||
xTimerStart(screenRestoreAfterZapTimer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,7 @@ const PROGMEM int screens[SCREEN_COUNT] = {
|
||||
SCREEN_BLOCK_FEE_RATE};
|
||||
const int usPerSecond = 1000000;
|
||||
const int usPerMinute = 60 * usPerSecond;
|
||||
const int msPerSecond = 1000;
|
||||
|
||||
// extern const char *github_root_ca;
|
||||
// extern const char *isrg_root_x1cert;
|
||||
|
@ -18,7 +18,7 @@ static const char *const PROGMEM boolSettings[] = {"ledTestOnPower", "ledFlashOn
|
||||
"mempoolSecure", "bitaxeEnabled",
|
||||
"miningPoolStats", "verticalDesc",
|
||||
"nostrZapNotify", "httpAuthEnabled",
|
||||
"enableDebugLog", "ceDisableSSL", "dndEnabled", "dndTimeBasedEnabled"};
|
||||
"enableDebugLog", "ceDisableSSL", "dndEnabled", "dndTimeBasedEnabled", "scrnRestoreZap"};
|
||||
|
||||
AsyncWebServer server(80);
|
||||
AsyncEventSource events("/events");
|
||||
@ -717,6 +717,7 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
|
||||
root["nostrZapNotify"] = preferences.getBool("nostrZapNotify", DEFAULT_ZAP_NOTIFY_ENABLED);
|
||||
root["nostrZapPubkey"] = preferences.getString("nostrZapPubkey", DEFAULT_ZAP_NOTIFY_PUBKEY);
|
||||
root["ledFlashOnZap"] = preferences.getBool("ledFlashOnZap", DEFAULT_LED_FLASH_ON_ZAP);
|
||||
root["scrnRestoreZap"] = preferences.getBool("scrnRestoreZap", DEFAULT_SCREEN_RESTORE_AFTER_ZAP);
|
||||
root["fontName"] = preferences.getString("fontName", DEFAULT_FONT_NAME);
|
||||
root["availableFonts"] = FontNames::getAvailableFonts();
|
||||
// Custom endpoint settings (only used for CUSTOM_SOURCE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user