Skip to content
3 changes: 2 additions & 1 deletion src/modules/ExternalNotificationModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ extern AmbientLightingThread *ambientLightingThread;
#endif
#endif

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6)
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
!defined(CONFIG_IDF_TARGET_ESP32H2)
#include <NonBlockingRtttl.h>
#else
// Noop class for portduino.
Expand Down
7 changes: 3 additions & 4 deletions src/modules/SerialModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ int32_t SerialModule::runOnce()
// Give it a chance to flush out 💩
delay(10);
}
#if defined(CONFIG_IDF_TARGET_ESP32C6)
#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
Serial1.setRxBufferSize(RX_BUFFER);
Serial1.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
Expand Down Expand Up @@ -279,7 +279,7 @@ int32_t SerialModule::runOnce()
}
#endif
else {
#if defined(CONFIG_IDF_TARGET_ESP32C6)
#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
while (Serial1.available()) {
serialPayloadSize = Serial1.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN);
#else
Expand Down Expand Up @@ -542,8 +542,7 @@ ParsedLine parseLine(const char *line)
*/
void SerialModule::processWXSerial()
{
#if SERIAL_PRINT_PORT != 0 && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6)

#if SERIAL_PRINT_PORT != 0 && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
static unsigned int lastAveraged = 0;
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
static double dir_sum_sin = 0;
Expand Down
9 changes: 7 additions & 2 deletions src/platform/esp32/main-esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ void esp32Setup()
// #define APP_WATCHDOG_SECS 45
#define APP_WATCHDOG_SECS 90

// esp_task_wdt_init returns an unknown error, so skip it on ESP32H2
#ifndef CONFIG_IDF_TARGET_ESP32H2
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
const esp_task_wdt_config_t wdt_config = {
.timeout_ms = APP_WATCHDOG_SECS * 1000,
Expand All @@ -302,7 +304,7 @@ void esp32Setup()
res = esp_task_wdt_add(NULL);
}
assert(res == ESP_OK);

#endif
#if HAS_32768HZ
enableSlowCLK();
#endif
Expand All @@ -311,7 +313,9 @@ void esp32Setup()
/// loop code specific to ESP32 targets
void esp32Loop()
{
#ifndef CONFIG_IDF_TARGET_ESP32H2
esp_task_wdt_reset(); // service our app level watchdog
#endif

// for debug printing
// radio.radioIf.canSleep();
Expand Down Expand Up @@ -344,9 +348,10 @@ void cpuDeepSleep(uint32_t msecToWake)
13,
#endif
34, 35, 37};

#ifndef CONFIG_IDF_TARGET_ESP32H2
for (int i = 0; i < sizeof(rtcGpios); i++)
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
#endif
#endif

// FIXME, disable internal rtc pullups/pulldowns on the non isolated pins. for inputs that we aren't using
Expand Down
2 changes: 2 additions & 0 deletions src/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ void enableModemSleep()
esp32_config.max_freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ;
#elif CONFIG_IDF_TARGET_ESP32C6
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
#elif CONFIG_IDF_TARGET_ESP32H2
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
#elif CONFIG_IDF_TARGET_ESP32C3
esp32_config.max_freq_mhz = CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ;
#elif CONFIG_IDF_TARGET_ESP32P4
Expand Down
26 changes: 26 additions & 0 deletions variants/esp32h2/esp32h2.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[esp32h2_base]
extends = esp32_common
custom_esp32_kind = esp32h2

build_flags =
${esp32_common.build_flags}
-DHAS_WIFI=0
-DMESHTASTIC_EXCLUDE_WIFI=1 ; TODO
-DMESHTASTIC_EXCLUDE_MQTT=1
-DMESHTASTIC_EXCLUDE_PAXCOUNTER=1
-DMESHTASTIC_EXCLUDE_WEBSERVER=1

build_unflags=
-DHAS_UDP_MULTICAST=1

build_src_filter =
${esp32_common.build_src_filter} -<mesh/http>

monitor_speed = 460800
monitor_filters = esp32_h2_exception_decoder

lib_ignore =
${esp32_common.lib_ignore}
libpax
esp32_idf5_https_server
esp_http_server
12 changes: 12 additions & 0 deletions variants/esp32h2/waveshare-esp32-h2/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[env:waveshare-esp32h2]
extends = esp32h2_base
board = esp32-h2-devkitm-1
board_build.f_flash = 16000000L
; Set this back to 'pr' once the CI plumbing is in place.
; board_level = pr
board_level = extra
build_flags =
${esp32h2_base.build_flags}
-I variants/esp32h2/waveshare-esp32-h2
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
9 changes: 9 additions & 0 deletions variants/esp32h2/waveshare-esp32-h2/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

#define HAS_SCREEN 0

#define SERIAL_PRINT_PORT 1

#define LORA_SCK 4
#define LORA_MISO 3
#define LORA_MOSI 2
#define LORA_CS 1
Loading