diff --git a/hardware/targets.json b/hardware/targets.json index 8e26c94b..b47257e1 100644 --- a/hardware/targets.json +++ b/hardware/targets.json @@ -459,6 +459,18 @@ "firmware": "TIMER_ESP12F_Backpack", "upload_methods": ["uart", "wifi"], "platform": "esp8285" + }, + "esp32c3": { + "product_name": "Backpack for Race Timer with ESP32C3", + "firmware": "TIMER_ESP32C3_Backpack", + "upload_methods": ["uart", "wifi"], + "platform": "esp32-c3" + }, + "esp32s3": { + "product_name": "Backpack for Race Timer with ESP32S3", + "firmware": "TIMER_ESP32S3_Backpack", + "upload_methods": ["uart", "wifi"], + "platform": "esp32-s3" } } }, @@ -479,10 +491,22 @@ }, "NuclearHazard": { "product_name": "NuclearHazard", - "firmware": "TIMER_ESP32_Backpack", + "firmware": "NuclearHazard_Backpack", "upload_methods": ["wifi"], "platform": "esp32" + }, + "esp32c3": { + "product_name": "ESP32C3 Module (DIY)", + "firmware": "TIMER_ESP32C3_Backpack", + "upload_methods": ["uart", "wifi"], + "platform": "esp32-c3" + }, + "esp32s3": { + "product_name": "ESP32S3 Module (DIY)", + "firmware": "TIMER_ESP32S3_Backpack", + "upload_methods": ["uart", "wifi"], + "platform": "esp32-s3" } } } -} +} \ No newline at end of file diff --git a/html/scan.js b/html/scan.js index 746bbc5f..ed6c9d41 100644 --- a/html/scan.js +++ b/html/scan.js @@ -56,7 +56,7 @@ function updateConfig(data) { mui.tabs.activate('pane-justified-2'); _('tx_tab').style.display = 'none'; } - if(config['product_name']) _('product_name').textContent = config['product_name']; + if(config['product_name'] && _('product-name')) _('product_name').textContent = config['product_name']; updateAatConfig(config); } diff --git a/lib/WIFI/devWIFI.cpp b/lib/WIFI/devWIFI.cpp index ad172110..0e38edbd 100644 --- a/lib/WIFI/devWIFI.cpp +++ b/lib/WIFI/devWIFI.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #else #include #include @@ -646,6 +647,9 @@ static void HandleWebUpdate() WiFi.softAP(wifi_ap_ssid, wifi_ap_password); WiFi.scanNetworks(true); startServices(); + #if defined(PLATFORM_ESP32) + esp_wifi_set_protocol(WIFI_IF_AP, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N); + #endif break; case WIFI_STA: DBGLN("Connecting to home network '%s' '%s'", station_ssid, station_password); diff --git a/python/binary_configurator.py b/python/binary_configurator.py index 932b66d1..20f784a5 100644 --- a/python/binary_configurator.py +++ b/python/binary_configurator.py @@ -93,7 +93,7 @@ def upload_esp32_uart(args): args.port = serials_find.get_serial_port() try: dir = os.path.dirname(args.file.name) - start_addr = '0x0000' if args.platform.startswith('esp32-c') else '0x1000' + start_addr = '0x0000' if args.platform.startswith('esp32-') else '0x1000' esptool.main(['--chip', args.platform.replace('-', ''), '--port', args.port, '--baud', str(args.baud), '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', start_addr, os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name]) except: return ElrsUploadResult.ErrorGeneral @@ -104,7 +104,7 @@ def upload_esp32_etx(args): args.port = serials_find.get_serial_port() try: dir = os.path.dirname(args.file.name) - start_addr = '0x0000' if args.platform.startswith('esp32-c') else '0x1000' + start_addr = '0x0000' if args.platform.startswith('esp32-') else '0x1000' esptool.main(['--passthrough', '--chip', args.platform.replace('-', ''), '--port', args.port, '--baud', '460800', '--before', 'etx', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', start_addr, os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name]) except: return ElrsUploadResult.ErrorGeneral @@ -115,7 +115,7 @@ def upload_esp32_passthru(args): args.port = serials_find.get_serial_port() try: dir = os.path.dirname(args.file.name) - start_addr = '0x0000' if args.platform.startswith('esp32-c') else '0x1000' + start_addr = '0x0000' if args.platform.startswith('esp32-') else '0x1000' esptool.main(['--passthrough', '--chip', args.platform.replace('-', ''), '--port', args.port, '--baud', '230400', '--before', 'passthru', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', start_addr, os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name]) except: return ElrsUploadResult.ErrorGeneral diff --git a/src/Timer_main.cpp b/src/Timer_main.cpp index dec612e1..b73f1665 100644 --- a/src/Timer_main.cpp +++ b/src/Timer_main.cpp @@ -342,6 +342,11 @@ void SetSoftMACAddress() firmwareOptions.uid[0] = firmwareOptions.uid[0] & ~0x01; WiFi.mode(WIFI_STA); + #if defined(PLATFORM_ESP8266) + WiFi.setOutputPower(20.5); + #elif defined(PLATFORM_ESP32) + WiFi.setTxPower(WIFI_POWER_19_5dBm); + #endif WiFi.begin("network-name", "pass-to-network", 1); WiFi.disconnect(); @@ -350,6 +355,7 @@ void SetSoftMACAddress() wifi_set_macaddr(STATION_IF, firmwareOptions.uid); #elif defined(PLATFORM_ESP32) esp_wifi_set_mac(WIFI_IF_STA, firmwareOptions.uid); + esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR); #endif } @@ -436,12 +442,12 @@ void setup() } esp_now_register_recv_cb(OnDataRecv); - + #if defined(PLATFORM_ESP32) esp_now_register_send_cb(OnDataSent); xSemaphoreGive(semaphore); #endif - + registerPeer(firmwareOptions.uid); memcpy(sendAddress, firmwareOptions.uid, 6); diff --git a/src/Tx_main.cpp b/src/Tx_main.cpp index b4c280bb..3ce4facf 100644 --- a/src/Tx_main.cpp +++ b/src/Tx_main.cpp @@ -258,6 +258,7 @@ void SetSoftMACAddress() WiFi.setOutputPower(20.5); #elif defined(PLATFORM_ESP32) WiFi.setTxPower(WIFI_POWER_19_5dBm); + esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR); #endif WiFi.begin("network-name", "pass-to-network", 1); WiFi.disconnect(); diff --git a/src/Vrx_main.cpp b/src/Vrx_main.cpp index 7c356e96..5b2c458d 100644 --- a/src/Vrx_main.cpp +++ b/src/Vrx_main.cpp @@ -312,6 +312,7 @@ void SetSoftMACAddress() WiFi.setOutputPower(20.5); #elif defined(PLATFORM_ESP32) WiFi.setTxPower(WIFI_POWER_19_5dBm); + esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR); #endif WiFi.begin("network-name", "pass-to-network", 1); WiFi.disconnect(); @@ -485,7 +486,7 @@ void loop() turnOffLED(); ESP.restart(); } - #endif + #endif if (connectionState == wifiUpdate) { diff --git a/targets/common.ini b/targets/common.ini index d9c850ce..6a78c14c 100644 --- a/targets/common.ini +++ b/targets/common.ini @@ -37,19 +37,20 @@ build_flags = # ------------------------- COMMON ESP32 DEFINITIONS ----------------- [env_common_esp32] -platform = espressif32@5.2.0 +platform = espressif32@6.7.0 board = esp32dev -; board_build.partitions = min_spiffs.csv +board_build.partitions = min_spiffs.csv upload_speed = 460800 monitor_speed = 460800 upload_resetmethod = nodemcu board_build.f_cpu = 240000000L build_flags = -D PLATFORM_ESP32=1 +lib_ignore = STM32UPDATE -# ------------------------- COMMON ESP32 DEFINITIONS ----------------- +# ------------------------- COMMON ESP32C3 DEFINITIONS ----------------- [env_common_esp32c3] -platform = espressif32@6.4.0 +platform = espressif32@6.7.0 board = esp32-c3-devkitm-1 board_build.partitions = min_spiffs.csv upload_speed = 460800 @@ -60,6 +61,19 @@ build_flags = -D PLATFORM_ESP32=1 lib_ignore = STM32UPDATE +# ------------------------- COMMON ESP32S3 DEFINITIONS ----------------- +[env_common_esp32s3] +platform = espressif32@6.7.0 +board = esp32-s3-devkitc-1 +board_build.partitions = min_spiffs.csv +upload_speed = 460800 +monitor_speed = 460800 +upload_resetmethod = nodemcu +board_build.f_cpu = 240000000L +build_flags = + -D PLATFORM_ESP32=1 +lib_ignore = STM32UPDATE + # ------------------------- COMMON TX-BACKPACK DEFINITIONS ----------------- [tx_backpack_common] build_flags = diff --git a/targets/debug.ini b/targets/debug.ini index cf5bbff7..d6c0c1f4 100644 --- a/targets/debug.ini +++ b/targets/debug.ini @@ -4,11 +4,11 @@ [env:DEBUG_ESP_RX_Backpack_via_UART] extends = env_common_esp8285, steadyview_vrx_backpack_common +upload_resetmethod = nodemcu build_flags = ${env_common_esp8285.build_flags} ${steadyview_vrx_backpack_common.build_flags} -D DEBUG_LOG - -D DEBUG_ELRS_WIFI -D PIN_LED=16 -D PIN_MOSI=12 ;Some pin (not a UART) -D PIN_CLK=0 ;Boot pad @@ -17,6 +17,21 @@ build_flags = [env:DEBUG_ESP_RX_Backpack_via_WIFI] extends = env:DEBUG_ESP_RX_Backpack_via_UART +[env:DEBUG_ESP32_RX_Backpack_via_UART] +extends = env_common_esp32, steadyview_vrx_backpack_common +upload_resetmethod = nodemcu +build_flags = + ${env_common_esp32.build_flags} + ${steadyview_vrx_backpack_common.build_flags} + -D DEBUG_LOG + -D PIN_LED=2 + -D PIN_MOSI=18 ;Some pin (not a UART) + -D PIN_CLK=19 ;Boot pad + -D PIN_CS=5 ;Some other pin (not a UART) + +[env:DEBUG_ESP32_RX_Backpack_via_WIFI] +extends = env:DEBUG_ESP32_RX_Backpack_via_UART + # ******************************** # Transmitter backpack targets # ******************************** @@ -41,6 +56,7 @@ extends = env_common_esp32, tx_backpack_common build_flags = ${env_common_esp32.build_flags} ${tx_backpack_common.build_flags} + -D DEBUG_LOG -D PIN_BUTTON=0 -D PIN_LED=4 lib_ignore = STM32UPDATE diff --git a/targets/timer.ini b/targets/timer.ini index b2200366..185a083f 100644 --- a/targets/timer.ini +++ b/targets/timer.ini @@ -33,4 +33,37 @@ build_flags = -D PIN_LED=2 [env:TIMER_ESP12F_Backpack_via_WIFI] -extends = env:TIMER_ESP12F_Backpack_via_UART \ No newline at end of file +extends = env:TIMER_ESP12F_Backpack_via_UART + +[env:TIMER_ESP32C3_Backpack_via_UART] +extends = env_common_esp32c3, timer_backpack_common +build_flags = + ${env_common_esp32c3.build_flags} + ${timer_backpack_common.build_flags} + -D PIN_BUTTON=9 + -D PIN_LED=8 + +[env:TIMER_ESP32C3_Backpack_via_WIFI] +extends = env:TIMER_ESP32C3_Backpack_via_UART + +[env:TIMER_ESP32S3_Backpack_via_UART] +extends = env_common_esp32s3, timer_backpack_common +build_flags = + ${env_common_esp32s3.build_flags} + ${timer_backpack_common.build_flags} + -D PIN_BUTTON=0 + -D PIN_LED=21 + +[env:TIMER_ESP32S3_Backpack_via_WIFI] +extends = env:TIMER_ESP32S3_Backpack_via_UART + +[env:NuclearHazard_Backpack_via_UART] +extends = env_common_esp32, timer_backpack_common +build_flags = + ${env_common_esp32.build_flags} + ${timer_backpack_common.build_flags} + -D PIN_BUTTON=0 + -D PIN_LED=15 + +[env:NuclearHazard_Backpack_via_WIFI] +extends = env:NuclearHazard_Backpack_via_UART \ No newline at end of file