Skip to content

Commit 9527874

Browse files
committed
First stab at ESP32-C6 support for TLora-C6
1 parent 3d72fbb commit 9527874

File tree

19 files changed

+150
-40
lines changed

19 files changed

+150
-40
lines changed

arch/esp32/esp32c6.ini

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[esp32c6_base]
2+
extends = esp32_base
3+
platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
4+
build_flags =
5+
${arduino_base.build_flags}
6+
-Wall
7+
-Wextra
8+
-Isrc/platform/esp32
9+
-std=c++11
10+
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
11+
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
12+
-DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
13+
-DAXP_DEBUG_PORT=Serial
14+
-DCONFIG_BT_NIMBLE_ENABLED
15+
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
16+
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
17+
-DSERIAL_BUFFER_SIZE=4096
18+
-DLIBPAX_ARDUINO
19+
-DLIBPAX_WIFI
20+
-DLIBPAX_BLE
21+
-DMESHTASTIC_EXCLUDE_WEBSERVER
22+
;-DDEBUG_HEAP
23+
; TEMP
24+
-DHAS_BLUETOOTH=0
25+
-DMESHTASTIC_EXCLUDE_PAXCOUNTER
26+
-DMESHTASTIC_EXCLUDE_BLUETOOTH
27+
-DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
28+
29+
lib_deps =
30+
${arduino_base.lib_deps}
31+
${networking_base.lib_deps}
32+
${environmental_base.lib_deps}
33+
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
34+
https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
35+
rweather/Crypto@^0.4.0
36+
37+
build_src_filter =
38+
${esp32_base.build_src_filter} -<mesh/http>
39+
40+
monitor_speed = 115200
41+
monitor_filters = esp32_c3_exception_decoder
42+
43+
lib_ignore =
44+
NonBlockingRTTTL
45+
NimBLE-Arduino
46+
libpax
47+

src/gps/GPS.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ const char *getGPSPowerStateString(GPSPowerState state)
5858
case GPS_OFF:
5959
return "OFF";
6060
default:
61-
assert(false); // Unhandled enum value..
61+
assert(false); // Unhandled enum value..
62+
return "FALSE"; // to make new ESP-IDF happy
6263
}
6364
}
6465

