mirror of
https://github.com/btclock/btclock_v3.git
synced 2024-11-19 04:40:09 +01:00
Fixes for Rev. B black PCB
This commit is contained in:
parent
630943ec54
commit
5dd47c2275
2
data
2
data
@ -1 +1 @@
|
|||||||
Subproject commit 6c40b54273b7f7c7d6c2624d3c2a066435f27756
|
Subproject commit 761c7f2991d347e97e77470ea3bf5511d7a7e507
|
@ -44,5 +44,5 @@ CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
|||||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120
|
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120
|
||||||
CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n
|
CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n
|
||||||
CONFIG_SPIRAM_CACHE_WORKAROUND=y
|
CONFIG_SPIRAM_CACHE_WORKAROUND=y
|
||||||
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
CONFIG_NEWLIB_NANO_FORMAT=y
|
CONFIG_NEWLIB_NANO_FORMAT=y
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "antonio-semibold20.h"
|
#include "antonio-semibold20.h"
|
||||||
#include "antonio-semibold30.h"
|
//#include "antonio-semibold30.h"
|
||||||
#include "antonio-semibold40.h"
|
#include "antonio-semibold40.h"
|
||||||
#include "antonio-semibold90.h"
|
#include "antonio-semibold90.h"
|
||||||
#include "sats-symbol.h"
|
#include "sats-symbol.h"
|
||||||
|
@ -58,6 +58,9 @@ void setup()
|
|||||||
{
|
{
|
||||||
preferences.clear();
|
preferences.clear();
|
||||||
queueLedEffect(LED_EFFECT_WIFI_ERASE_SETTINGS);
|
queueLedEffect(LED_EFFECT_WIFI_ERASE_SETTINGS);
|
||||||
|
nvs_flash_erase();
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,6 +232,9 @@ void setupWifi()
|
|||||||
// esp_task_wdt_deinit();
|
// esp_task_wdt_deinit();
|
||||||
// esp_task_wdt_reset();
|
// esp_task_wdt_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setFgColor(preferences.getUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE));
|
setFgColor(preferences.getUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE));
|
||||||
setBgColor(preferences.getUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK));
|
setBgColor(preferences.getUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK));
|
||||||
}
|
}
|
||||||
@ -274,6 +280,16 @@ void setupPreferences()
|
|||||||
else
|
else
|
||||||
setCurrentCurrency(CURRENCY_USD);
|
setCurrentCurrency(CURRENCY_USD);
|
||||||
|
|
||||||
|
if (!preferences.isKey("flDisable")) {
|
||||||
|
preferences.putBool("flDisable", isWhiteVersion() ? false : true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preferences.isKey("fgColor")) {
|
||||||
|
preferences.putUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE);
|
||||||
|
preferences.putUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
addScreenMapping(SCREEN_BLOCK_HEIGHT, "Block Height");
|
addScreenMapping(SCREEN_BLOCK_HEIGHT, "Block Height");
|
||||||
|
|
||||||
addScreenMapping(SCREEN_TIME, "Time");
|
addScreenMapping(SCREEN_TIME, "Time");
|
||||||
@ -455,6 +471,10 @@ void setupHardware()
|
|||||||
Serial.println(F("An Error has occurred while mounting LittleFS"));
|
Serial.println(F("An Error has occurred while mounting LittleFS"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HW_REV == "REV_B_EPD_2_13" && !isWhiteVersion()) {
|
||||||
|
Serial.println(F("Black Rev B"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!LittleFS.open("/index.html.gz", "r"))
|
if (!LittleFS.open("/index.html.gz", "r"))
|
||||||
{
|
{
|
||||||
Serial.println(F("Error loading WebUI"));
|
Serial.println(F("Error loading WebUI"));
|
||||||
@ -509,7 +529,7 @@ void setupHardware()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IS_HW_REV_B
|
#ifdef IS_HW_REV_B
|
||||||
pinMode(39, INPUT_PULLUP);
|
pinMode(39, INPUT_PULLDOWN);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -690,6 +710,7 @@ String getHwRev()
|
|||||||
bool isWhiteVersion()
|
bool isWhiteVersion()
|
||||||
{
|
{
|
||||||
#ifdef IS_HW_REV_B
|
#ifdef IS_HW_REV_B
|
||||||
|
pinMode(39, INPUT_PULLDOWN);
|
||||||
return digitalRead(39);
|
return digitalRead(39);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <WiFiManager.h>
|
#include <WiFiManager.h>
|
||||||
#include <base64.h>
|
#include <base64.h>
|
||||||
#include <esp_task_wdt.h>
|
#include <esp_task_wdt.h>
|
||||||
|
#include <nvs_flash.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "lib/block_notify.hpp"
|
#include "lib/block_notify.hpp"
|
||||||
|
@ -13,7 +13,7 @@ bool flInTransition = false;
|
|||||||
|
|
||||||
void frontlightFlash(int flDelayTime)
|
void frontlightFlash(int flDelayTime)
|
||||||
{
|
{
|
||||||
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
|
if (preferences.getBool("flDisable"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (frontlightOn)
|
if (frontlightOn)
|
||||||
@ -68,7 +68,7 @@ void frontlightFadeInAll(int flDelayTime)
|
|||||||
|
|
||||||
void frontlightFadeInAll(int flDelayTime, bool staggered)
|
void frontlightFadeInAll(int flDelayTime, bool staggered)
|
||||||
{
|
{
|
||||||
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
|
if (preferences.getBool("flDisable"))
|
||||||
return;
|
return;
|
||||||
if (frontlightIsOn())
|
if (frontlightIsOn())
|
||||||
return;
|
return;
|
||||||
@ -120,7 +120,7 @@ void frontlightFadeOutAll(int flDelayTime)
|
|||||||
|
|
||||||
void frontlightFadeOutAll(int flDelayTime, bool staggered)
|
void frontlightFadeOutAll(int flDelayTime, bool staggered)
|
||||||
{
|
{
|
||||||
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
|
if (preferences.getBool("flDisable"))
|
||||||
return;
|
return;
|
||||||
if (!frontlightIsOn())
|
if (!frontlightIsOn())
|
||||||
return;
|
return;
|
||||||
@ -186,7 +186,7 @@ bool frontlightIsOn()
|
|||||||
|
|
||||||
void frontlightFadeIn(uint num, int flDelayTime)
|
void frontlightFadeIn(uint num, int flDelayTime)
|
||||||
{
|
{
|
||||||
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
|
if (preferences.getBool("flDisable"))
|
||||||
return;
|
return;
|
||||||
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += 5)
|
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += 5)
|
||||||
{
|
{
|
||||||
@ -197,7 +197,7 @@ void frontlightFadeIn(uint num, int flDelayTime)
|
|||||||
|
|
||||||
void frontlightFadeOut(uint num, int flDelayTime)
|
void frontlightFadeOut(uint num, int flDelayTime)
|
||||||
{
|
{
|
||||||
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
|
if (preferences.getBool("flDisable"))
|
||||||
return;
|
return;
|
||||||
if (!frontlightIsOn())
|
if (!frontlightIsOn())
|
||||||
return;
|
return;
|
||||||
|
@ -76,7 +76,8 @@ void setupNostrNotify(bool asDatasource, bool zapNotify)
|
|||||||
}else if(status==nostr::ConnectionStatus::ERROR){
|
}else if(status==nostr::ConnectionStatus::ERROR){
|
||||||
sstatus = "ERROR";
|
sstatus = "ERROR";
|
||||||
}
|
}
|
||||||
Serial.println("[ Nostr ] Connection status changed: " + sstatus); });
|
//Serial.println("[ Nostr ] Connection status changed: " + sstatus);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
@ -204,9 +205,11 @@ void handleNostrZapCallback(const String &subId, nostr::SignedNostrEvent *event)
|
|||||||
|
|
||||||
if (strcmp(key, "bolt11") == 0)
|
if (strcmp(key, "bolt11") == 0)
|
||||||
{
|
{
|
||||||
Serial.println(F("Got a zap"));
|
Serial.print(F("Got a zap of "));
|
||||||
|
|
||||||
int64_t satsAmount = getAmountInSatoshis(std::string(value));
|
int64_t satsAmount = getAmountInSatoshis(std::string(value));
|
||||||
|
Serial.print(satsAmount);
|
||||||
|
Serial.println(F(" sats"));
|
||||||
|
|
||||||
std::array<std::string, NUM_SCREENS> textEpdContent = parseZapNotify(satsAmount, preferences.getBool("useSatsSymbol", DEFAULT_USE_SATS_SYMBOL));
|
std::array<std::string, NUM_SCREENS> textEpdContent = parseZapNotify(satsAmount, preferences.getBool("useSatsSymbol", DEFAULT_USE_SATS_SYMBOL));
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
|
|||||||
|
|
||||||
#ifdef HAS_FRONTLIGHT
|
#ifdef HAS_FRONTLIGHT
|
||||||
root["hasFrontlight"] = true;
|
root["hasFrontlight"] = true;
|
||||||
root["flDisable"] = preferences.getBool("flDisable", DEFAULT_DISABLE_FL);
|
root["flDisable"] = preferences.getBool("flDisable");
|
||||||
root["flMaxBrightness"] = preferences.getUInt("flMaxBrightness", DEFAULT_FL_MAX_BRIGHTNESS);
|
root["flMaxBrightness"] = preferences.getUInt("flMaxBrightness", DEFAULT_FL_MAX_BRIGHTNESS);
|
||||||
root["flAlwaysOn"] = preferences.getBool("flAlwaysOn", DEFAULT_FL_ALWAYS_ON);
|
root["flAlwaysOn"] = preferences.getBool("flAlwaysOn", DEFAULT_FL_ALWAYS_ON);
|
||||||
root["flEffectDelay"] = preferences.getUInt("flEffectDelay", DEFAULT_FL_EFFECT_DELAY);
|
root["flEffectDelay"] = preferences.getUInt("flEffectDelay", DEFAULT_FL_EFFECT_DELAY);
|
||||||
|
Loading…
Reference in New Issue
Block a user