New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Sonoff TH10/16 #476
base: main
Are you sure you want to change the base?
Add Sonoff TH10/16 #476
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,11 @@ | |
#define USE_LITTLEFS | ||
#define USE_STATUS_LED | ||
#define STATUS_LED_PIN 0 | ||
#elif defined(ARDUINO_ESP8266_SONOFF_TH) | ||
#define BOARD_ID "sonoff-th" | ||
#define USE_LITTLEFS | ||
#define USE_STATUS_LED | ||
#define STATUS_LED_PIN 13 // pull down | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this pin pulled down by default? |
||
#elif defined(ARDUINO_FEATHER_ESP32) | ||
#define BOARD_ID "feather-esp32" | ||
#define USE_LITTLEFS | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,7 @@ void Wippersnapper_DigitalGPIO::initDigitalPin( | |
#endif | ||
|
||
// Initialize LOW | ||
#if defined(ARDUINO_ESP8266_ADAFRUIT_HUZZAH) | ||
#if defined(ARDUINO_ESP8266_ADAFRUIT_HUZZAH) || defined(ESP8266_SONOFF_TH) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This applies to every ifdef like this, would we want to detect the ESP8266 arch instead of individual boards? Both boards we're using here (and elsewhere) seem to take the same pinout/pd resistor |
||
// The Adafruit Feather ESP8266's built-in LED is reverse wired so setting | ||
// the pin LOW will turn the LED on. | ||
digitalWrite(STATUS_LED_PIN, !0); | ||
|
@@ -213,10 +213,10 @@ void Wippersnapper_DigitalGPIO::digitalWriteSvc(uint8_t pinName, int pinValue) { | |
#endif | ||
|
||
// Write to the GPIO pin | ||
#if defined(ARDUINO_ESP8266_ADAFRUIT_HUZZAH) | ||
#if defined(ARDUINO_ESP8266_ADAFRUIT_HUZZAH) || defined(ESP8266_SONOFF_TH) | ||
// The Adafruit Feather ESP8266's built-in LED is reverse wired so setting the | ||
// pin LOW will turn the LED on. | ||
if (pinName == 0) | ||
if (pinName == STATUS_LED_PIN) | ||
digitalWrite(pinName, !pinValue); | ||
else | ||
digitalWrite(pinName, pinValue); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious - why is this flag required for the sonoff_th but not for the huzzah ESP8266?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe it is required for both. I couldn't push the filesystem image (platformIO) for the ESP8266 huzzah without this, I kept forgetting as it was part of my stash with secrets data file. Maybe I've got something configured wrong, but I think it was defaulting to spiffs rather than littlefs. I did the initial sonoff work just before the huzzah arrived later in the day and I was then able to get the secrets across and see debug with both sonoff + huzzah and moved the line to the common:esp8266 definition instead of the sonoff one.
I'll try to check on a fresh machine at some point soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! Could you try in the near the board define,
USE_LITTLEFS
too?