@@ -328,7 +329,7 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t
328329
{
329330
uint16_t ubxFrameCounter = 0;
330331
uint32_t startTime = millis();
331-
uint16_t needRead;
332+
uint16_t needRead = 0;
332333

333334
while (millis() - startTime < waitMillis) {
334335
if (_serial_gps->available()) {

src/graphics/Screen.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,55 +1004,55 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
10041004

10051005
display->setColor(WHITE);
10061006
#ifndef EXCLUDE_EMOJI
1007-
if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F44D") == 0) {
1007+
if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F44D") == 0) {
10081008
display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2,
10091009
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height,
10101010
thumbup);
1011-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F44E") == 0) {
1011+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F44E") == 0) {
10121012
display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2,
10131013
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height,
10141014
thumbdown);
1015-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"") == 0) {
1015+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "") == 0) {
10161016
display->drawXbm(x + (SCREEN_WIDTH - question_width) / 2,
10171017
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - question_height) / 2 + 2 + 5, question_width, question_height,
10181018
question);
1019-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"‼️") == 0) {
1019+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "‼️") == 0) {
10201020
display->drawXbm(x + (SCREEN_WIDTH - bang_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - bang_height) / 2 + 2 + 5,
10211021
bang_width, bang_height, bang);
1022-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F4A9") == 0) {
1022+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F4A9") == 0) {
10231023
display->drawXbm(x + (SCREEN_WIDTH - poo_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - poo_height) / 2 + 2 + 5,
10241024
poo_width, poo_height, poo);
10251025
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\xf0\x9f\xa4\xa3") == 0) {
10261026
display->drawXbm(x + (SCREEN_WIDTH - haha_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - haha_height) / 2 + 2 + 5,
10271027
haha_width, haha_height, haha);
1028-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F44B") == 0) {
1028+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F44B") == 0) {
10291029
display->drawXbm(x + (SCREEN_WIDTH - wave_icon_width) / 2,
10301030
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - wave_icon_height) / 2 + 2 + 5, wave_icon_width,
10311031
wave_icon_height, wave_icon);
1032-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F920") == 0) {
1032+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F920") == 0) {
10331033
display->drawXbm(x + (SCREEN_WIDTH - cowboy_width) / 2,
10341034
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cowboy_height) / 2 + 2 + 5, cowboy_width, cowboy_height,
10351035
cowboy);
1036-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F42D") == 0) {
1036+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F42D") == 0) {
10371037
display->drawXbm(x + (SCREEN_WIDTH - deadmau5_width) / 2,
10381038
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - deadmau5_height) / 2 + 2 + 5, deadmau5_width, deadmau5_height,
10391039
deadmau5);
1040-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\xE2\x98\x80\xEF\xB8\x8F") == 0) {
1040+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\xE2\x98\x80\xEF\xB8\x8F") == 0) {
10411041
display->drawXbm(x + (SCREEN_WIDTH - sun_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - sun_height) / 2 + 2 + 5,
10421042
sun_width, sun_height, sun);
1043-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\u2614") == 0) {
1043+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\u2614") == 0) {
10441044
display->drawXbm(x + (SCREEN_WIDTH - rain_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - rain_height) / 2 + 2 + 10,
10451045
rain_width, rain_height, rain);
1046-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"☁️") == 0) {
1046+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "☁️") == 0) {
10471047
display->drawXbm(x + (SCREEN_WIDTH - cloud_width) / 2,
10481048
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cloud_height) / 2 + 2 + 5, cloud_width, cloud_height, cloud);
1049-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"🌫️") == 0) {
1049+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "🌫️") == 0) {
10501050
display->drawXbm(x + (SCREEN_WIDTH - fog_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - fog_height) / 2 + 2 + 5,
10511051
fog_width, fog_height, fog);
1052-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\xf0\x9f\x98\x88") == 0) {
1052+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\xf0\x9f\x98\x88") == 0) {
10531053
display->drawXbm(x + (SCREEN_WIDTH - devil_width) / 2,
10541054
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - devil_height) / 2 + 2 + 5, devil_width, devil_height, devil);
1055-
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"♥️") == 0) {
1055+
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "♥️") == 0) {
10561056
display->drawXbm(x + (SCREEN_WIDTH - heart_width) / 2,
10571057
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - heart_height) / 2 + 2 + 5, heart_width, heart_height, heart);
10581058
} else {

src/main.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,19 @@ void setup()
322322
#ifdef BUTTON_PIN
323323
#ifdef ARCH_ESP32
324324

325-
// If the button is connected to GPIO 12, don't enable the ability to use
326-
// meshtasticAdmin on the device.
327-
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT);
328-
325+
#if ESP_ARDUINO_VERSION_MAJOR >= 3
326+
#ifdef BUTTON_NEED_PULLUP
327+
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT_PULLUP);
328+
#else
329+
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT); // default to BUTTON_PIN
330+
#endif
331+
#else
332+
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT); // default to BUTTON_PIN
329333
#ifdef BUTTON_NEED_PULLUP
330334
gpio_pullup_en((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
331335
delay(10);
332336
#endif
333-
337+
#endif
334338
#endif
335339
#endif
336340

src/mesh/NodeDB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
NodeDB *nodeDB = nullptr;
5050

5151
// we have plenty of ram so statically alloc this tempbuf (for now)
52-
EXT_RAM_ATTR meshtastic_DeviceState devicestate;
52+
EXT_RAM_BSS_ATTR meshtastic_DeviceState devicestate;
5353
meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node;
5454
meshtastic_LocalConfig config;
5555
meshtastic_LocalModuleConfig moduleConfig;

src/mesh/TypedQueue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
template <class T> class TypedQueue
1616
{
17-
static_assert(std::is_pod<T>::value, "T must be pod");
17+
static_assert(std::is_standard_layout<T>::value, "T must be standard layout");
1818
QueueHandle_t h;
1919
concurrency::OSThread *reader = NULL;
2020

src/mesh/api/ServerAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ template <class T, class U> void APIServerPort<T, U>::init()
4545

4646
template <class T, class U> int32_t APIServerPort<T, U>::runOnce()
4747
{
48-
auto client = U::available();
48+
auto client = U::accept();
4949
if (client) {
5050
// Close any previous connection (see FIXME in header file)
5151
if (openAPI) {

src/mesh/wifi/WiFiAPClient.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ static void WiFiEvent(WiFiEvent_t event)
309309
onNetworkConnected();
310310
break;
311311
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
312-
LOG_INFO("Obtained IP6 address: %s\n", WiFi.localIPv6().toString().c_str());
312+
LOG_INFO("Obtained Local IP6 address: %s\n", WiFi.linkLocalIPv6().toString().c_str());
313+
LOG_INFO("Obtained GlobalIP6 address: %s\n", WiFi.globalIPv6().toString().c_str());
313314
break;
314315
case ARDUINO_EVENT_WIFI_STA_LOST_IP:
315316
LOG_INFO("Lost IP address and IP address is reset to 0\n");

src/modules/ExternalNotificationModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "SinglePortModule.h"
44
#include "concurrency/OSThread.h"
55
#include "configuration.h"
6-
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
6+
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6)
77
#include <NonBlockingRtttl.h>
88
#else
99
// Noop class for portduino.

src/modules/PositionModule.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ meshtastic_MeshPacket *PositionModule::allocAtakPli()
273273

274274
meshtastic_TAKPacket takPacket = {.is_compressed = true,
275275
.has_contact = true,
276-
.contact = {0},
276+
.contact = meshtastic_Contact_init_default,
277277
.has_group = true,
278278
.group = {meshtastic_MemberRole_TeamMember, meshtastic_Team_Cyan},
279279
.has_status = true,
@@ -282,13 +282,13 @@ meshtastic_MeshPacket *PositionModule::allocAtakPli()
282282
.battery = powerStatus->getBatteryChargePercent(),
283283
},
284284
.which_payload_variant = meshtastic_TAKPacket_pli_tag,
285-
{.pli = {
286-
.latitude_i = localPosition.latitude_i,
287-
.longitude_i = localPosition.longitude_i,
288-
.altitude = localPosition.altitude_hae,
289-
.speed = localPosition.ground_speed,
290-
.course = static_cast<uint16_t>(localPosition.ground_track),
291-
}}};
285+
.payload_variant = {.pli = {
286+
.latitude_i = localPosition.latitude_i,
287+
.longitude_i = localPosition.longitude_i,
288+
.altitude = localPosition.altitude_hae,
289+
.speed = localPosition.ground_speed,
290+
.course = static_cast<uint16_t>(localPosition.ground_track),
291+
}}};
292292

293293
auto length = unishox2_compress_lines(owner.long_name, strlen(owner.long_name), takPacket.contact.device_callsign,
294294
sizeof(takPacket.contact.device_callsign) - 1, USX_PSET_DFLT, NULL);

src/modules/SerialModule.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ SerialModuleRadio *serialModuleRadio;
6262
#if defined(TTGO_T_ECHO) || defined(CANARYONE)
6363
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("SerialModule") {}
6464
static Print *serialPrint = &Serial;
65+
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
66+
SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("SerialModule") {}
67+
static Print *serialPrint = &Serial1;
6568
#else
6669
SerialModule::SerialModule() : StreamAPI(&Serial2), concurrency::OSThread("SerialModule") {}
6770
static Print *serialPrint = &Serial2;
@@ -137,7 +140,16 @@ int32_t SerialModule::runOnce()
137140
// Give it a chance to flush out 💩
138141
delay(10);
139142
}
140-
#ifdef ARCH_ESP32
143+
#if defined(CONFIG_IDF_TARGET_ESP32C6)
144+
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
145+
Serial1.setRxBufferSize(RX_BUFFER);
146+
Serial1.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
147+
} else {
148+
Serial.begin(baud);
149+
Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT);
150+
}
151+
152+
#elif defined(ARCH_ESP32)
141153

