Skip to content

Commit 5dd47c2

Browse files
committed
Fixes for Rev. B black PCB
1 parent 630943e commit 5dd47c2

File tree

8 files changed

+37
-13
lines changed

8 files changed

+37
-13
lines changed

data

Submodule data updated from 6c40b54 to 761c7f2

sdkconfig.defaults

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
4444
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120
4545
CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=n
4646
CONFIG_SPIRAM_CACHE_WORKAROUND=y
47-
CONFIG_COMPILER_OPTIMIZATION_PERF=y
47+
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
4848
CONFIG_NEWLIB_NANO_FORMAT=y

src/fonts/fonts.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include "antonio-semibold20.h"
4-
#include "antonio-semibold30.h"
4+
//#include "antonio-semibold30.h"
55
#include "antonio-semibold40.h"
66
#include "antonio-semibold90.h"
77
#include "sats-symbol.h"

src/lib/config.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ void setup()
5858
{
5959
preferences.clear();
6060
queueLedEffect(LED_EFFECT_WIFI_ERASE_SETTINGS);
61+
nvs_flash_erase();
62+
delay(1000);
63+
6164
ESP.restart();
6265
}
6366
}
@@ -229,6 +232,9 @@ void setupWifi()
229232
// esp_task_wdt_deinit();
230233
// esp_task_wdt_reset();
231234
}
235+
236+
237+
232238
setFgColor(preferences.getUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE));
233239
setBgColor(preferences.getUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK));
234240
}
@@ -274,6 +280,16 @@ void setupPreferences()
274280
else
275281
setCurrentCurrency(CURRENCY_USD);
276282

283+
if (!preferences.isKey("flDisable")) {
284+
preferences.putBool("flDisable", isWhiteVersion() ? false : true);
285+
}
286+
287+
if (!preferences.isKey("fgColor")) {
288+
preferences.putUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE);
289+
preferences.putUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK);
290+
}
291+
292+
277293
addScreenMapping(SCREEN_BLOCK_HEIGHT, "Block Height");
278294

279295
addScreenMapping(SCREEN_TIME, "Time");
@@ -455,6 +471,10 @@ void setupHardware()
455471
Serial.println(F("An Error has occurred while mounting LittleFS"));
456472
}
457473

474+
if (HW_REV == "REV_B_EPD_2_13" && !isWhiteVersion()) {
475+
Serial.println(F("Black Rev B"));
476+
}
477+
458478
if (!LittleFS.open("/index.html.gz", "r"))
459479
{
460480
Serial.println(F("Error loading WebUI"));
@@ -509,7 +529,7 @@ void setupHardware()
509529
}
510530

511531
#ifdef IS_HW_REV_B
512-
pinMode(39, INPUT_PULLUP);
532+
pinMode(39, INPUT_PULLDOWN);
513533

514534
#endif
515535

@@ -690,6 +710,7 @@ String getHwRev()
690710
bool isWhiteVersion()
691711
{
692712
#ifdef IS_HW_REV_B
713+
pinMode(39, INPUT_PULLDOWN);
693714
return digitalRead(39);
694715
#else
695716
return false;

src/lib/config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <WiFiManager.h>
88
#include <base64.h>
99
#include <esp_task_wdt.h>
10-
10+
#include <nvs_flash.h>
1111
#include <map>
1212

1313
#include "lib/block_notify.hpp"

src/lib/led_handler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bool flInTransition = false;
1313

1414
void frontlightFlash(int flDelayTime)
1515
{
16-
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
16+
if (preferences.getBool("flDisable"))
1717
return;
1818

1919
if (frontlightOn)
@@ -68,7 +68,7 @@ void frontlightFadeInAll(int flDelayTime)
6868

6969
void frontlightFadeInAll(int flDelayTime, bool staggered)
7070
{
71-
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
71+
if (preferences.getBool("flDisable"))
7272
return;
7373
if (frontlightIsOn())
7474
return;
@@ -120,7 +120,7 @@ void frontlightFadeOutAll(int flDelayTime)
120120

121121
void frontlightFadeOutAll(int flDelayTime, bool staggered)
122122
{
123-
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
123+
if (preferences.getBool("flDisable"))
124124
return;
125125
if (!frontlightIsOn())
126126
return;
@@ -186,7 +186,7 @@ bool frontlightIsOn()
186186

187187
void frontlightFadeIn(uint num, int flDelayTime)
188188
{
189-
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
189+
if (preferences.getBool("flDisable"))
190190
return;
191191
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += 5)
192192
{
@@ -197,7 +197,7 @@ void frontlightFadeIn(uint num, int flDelayTime)
197197

198198
void frontlightFadeOut(uint num, int flDelayTime)
199199
{
200-
if (preferences.getBool("flDisable", DEFAULT_DISABLE_FL))
200+
if (preferences.getBool("flDisable"))
201201
return;
202202
if (!frontlightIsOn())
203203
return;

src/lib/nostr_notify.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void setupNostrNotify(bool asDatasource, bool zapNotify)
7676
}else if(status==nostr::ConnectionStatus::ERROR){
7777
sstatus = "ERROR";
7878
}
79-
Serial.println("[ Nostr ] Connection status changed: " + sstatus); });
79+
//Serial.println("[ Nostr ] Connection status changed: " + sstatus);
80+
});
8081
}
8182
}
8283
catch (const std::exception &e)
@@ -204,9 +205,11 @@ void handleNostrZapCallback(const String &subId, nostr::SignedNostrEvent *event)
204205

205206
if (strcmp(key, "bolt11") == 0)
206207
{
207-
Serial.println(F("Got a zap"));
208+
Serial.print(F("Got a zap of "));
208209

209210
int64_t satsAmount = getAmountInSatoshis(std::string(value));
211+
Serial.print(satsAmount);
212+
Serial.println(F(" sats"));
210213

211214
std::array<std::string, NUM_SCREENS> textEpdContent = parseZapNotify(satsAmount, preferences.getBool("useSatsSymbol", DEFAULT_USE_SATS_SYMBOL));
212215

src/lib/webserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
705705

706706
#ifdef HAS_FRONTLIGHT
707707
root["hasFrontlight"] = true;
708-
root["flDisable"] = preferences.getBool("flDisable", DEFAULT_DISABLE_FL);
708+
root["flDisable"] = preferences.getBool("flDisable");
709709
root["flMaxBrightness"] = preferences.getUInt("flMaxBrightness", DEFAULT_FL_MAX_BRIGHTNESS);
710710
root["flAlwaysOn"] = preferences.getBool("flAlwaysOn", DEFAULT_FL_ALWAYS_ON);
711711
root["flEffectDelay"] = preferences.getUInt("flEffectDelay", DEFAULT_FL_EFFECT_DELAY);

0 commit comments

Comments
 (0)