Skip to content

Commit

Permalink
[SYS] Bump ESP32 platform to v6.1.0 and ESP8266 to v4.1.0 (#1547)
Browse files Browse the repository at this point in the history
* Bump ESP32 platform to v6.1.0 and ESP8266 to v4.1.0

* Fix ESP32 not connecting to Ethernet

And remove check updates as it is now done every hour

* Do not define LED pins if not explicitly stated

* OLED need to be reset for Heltec Lora 32 V2

* Fix issue with SSD1306 saving
  • Loading branch information
1technophile authored Mar 23, 2023
1 parent 537d484 commit 86744b2
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 56 deletions.
8 changes: 4 additions & 4 deletions environments.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ build_flags =
custom_description = Default BLE gateway with additional servicedata, manufacturerdata and service uuid for analysing decoding issues

[env:esp32s3-dev-c1-ble]
platform = ${com.esp32_c3_s3_platform}
platform = ${com.esp32_platform}
board = esp32-s3-devkitc-1
lib_deps =
${com-esp.lib_deps}
Expand All @@ -1530,7 +1530,7 @@ build_flags =
custom_description = BLE gateway on the S3

[env:esp32c3-dev-m1-ble]
platform = ${com.esp32_c3_s3_platform}
platform = ${com.esp32_platform}
board = esp32-c3-devkitm-1
board_build.partitions = min_spiffs.csv
lib_deps =
Expand All @@ -1551,7 +1551,7 @@ build_flags =
custom_description = BLE gateway on the C3

[env:airm2m_core_esp32c3]
platform = ${com.esp32_c3_s3_platform}
platform = ${com.esp32_platform}
board = airm2m_core_esp32c3
board_build.partitions = min_spiffs.csv
lib_deps =
Expand All @@ -1571,7 +1571,7 @@ custom_hardware = AirM2M ESP32C3-CORE

; Wemos Lolin C3 mini v2.1.0
[env:lolin_c3_mini]
;platform = ${com.esp32_c3_s3_platform} ; standard is @5.2.0, causes `assert rwble.c 261` error
;platform = ${com.esp32_platform} ; standard is @5.2.0, causes `assert rwble.c 261` error
platform = [email protected] ; override to @5.3.0. Includes a fixed for the `assert rwble.c 261` error
board = lolin_c3_mini
board_build.partitions = min_spiffs.csv
Expand Down
84 changes: 54 additions & 30 deletions main/User_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,64 +417,85 @@ int lowpowermode = DEFAULT_LOW_POWER_MODE;
/*-------------DEFINE PINs FOR STATUS LEDs----------------*/
# ifndef LED_SEND_RECEIVE
# ifdef ESP8266
# define LED_SEND_RECEIVE 40
//# define LED_SEND_RECEIVE 40
# elif ESP32
# define LED_SEND_RECEIVE 40
//# define LED_SEND_RECEIVE 40
# elif __AVR_ATmega2560__ //arduino mega
# define LED_SEND_RECEIVE 40
//# define LED_SEND_RECEIVE 40
# else //arduino uno/nano
# define LED_SEND_RECEIVE 40
//# define LED_SEND_RECEIVE 40
# endif
# endif
# ifndef LED_SEND_RECEIVE_ON
# define LED_SEND_RECEIVE_ON HIGH
# endif
# ifndef LED_ERROR
# ifdef ESP8266
# define LED_ERROR 42
//# define LED_ERROR 42
# elif ESP32
# define LED_ERROR 42
//# define LED_ERROR 42
# elif __AVR_ATmega2560__ //arduino mega
# define LED_ERROR 42
//# define LED_ERROR 42
# else //arduino uno/nano
# define LED_ERROR 42
//# define LED_ERROR 42
# endif
# endif
# ifndef LED_ERROR_ON
# define LED_ERROR_ON HIGH
# endif
# ifndef LED_INFO
# ifdef ESP8266
# define LED_INFO 44
//# define LED_INFO 44
# elif ESP32
# define LED_INFO 44
//# define LED_INFO 44
# elif __AVR_ATmega2560__ //arduino mega
# define LED_INFO 44
//# define LED_INFO 44
# else //arduino uno/nano
# define LED_INFO 44
//# define LED_INFO 44
# endif
# endif
# ifndef LED_INFO_ON
# define LED_INFO_ON HIGH
# endif
# define SetupIndicators() \
pinMode(LED_SEND_RECEIVE, OUTPUT); \
pinMode(LED_INFO, OUTPUT); \
pinMode(LED_ERROR, OUTPUT); \
SendReceiveIndicatorOFF(); \
InfoIndicatorOFF(); \
ErrorIndicatorOFF();

# define ErrorIndicatorON() digitalWrite(LED_ERROR, LED_ERROR_ON)
# define ErrorIndicatorOFF() digitalWrite(LED_ERROR, !LED_ERROR_ON)
# define SendReceiveIndicatorON() digitalWrite(LED_SEND_RECEIVE, LED_SEND_RECEIVE_ON)
# define SendReceiveIndicatorOFF() digitalWrite(LED_SEND_RECEIVE, !LED_SEND_RECEIVE_ON)
# define InfoIndicatorON() digitalWrite(LED_INFO, LED_INFO_ON)
# define InfoIndicatorOFF() digitalWrite(LED_INFO, !LED_INFO_ON)
# define CriticalIndicatorON() // Not used
# define CriticalIndicatorON() // Not used
# define PowerIndicatorON() // Not used
# define PowerIndicatorOFF() // Not used

# ifdef LED_ERROR
# define SetupIndicatorError() \
pinMode(LED_ERROR, OUTPUT); \
ErrorIndicatorOFF();
# define ErrorIndicatorON() digitalWrite(LED_ERROR, LED_ERROR_ON)
# define ErrorIndicatorOFF() digitalWrite(LED_ERROR, !LED_ERROR_ON)
# else
# define SetupIndicatorError()
# define ErrorIndicatorON()
# define ErrorIndicatorOFF()
# endif
# ifdef LED_SEND_RECEIVE
# define SetupIndicatorSendReceive() \
pinMode(LED_SEND_RECEIVE, OUTPUT); \
SendReceiveIndicatorOFF();
# define SendReceiveIndicatorON() digitalWrite(LED_SEND_RECEIVE, LED_SEND_RECEIVE_ON)
# define SendReceiveIndicatorOFF() digitalWrite(LED_SEND_RECEIVE, !LED_SEND_RECEIVE_ON)
# else
# define SetupIndicatorSendReceive()
# define SendReceiveIndicatorON()
# define SendReceiveIndicatorOFF()
# endif
# ifdef LED_INFO
# define SetupIndicatorInfo() \
pinMode(LED_INFO, OUTPUT); \
InfoIndicatorOFF();
# define InfoIndicatorON() digitalWrite(LED_INFO, LED_INFO_ON)
# define InfoIndicatorOFF() digitalWrite(LED_INFO, !LED_INFO_ON)
# else
# define SetupIndicatorInfo()
# define InfoIndicatorON()
# define InfoIndicatorOFF()
# endif
# define CriticalIndicatorON() // Not used
# define CriticalIndicatorON() // Not used
# define PowerIndicatorON() // Not used
# define PowerIndicatorOFF() // Not used
# define SetupIndicators() // Not used
#else // Management of Errors, reception/emission and informations indicators with RGB LED
# if !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3) //I2S not available yet with Fastled on S3 and C3
# define FASTLED_ESP32_I2S // To avoid ESP32 instabilities https://github.com/FastLED/FastLED/issues/1438
Expand Down Expand Up @@ -549,6 +570,9 @@ CRGB leds2[FASTLED_IND_NUM_LEDS];
leds2[FASTLED_INFO_LED] = CRGB::Black; \
FastLED.show()
# endif
# define SetupIndicatorInfo()
# define SetupIndicatorSendReceive()
# define SetupIndicatorError()
#endif

#ifdef ESP8266
Expand Down
16 changes: 7 additions & 9 deletions main/ZdisplaySSD1306.ino
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ void MQTTtoSSD1306(char* topicOri, JsonObject& SSD1306data) { // json object dec
}
// save, load, init, erase
if (SSD1306data.containsKey("save") && SSD1306data["save"]) {
success = SSD1306Config_save();
if (success) {
Log.notice(F("SSD1306 config saved" CR));
}
SSD1306Config_save();
} else if (SSD1306data.containsKey("load") && SSD1306data["load"]) {
success = SSD1306Config_load();
if (success) {
Expand Down Expand Up @@ -207,7 +204,7 @@ void MQTTtoSSD1306(char* topicOri, JsonObject& SSD1306data) { // json object dec
}
}

bool SSD1306Config_save() {
void SSD1306Config_save() {
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
JsonObject jo = jsonBuffer.to<JsonObject>();
jo["onstate"] = displayState;
Expand All @@ -223,6 +220,7 @@ bool SSD1306Config_save() {
preferences.begin(Gateway_Short_Name, false);
preferences.putString("SSD1306Config", conf);
preferences.end();
Log.notice(F("SSD1306 config saved" CR));
}

void SSD1306Config_init() {
Expand Down Expand Up @@ -827,10 +825,10 @@ OledSerial Oled(0); // Not sure about this, came from Hardwareserial
OledSerial::OledSerial(int x) {
displayQueue = xQueueCreate(5, sizeof(displayQueueMessage*));
# if defined(WIFI_Kit_32) || defined(WIFI_LoRa_32) || defined(WIFI_LoRa_32_V2)
// pinMode(RST_OLED, OUTPUT); // https://github.com/espressif/arduino-esp32/issues/4278
// digitalWrite(RST_OLED, LOW);
// delay(50);
// digitalWrite(RST_OLED, HIGH);
pinMode(RST_OLED, OUTPUT); // https://github.com/espressif/arduino-esp32/issues/4278
digitalWrite(RST_OLED, LOW);
delay(50);
digitalWrite(RST_OLED, HIGH);
display = new SSD1306Wire(0x3c, SDA_OLED, SCL_OLED, GEOMETRY_128_64);
# elif defined(Wireless_Stick)
// pinMode(RST_OLED, OUTPUT); // https://github.com/espressif/arduino-esp32/issues/4278
Expand Down
2 changes: 0 additions & 2 deletions main/config_RF.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ struct RTL_433device {
bool isDisc;
};

extern std::vector<RTL_433device*> RTL_433devices;

const char parameters[40][4][24] = {
// RTL_433 key, name, unit, device_class
{"temperature_C", "temperature", "°C", "temperature"},
Expand Down
17 changes: 9 additions & 8 deletions main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,10 @@ void setup() {
checkButton();
#endif
//setup LED status
SetupIndicators();
SetupIndicatorError();
SetupIndicatorSendReceive();
SetupIndicatorInfo();
SetupIndicators(); // For RGB Leds

#if defined(ESP8266) || defined(ESP32)
# ifdef ESP8266
Expand Down Expand Up @@ -1492,24 +1495,24 @@ void setup_ethernet_esp32() {

void WiFiEvent(WiFiEvent_t event) {
switch (event) {
case SYSTEM_EVENT_ETH_START:
case ARDUINO_EVENT_ETH_START:
Log.trace(F("Ethernet Started" CR));
ETH.setHostname(gateway_name);
break;
case SYSTEM_EVENT_ETH_CONNECTED:
case ARDUINO_EVENT_ETH_CONNECTED:
Log.notice(F("Ethernet Connected" CR));
break;
case SYSTEM_EVENT_ETH_GOT_IP:
case ARDUINO_EVENT_ETH_GOT_IP:
Log.trace(F("OpenMQTTGateway MAC: %s" CR), ETH.macAddress().c_str());
Log.trace(F("OpenMQTTGateway IP: %s" CR), ETH.localIP().toString().c_str());
Log.trace(F("OpenMQTTGateway link speed: %d Mbps" CR), ETH.linkSpeed());
esp32EthConnected = true;
break;
case SYSTEM_EVENT_ETH_DISCONNECTED:
case ARDUINO_EVENT_ETH_DISCONNECTED:
Log.error(F("Ethernet Disconnected" CR));
esp32EthConnected = false;
break;
case SYSTEM_EVENT_ETH_STOP:
case ARDUINO_EVENT_ETH_STOP:
Log.error(F("Ethernet Stopped" CR));
esp32EthConnected = false;
break;
Expand Down Expand Up @@ -2178,8 +2181,6 @@ void MQTTHttpsFWUpdate(char* topicOri, JsonObject& HttpsFwUpdateData) {
# if defined(ZgatewayBT)
stopProcessing();
# endif
if (!checkForUpdates())
return;
systemUrl = RELEASE_LINK + latestVersion + "/" + ENV_NAME + "-firmware.bin";
url = systemUrl.c_str();
Log.notice(F("Using system OTA url with latest version %s" CR), url);
Expand Down
5 changes: 2 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,8 @@ build_flags =
monitor_speed = 115200

[com]
esp8266_platform = [email protected]
esp32_platform = [email protected]
esp32_c3_s3_platform = [email protected]
esp8266_platform = [email protected]
esp32_platform = [email protected]
esp32_solo_platform = https://github.com/tasmota/platform-espressif32/releases/download/v.2.0.5/platform-espressif32-v.2.0.5.zip
atmelavr_platform = [email protected]

Expand Down

0 comments on commit 86744b2

Please sign in to comment.