142154
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
143155
Serial2.setRxBufferSize(RX_BUFFER);
@@ -205,8 +217,13 @@ int32_t SerialModule::runOnce()
205217
processWXSerial();
206218

207219
} else {
220+
#if defined(CONFIG_IDF_TARGET_ESP32C6)
221+
while (Serial1.available()) {
222+
serialPayloadSize = Serial1.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN);
223+
#else
208224
while (Serial2.available()) {
209225
serialPayloadSize = Serial2.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN);
226+
#endif
210227
serialModuleRadio->sendPayload();
211228
}
212229
}
@@ -392,7 +409,7 @@ uint32_t SerialModule::getBaudRate()
392409
*/
393410
void SerialModule::processWXSerial()
394411
{
395-
#if !defined(TTGO_T_ECHO) && !defined(CANARYONE)
412+
#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6)
396413
static unsigned int lastAveraged = 0;
397414
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
398415
static double dir_sum_sin = 0;

src/mqtt/MQTT.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ void MQTT::reconnect()
310310
mqttPassword = moduleConfig.mqtt.password;
311311
}
312312
#if HAS_WIFI && !defined(ARCH_PORTDUINO)
313+
#ifndef CONFIG_IDF_TARGET_ESP32C6
313314
if (moduleConfig.mqtt.tls_enabled) {
314315
// change default for encrypted to 8883
315316
try {
@@ -325,6 +326,9 @@ void MQTT::reconnect()
325326
LOG_INFO("Using non-TLS-encrypted session\n");
326327
pubSub.setClient(mqttClient);
327328
}
329+
#else
330+
pubSub.setClient(mqttClient);
331+
#endif
328332
#elif HAS_NETWORKING
329333
pubSub.setClient(mqttClient);
330334
#endif

src/mqtt/MQTT.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
#if HAS_WIFI
1010
#include <WiFiClient.h>
1111
#if !defined(ARCH_PORTDUINO)
12+
#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3
1213
#include <WiFiClientSecure.h>
1314
#endif
1415
#endif
16+
#endif
1517
#if HAS_ETHERNET
1618
#include <EthernetClient.h>
1719
#endif
@@ -33,9 +35,11 @@ class MQTT : private concurrency::OSThread
3335
#if HAS_WIFI
3436
WiFiClient mqttClient;
3537
#if !defined(ARCH_PORTDUINO)
38+
#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3
3639
WiFiClientSecure wifiSecureClient;
3740
#endif
3841
#endif
42+
#endif
3943
#if HAS_ETHERNET
4044
EthernetClient mqttClient;
4145
#endif

src/platform/esp32/main-esp32.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "mesh/wifi/WiFiAPClient.h"
1414
#endif
1515

16+
#include "esp_mac.h"
1617
#include "meshUtils.h"
1718
#include "sleep.h"
1819
#include "soc/rtc.h"
@@ -140,9 +141,16 @@ void esp32Setup()
140141
// #define APP_WATCHDOG_SECS 45
141142
#define APP_WATCHDOG_SECS 90
142143

144+
#ifdef CONFIG_IDF_TARGET_ESP32C6
145+
esp_task_wdt_config_t *wdt_config = (esp_task_wdt_config_t *)malloc(sizeof(esp_task_wdt_config_t));
146+
wdt_config->timeout_ms = APP_WATCHDOG_SECS * 1000;
147+
wdt_config->trigger_panic = true;
148+
res = esp_task_wdt_init(wdt_config);
149+
assert(res == ESP_OK);
150+
#else
143151
res = esp_task_wdt_init(APP_WATCHDOG_SECS, true);
144152
assert(res == ESP_OK);
145-
153+
#endif
146154
res = esp_task_wdt_add(NULL);
147155
assert(res == ESP_OK);
148156

@@ -216,7 +224,7 @@ void cpuDeepSleep(uint32_t msecToWake)
216224
// to detect wake and in normal operation the external part drives them hard.
217225
#ifdef BUTTON_PIN
218226
// Only GPIOs which are have RTC functionality can be used in this bit map: 0,2,4,12-15,25-27,32-39.
219-
#if SOC_RTCIO_HOLD_SUPPORTED
227+
#if SOC_RTCIO_HOLD_SUPPORTED && SOC_PM_SUPPORT_EXT_WAKEUP
220228
uint64_t gpioMask = (1ULL << (config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
221229
#endif
222230

src/power.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "configuration.h"
66

77
#ifdef ARCH_ESP32
8+
// "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h
89
#include <esp_adc_cal.h>
910
#include <soc/adc_channel.h>
1011
#endif

src/serialization/JSON.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ bool JSON::ExtractString(const char **data, std::string &str)
184184
// End of the string?
185185
else if (next_char == '"') {
186186
(*data)++;
187-
str.reserve(); // Remove unused capacity
187+
str.shrink_to_fit(); // Remove unused capacity
188188
return true;
189189
}
190190

src/sleep.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,14 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
446446
*/
447447
void enableModemSleep()
448448
{
449-
static esp_pm_config_esp32_t esp32_config; // filled with zeros because bss
449+
static esp_pm_config_t esp32_config; // filled with zeros because bss
450450

451451
#if CONFIG_IDF_TARGET_ESP32S3
452452
esp32_config.max_freq_mhz = CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ;
453453
#elif CONFIG_IDF_TARGET_ESP32S2
454454
esp32_config.max_freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ;
455+
#elif CONFIG_IDF_TARGET_ESP32C6
456+
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
455457
#elif CONFIG_IDF_TARGET_ESP32C3
456458
esp32_config.max_freq_mhz = CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ;
457459
#else

0 commit comments

Comments
 (0)