Fixes for Rev. B black PCB

This commit is contained in:
Djuri Baars 2024-09-16 21:50:28 +02:00
parent 630943ec54
commit 5dd47c2275
8 changed files with 37 additions and 13 deletions

2
data

@ -1 +1 @@
Subproject commit 6c40b54273b7f7c7d6c2624d3c2a066435f27756
Subproject commit 761c7f2991d347e97e77470ea3bf5511d7a7e507

View File

@ -44,5 +44,5 @@ CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120
CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n
CONFIG_SPIRAM_CACHE_WORKAROUND=y
CONFIG_COMPILER_OPTIMIZATION_PERF=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_NEWLIB_NANO_FORMAT=y

View File

@ -1,7 +1,7 @@
#pragma once
#include "antonio-semibold20.h"
#include "antonio-semibold30.h"
//#include "antonio-semibold30.h"
#include "antonio-semibold40.h"
#include "antonio-semibold90.h"
#include "sats-symbol.h"

View File

@ -58,6 +58,9 @@ void setup()
{
preferences.clear();
queueLedEffect(LED_EFFECT_WIFI_ERASE_SETTINGS);
nvs_flash_erase();
delay(1000);
ESP.restart();
}
}
@ -229,6 +232,9 @@ void setupWifi()
// esp_task_wdt_deinit();
// esp_task_wdt_reset();
}
setFgColor(preferences.getUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE));
setBgColor(preferences.getUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK));
}
@ -274,6 +280,16 @@ void setupPreferences()
else
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_TIME, "Time");
@ -455,6 +471,10 @@ void setupHardware()
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"))
{
Serial.println(F("Error loading WebUI"));
@ -509,7 +529,7 @@ void setupHardware()
}
#ifdef IS_HW_REV_B
pinMode(39, INPUT_PULLUP);
pinMode(39, INPUT_PULLDOWN);
#endif
@ -690,6 +710,7 @@ String getHwRev()
bool isWhiteVersion()
{
#ifdef IS_HW_REV_B
pinMode(39, INPUT_PULLDOWN);
return digitalRead(39);
#else
return false;

View File

@ -7,7 +7,7 @@
#include <WiFiManager.h>
#include <base64.h>
#include <esp_task_wdt.h>
#include <nvs_flash.h>
#include <map>
#include "lib/block_notify.hpp"

View File

@ -13,7 +13,7 @@ bool flInTransition = false;
void frontlightFlash(int flDelayTime)
{
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
if (preferences.getBool("flDisable"))
return;
if (frontlightOn)
@ -68,7 +68,7 @@ void frontlightFadeInAll(int flDelayTime)
void frontlightFadeInAll(int flDelayTime, bool staggered)
{
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
if (preferences.getBool("flDisable"))
return;
if (frontlightIsOn())
return;
@ -120,7 +120,7 @@ void frontlightFadeOutAll(int flDelayTime)
void frontlightFadeOutAll(int flDelayTime, bool staggered)
{
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
if (preferences.getBool("flDisable"))
return;
if (!frontlightIsOn())
return;
@ -186,7 +186,7 @@ bool frontlightIsOn()
void frontlightFadeIn(uint num, int flDelayTime)
{
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
if (preferences.getBool("flDisable"))
return;
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)
{
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
if (preferences.getBool("flDisable"))
return;
if (!frontlightIsOn())
return;

View File

@ -76,7 +76,8 @@ void setupNostrNotify(bool asDatasource, bool zapNotify)
}else if(status==nostr::ConnectionStatus::ERROR){
sstatus = "ERROR";
}
Serial.println("[ Nostr ] Connection status changed: " + sstatus); });
//Serial.println("[ Nostr ] Connection status changed: " + sstatus);
});
}
}
catch (const std::exception &e)
@ -204,9 +205,11 @@ void handleNostrZapCallback(const String &subId, nostr::SignedNostrEvent *event)
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));
Serial.print(satsAmount);
Serial.println(F(" sats"));
std::array<std::string, NUM_SCREENS> textEpdContent = parseZapNotify(satsAmount, preferences.getBool("useSatsSymbol", DEFAULT_USE_SATS_SYMBOL));

View File

@ -705,7 +705,7 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
#ifdef HAS_FRONTLIGHT
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["flAlwaysOn"] = preferences.getBool("flAlwaysOn", DEFAULT_FL_ALWAYS_ON);
root["flEffectDelay"] = preferences.getUInt("flEffectDelay", DEFAULT_FL_EFFECT_DELAY);