Skip to content

Commit 9d44308

Browse files
committed
Fix for GPIO0 button on Huzzah32
There there a few issues: - The button GPIO was configured incorrectly - The default random seed channel is 0, so that clashed with the the button - The default state was incorrect for whena button is triggered low Fixes #34
1 parent 073ace6 commit 9d44308

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

platformio.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,10 @@ src_build_flags =
237237
${common.version}.dev
238238
${common.src_build_flags}
239239
${common.src_build_flags_esp32}
240-
-DWIFI_LED=LED_BUILTIN
241-
-DWIFI_BUTTON=LED_BUILTIN
240+
-DWIFI_LED=13
241+
-DWIFI_LED_ON_STATE=HIGH
242+
-DWIFI_BUTTON=0
243+
-DWIFI_BUTTON_PRESSED_STATE=LOW
242244
-DRAPI_PORT=Serial
243245
-DDEBUG_PORT=Serial2
244246
-DSERIAL_RX_PULLUP_PIN=3

src/emonesp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,14 @@
6464
#define WIFI_CLIENT_RETRY_TIMEOUT (5 * 60 * 1000)
6565
#endif
6666

67+
// Used to change the ADC channel used for seeding the rndom number generator
68+
// Should be set to an unconnected pin
6769
#ifndef RANDOM_SEED_CHANNEL
70+
#if WIFI_BUTTON != 0 && (!defined(WIFI_LED) || WIFI_LED != 0)
6871
#define RANDOM_SEED_CHANNEL 0
72+
#else
73+
#define RANDOM_SEED_CHANNEL 1
74+
#endif
6975
#endif
7076

7177
#ifdef ONBOARD_LEDS

src/net_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int wifiLedState = !WIFI_LED_ON_STATE;
4646
unsigned long wifiLedTimeOut = millis();
4747
#endif
4848

49-
int wifiButtonState = HIGH;
49+
int wifiButtonState = !WIFI_BUTTON_PRESSED_STATE;
5050
unsigned long wifiButtonTimeOut = millis();
5151
bool apMessage = false;
5252

0 commit comments

Comments
 (0)