@@ -18,8 +18,9 @@ std::vector<ScreenMapping> screenMappings;
18
18
std::mutex mcpMutex;
19
19
uint lastTimeSync;
20
20
21
- void addScreenMapping (int value, const char * name) {
22
- screenMappings.push_back ({value, name});
21
+ void addScreenMapping (int value, const char *name)
22
+ {
23
+ screenMappings.push_back ({value, name});
23
24
}
24
25
25
26
void setup ()
@@ -74,16 +75,21 @@ void setup()
74
75
75
76
if (preferences.getBool (" useNostr" , DEFAULT_USE_NOSTR) || preferences.getBool (" nostrZapNotify" , DEFAULT_ZAP_NOTIFY_ENABLED))
76
77
{
77
- setupNostrNotify ();
78
+ setupNostrNotify (preferences. getBool ( " useNostr " , DEFAULT_USE_NOSTR), preferences. getBool ( " nostrZapNotify " , DEFAULT_ZAP_NOTIFY_ENABLED) );
78
79
setupNostrTask ();
79
80
}
80
-
81
+
81
82
if (!preferences.getBool (" useNostr" , DEFAULT_USE_NOSTR))
82
83
{
83
84
xTaskCreate (setupWebsocketClients, " setupWebsocketClients" , 8192 , NULL ,
84
85
tskIDLE_PRIORITY, NULL );
85
86
}
86
87
88
+ if (preferences.getBool (" bitaxeEnabled" , DEFAULT_BITAXE_ENABLED))
89
+ {
90
+ setupBitaxeFetchTask ();
91
+ }
92
+
87
93
setupButtonTask ();
88
94
setupOTA ();
89
95
@@ -255,7 +261,6 @@ void syncTime()
255
261
lastTimeSync = esp_timer_get_time () / 1000000 ;
256
262
}
257
263
258
-
259
264
void setupPreferences ()
260
265
{
261
266
preferences.begin (" btclock" , false );
@@ -281,9 +286,10 @@ void setupPreferences()
281
286
// screenNameMap[SCREEN_HALVING_COUNTDOWN] = "Halving countdown";
282
287
// screenNameMap[SCREEN_MARKET_CAP] = "Market Cap";
283
288
284
- if (preferences.getBool (" bitaxeEnabled" , DEFAULT_BITAXE_ENABLED)) {
285
- addScreenMapping (SCREEN_BITAXE_HASHRATE, " BitAxe Hashrate" );
286
- addScreenMapping (SCREEN_BITAXE_BESTDIFF, " BitAxe Best Difficulty" );
289
+ if (preferences.getBool (" bitaxeEnabled" , DEFAULT_BITAXE_ENABLED))
290
+ {
291
+ addScreenMapping (SCREEN_BITAXE_HASHRATE, " BitAxe Hashrate" );
292
+ addScreenMapping (SCREEN_BITAXE_BESTDIFF, " BitAxe Best Difficulty" );
287
293
}
288
294
}
289
295
@@ -300,11 +306,6 @@ void setupWebsocketClients(void *pvParameters)
300
306
setupPriceNotify ();
301
307
}
302
308
303
- if (preferences.getBool (" bitaxeEnabled" , DEFAULT_BITAXE_ENABLED))
304
- {
305
- setupBitaxeFetchTask ();
306
- }
307
-
308
309
vTaskDelete (NULL );
309
310
}
310
311
@@ -443,13 +444,17 @@ void setupHardware()
443
444
Serial.println (F (" Found BH1750" ));
444
445
hasLuxSensor = true ;
445
446
bh1750.begin (BH1750::CONTINUOUS_LOW_RES_MODE, 0x5C );
446
- } else {
447
+ }
448
+ else
449
+ {
447
450
Serial.println (F (" BH1750 Not found" ));
448
451
hasLuxSensor = false ;
449
452
}
450
453
#endif
451
454
}
452
455
456
+
457
+ #ifdef IMPROV_ENABLED
453
458
void improvGetAvailableWifiNetworks ()
454
459
{
455
460
int networkNum = WiFi.scanNetworks ();
@@ -658,6 +663,8 @@ void improv_set_error(improv::Error error)
658
663
Serial.write (data.data (), data.size ());
659
664
}
660
665
666
+ #endif
667
+
661
668
void WiFiEvent (WiFiEvent_t event, WiFiEventInfo_t info)
662
669
{
663
670
static bool first_connect = true ;
@@ -824,11 +831,14 @@ String getFsRev()
824
831
return ret;
825
832
}
826
833
827
- int findScreenIndexByValue (int value) {
828
- for (int i = 0 ; i < screenMappings.size (); i++) {
829
- if (screenMappings[i].value == value) {
830
- return i;
831
- }
834
+ int findScreenIndexByValue (int value)
835
+ {
836
+ for (int i = 0 ; i < screenMappings.size (); i++)
837
+ {
838
+ if (screenMappings[i].value == value)
839
+ {
840
+ return i;
832
841
}
833
- return -1 ; // Return -1 if value is not found
842
+ }
843
+ return -1 ; // Return -1 if value is not found
834
844
}
0 commit comments