diff --git a/.github/workflows/first_time_contributor.yml b/.github/workflows/first_time_contributor.yml index 272ce4d10..1ebc9a602 100644 --- a/.github/workflows/first_time_contributor.yml +++ b/.github/workflows/first_time_contributor.yml @@ -22,7 +22,7 @@ jobs: ### @{fc-author}, Welcome to Meshtastic! :wave: Thanks for opening your first issue. If it's helpful, an easy way - to get logs is the "Open Serial Monitor" button on the (Web Flasher](https://flasher.meshtastic.org). + to get logs is the "Open Serial Monitor" button on the [Web Flasher](https://flasher.meshtastic.org). If you have ideas for features, note that we often debate big ideas in the [discussions tab](https://github.com/meshtastic/firmware/discussions/categories/ideas) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index c923a22a6..4f7cbf194 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -8,7 +8,9 @@ on: branches: - master - develop + - pioarduino # Remove when merged // use `feature/` in the future. - event/* + - feature/* paths-ignore: - "**.md" - version.properties @@ -18,7 +20,9 @@ on: branches: - master - develop + - pioarduino # Remove when merged // use `feature/` in the future. - event/* + - feature/* paths-ignore: - "**.md" #- "**.yml" diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index cabe0dd97..40fcd7109 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -143,7 +143,7 @@ jobs: merge-multiple: true - name: Test Report - uses: dorny/test-reporter@v2.3.0 + uses: dorny/test-reporter@v2.4.0 with: name: PlatformIO Tests path: testreport.xml diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 3656ae32c..705f0177c 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -8,8 +8,8 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - checkov@3.2.495 - - renovate@42.66.8 + - checkov@3.2.496 + - renovate@42.66.14 - prettier@3.7.4 - trufflehog@3.92.4 - yamllint@1.37.1 diff --git a/SECURITY.md b/SECURITY.md index 5092595e1..a77a4d028 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,8 +4,8 @@ | Firmware Version | Supported | | ---------------- | ------------------ | -| 2.6.x | :white_check_mark: | -| <= 2.5.x | :x: | +| 2.7.x | :white_check_mark: | +| <= 2.6.x | :x: | ## Reporting a Vulnerability diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index 4e799b30a..d07a09a16 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -38,4 +38,4 @@ cp bin/device-install.* $OUTDIR/ cp bin/device-update.* $OUTDIR/ echo "Copying manifest" -cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json +cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json || true diff --git a/bin/build-nrf52.sh b/bin/build-nrf52.sh index edcc2add2..99187ba0d 100755 --- a/bin/build-nrf52.sh +++ b/bin/build-nrf52.sh @@ -49,4 +49,4 @@ if (echo $1 | grep -q "rak4631"); then fi echo "Copying manifest" -cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json +cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json || true diff --git a/bin/build-rp2xx0.sh b/bin/build-rp2xx0.sh index 3ef1c1e34..992a39be7 100755 --- a/bin/build-rp2xx0.sh +++ b/bin/build-rp2xx0.sh @@ -30,4 +30,4 @@ echo "Copying uf2 file" cp $BUILDDIR/$basename.uf2 $OUTDIR/$basename.uf2 echo "Copying manifest" -cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json +cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json || true diff --git a/bin/build-stm32wl.sh b/bin/build-stm32wl.sh index 023f3603c..64eb36586 100755 --- a/bin/build-stm32wl.sh +++ b/bin/build-stm32wl.sh @@ -30,4 +30,4 @@ echo "Copying STM32 bin file" cp $BUILDDIR/$basename.bin $OUTDIR/$basename.bin echo "Copying manifest" -cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json +cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json || true diff --git a/bin/config.d/lora-usb-meshstick-1262.yaml b/bin/config.d/lora-usb-meshstick-1262.yaml new file mode 100644 index 000000000..a539d76a1 --- /dev/null +++ b/bin/config.d/lora-usb-meshstick-1262.yaml @@ -0,0 +1,14 @@ +Lora: + Module: sx1262 + CS: 0 + IRQ: 6 + Reset: 2 + Busy: 4 + RXen: 1 + DIO2_AS_RF_SWITCH: true + spidev: ch341 + DIO3_TCXO_VOLTAGE: true +# USB_Serialnum: 12345678 + USB_PID: 0x5512 + USB_VID: 0x1A86 + SX126X_MAX_POWER: 22 \ No newline at end of file diff --git a/bin/org.meshtastic.meshtasticd.metainfo.xml b/bin/org.meshtastic.meshtasticd.metainfo.xml index 140ac3e2a..cb8985ee6 100644 --- a/bin/org.meshtastic.meshtasticd.metainfo.xml +++ b/bin/org.meshtastic.meshtasticd.metainfo.xml @@ -87,6 +87,9 @@ + + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.18 + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.17 diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index b6560f35b..90d733ca7 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -2,11 +2,12 @@ # trunk-ignore-all(ruff/F821) # trunk-ignore-all(flake8/F821): For SConstruct imports import sys -from os.path import join, basename, isfile +from os.path import join import subprocess import json import re from datetime import datetime +from typing import Dict from readprops import readProps @@ -14,8 +15,47 @@ Import("env") platform = env.PioPlatform() progname = env.get("PROGNAME") lfsbin = f"{progname.replace('firmware-', 'littlefs-')}.bin" +manifest_ran = False + +def infer_architecture(board_cfg): + try: + mcu = board_cfg.get("build.mcu") if board_cfg else None + except KeyError: + mcu = None + except Exception: + mcu = None + if not mcu: + return None + mcu_l = str(mcu).lower() + if "esp32s3" in mcu_l: + return "esp32-s3" + if "esp32c6" in mcu_l: + return "esp32-c6" + if "esp32c3" in mcu_l: + return "esp32-c3" + if "esp32" in mcu_l: + return "esp32" + if "rp2040" in mcu_l: + return "rp2040" + if "rp2350" in mcu_l: + return "rp2350" + if "nrf52" in mcu_l or "nrf52840" in mcu_l: + return "nrf52840" + if "stm32" in mcu_l: + return "stm32" + return None def manifest_gather(source, target, env): + global manifest_ran + if manifest_ran: + return + # Skip manifest generation if we cannot determine architecture (host/native builds) + board_arch = infer_architecture(env.BoardConfig()) + if not board_arch: + print(f"Skipping mtjson generation for unknown architecture (env={env.get('PIOENV')})") + manifest_ran = True + return + manifest_ran = True out = [] board_platform = env.BoardConfig().get("platform") needs_ota_suffix = board_platform == "nordicnrf52" @@ -47,14 +87,39 @@ def manifest_gather(source, target, env): manifest_write(out, env) def manifest_write(files, env): + # Defensive: also skip manifest writing if we cannot determine architecture + def get_project_option(name): + try: + return env.GetProjectOption(name) + except Exception: + return None + + def get_project_option_any(names): + for name in names: + val = get_project_option(name) + if val is not None: + return val + return None + + def as_bool(val): + return str(val).strip().lower() in ("1", "true", "yes", "on") + + def as_int(val): + try: + return int(str(val), 10) + except (TypeError, ValueError): + return None + + def as_list(val): + return [item.strip() for item in str(val).split(",") if item.strip()] + manifest = { "version": verObj["long"], "build_epoch": build_epoch, - "board": env.get("PIOENV"), + "platformioTarget": env.get("PIOENV"), "mcu": env.get("BOARD_MCU"), "repo": repo_owner, "files": files, - "part": None, "has_mui": False, "has_inkhud": False, } @@ -69,6 +134,51 @@ def manifest_write(files, env): if "MESHTASTIC_INCLUDE_INKHUD" in env.get("CPPDEFINES", []): manifest["has_inkhud"] = True + pioenv = env.get("PIOENV") + device_meta = {} + device_meta_fields = [ + ("hwModel", ["custom_meshtastic_hw_model"], as_int), + ("hwModelSlug", ["custom_meshtastic_hw_model_slug"], str), + ("architecture", ["custom_meshtastic_architecture"], str), + ("activelySupported", ["custom_meshtastic_actively_supported"], as_bool), + ("displayName", ["custom_meshtastic_display_name"], str), + ("supportLevel", ["custom_meshtastic_support_level"], as_int), + ("images", ["custom_meshtastic_images"], as_list), + ("tags", ["custom_meshtastic_tags"], as_list), + ("requiresDfu", ["custom_meshtastic_requires_dfu"], as_bool), + ("partitionScheme", ["custom_meshtastic_partition_scheme"], str), + ("url", ["custom_meshtastic_url"], str), + ("key", ["custom_meshtastic_key"], str), + ("variant", ["custom_meshtastic_variant"], str), + ] + + + for manifest_key, option_keys, caster in device_meta_fields: + raw_val = get_project_option_any(option_keys) + if raw_val is None: + continue + parsed = caster(raw_val) if callable(caster) else raw_val + if parsed is not None and parsed != "": + device_meta[manifest_key] = parsed + + # Determine architecture once; if we can't infer it, skip manifest generation + board_arch = device_meta.get("architecture") or infer_architecture(env.BoardConfig()) + if not board_arch: + print(f"Skipping mtjson write for unknown architecture (env={env.get('PIOENV')})") + return + + device_meta["architecture"] = board_arch + + # Always set requiresDfu: true for nrf52840 targets + if board_arch == "nrf52840": + device_meta["requiresDfu"] = True + + device_meta.setdefault("displayName", pioenv) + device_meta.setdefault("activelySupported", False) + + if device_meta: + manifest.update(device_meta) + # Write the manifest to the build directory with open(env.subst("$BUILD_DIR/${PROGNAME}.mt.json"), "w") as f: json.dump(manifest, f, indent=2) @@ -166,8 +276,12 @@ def load_boot_logo(source, target, env): if ("HAS_TFT", 1) in env.get("CPPDEFINES", []): env.AddPreAction(f"$BUILD_DIR/{lfsbin}", load_boot_logo) -mtjson_deps = ["buildprog"] -if platform.name == "espressif32": +board_arch = infer_architecture(env.BoardConfig()) +should_skip_manifest = board_arch is None + +# For host/native envs, avoid depending on 'buildprog' (some targets don't define it) +mtjson_deps = [] if should_skip_manifest else ["buildprog"] +if not should_skip_manifest and platform.name == "espressif32": # Build littlefs image as part of mtjson target # Equivalent to `pio run -t buildfs` target_lfs = env.DataToBin( @@ -175,11 +289,27 @@ if platform.name == "espressif32": ) mtjson_deps.append(target_lfs) -env.AddCustomTarget( - name="mtjson", - dependencies=mtjson_deps, - actions=[manifest_gather], - title="Meshtastic Manifest", - description="Generating Meshtastic manifest JSON + Checksums", - always_build=False, -) +if should_skip_manifest: + def skip_manifest(source, target, env): + print(f"mtjson: skipped for native environment: {env.get('PIOENV')}") + + env.AddCustomTarget( + name="mtjson", + dependencies=mtjson_deps, + actions=[skip_manifest], + title="Meshtastic Manifest (skipped)", + description="mtjson generation is skipped for native environments", + always_build=True, + ) +else: + env.AddCustomTarget( + name="mtjson", + dependencies=mtjson_deps, + actions=[manifest_gather], + title="Meshtastic Manifest", + description="Generating Meshtastic manifest JSON + Checksums", + always_build=True, + ) + + # Run manifest generation as part of the default build pipeline for non-native builds. + env.Default("mtjson") diff --git a/bin/readprops.py b/bin/readprops.py index 731a3d0d3..4b92d63dd 100644 --- a/bin/readprops.py +++ b/bin/readprops.py @@ -18,8 +18,9 @@ def readProps(prefsLoc): # Try to find current build SHA if if the workspace is clean. This could fail if git is not installed try: + # Pin abbreviation length to keep local builds and CI matching (avoid auto-shortening) sha = ( - subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) + subprocess.check_output(["git", "rev-parse", "--short=7", "HEAD"]) .decode("utf-8") .strip() ) diff --git a/boards/t-beam-1w.json b/boards/t-beam-1w.json new file mode 100644 index 000000000..ac1d1f15e --- /dev/null +++ b/boards/t-beam-1w.json @@ -0,0 +1,50 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DLILYGO_TBEAM_1W", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_USB_MODE=0", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "opi", + "hwids": [ + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "t-beam-1w" + }, + "connectivity": [ + "wifi", + "bluetooth", + "lora" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino" + ], + "name": "LilyGo TBeam-1W", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 921600 + }, + "url": "http://www.lilygo.cn/", + "vendor": "LilyGo" +} \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index b9212c1be..5f25d53ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +meshtasticd (2.7.18.0) unstable; urgency=medium + + * Version 2.7.18 + + -- GitHub Actions Fri, 02 Jan 2026 12:45:36 +0000 + meshtasticd (2.7.17.0) unstable; urgency=medium * Version 2.7.17 diff --git a/platformio.ini b/platformio.ini index 2b52ce3a5..11ef72b21 100644 --- a/platformio.ini +++ b/platformio.ini @@ -119,7 +119,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/862ed040c4ab44f0dfbbe492691f144886102588.zip + https://github.com/meshtastic/device-ui/archive/a8e2f947f7abaf0c5ac8e6dd189a22156335beaa.zip ; Common libs for environmental measurements in telemetry module [environmental_base] diff --git a/src/buzz/BuzzerFeedbackThread.cpp b/src/buzz/BuzzerFeedbackThread.cpp index 7de6c0740..0716dedd0 100644 --- a/src/buzz/BuzzerFeedbackThread.cpp +++ b/src/buzz/BuzzerFeedbackThread.cpp @@ -24,6 +24,9 @@ int BuzzerFeedbackThread::handleInputEvent(const InputEvent *event) switch (event->inputEvent) { case INPUT_BROKER_USER_PRESS: case INPUT_BROKER_ALT_PRESS: + playClick(); // Low delay feedback + break; + case INPUT_BROKER_SELECT: case INPUT_BROKER_SELECT_LONG: playBeep(); // Confirmation feedback @@ -58,4 +61,4 @@ int BuzzerFeedbackThread::handleInputEvent(const InputEvent *event) } return 0; // Allow other handlers to process the event -} \ No newline at end of file +} diff --git a/src/buzz/buzz.cpp b/src/buzz/buzz.cpp index aa8346585..00ad71031 100644 --- a/src/buzz/buzz.cpp +++ b/src/buzz/buzz.cpp @@ -113,7 +113,14 @@ void playShutdownMelody() void playChirp() { // A short, friendly "chirp" sound for key presses - ToneDuration melody[] = {{NOTE_AS3, 20}}; // Very short AS3 note + ToneDuration melody[] = {{NOTE_AS3, 20}}; // Short AS3 note + playTones(melody, sizeof(melody) / sizeof(ToneDuration)); +} + +void playClick() +{ + // A very short "click" sound with minimum delay; ideal for rotary encoder events + ToneDuration melody[] = {{NOTE_AS3, 1}}; // Very Short AS3 playTones(melody, sizeof(melody) / sizeof(ToneDuration)); } diff --git a/src/buzz/buzz.h b/src/buzz/buzz.h index c25a54a5b..fa0c8c496 100644 --- a/src/buzz/buzz.h +++ b/src/buzz/buzz.h @@ -9,6 +9,7 @@ void playGPSDisableBeep(); void playComboTune(); void playBoop(); void playChirp(); +void playClick(); void playLongPressLeadUp(); bool playNextLeadUpNote(); // Play the next note in the lead-up sequence void resetLeadUpSequence(); // Reset the lead-up sequence to start from beginning \ No newline at end of file diff --git a/src/configuration.h b/src/configuration.h index 650e1cc71..ec1b9acc2 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -444,6 +444,18 @@ along with this program. If not, see . #endif #endif +// BME680 BSEC2 support detection +#if !defined(MESHTASTIC_BME680_BSEC2_SUPPORTED) +#if defined(RAK_4631) || defined(TBEAM_V10) + +#define MESHTASTIC_BME680_BSEC2_SUPPORTED 1 +#define MESHTASTIC_BME680_HEADER +#else +#define MESHTASTIC_BME680_BSEC2_SUPPORTED 0 +#define MESHTASTIC_BME680_HEADER +#endif // defined(RAK_4631) +#endif // !defined(MESHTASTIC_BME680_BSEC2_SUPPORTED) + // ----------------------------------------------------------------------------- // Global switches to turn off features for a minimized build // ----------------------------------------------------------------------------- diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index 7eafcdb46..138995ebe 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -107,50 +107,60 @@ void menuHandler::OnboardMessage() void menuHandler::LoraRegionPicker(uint32_t duration) { - static const char *optionsArray[] = {"Back", - "US", - "EU_433", - "EU_868", - "CN", - "JP", - "ANZ", - "KR", - "TW", - "RU", - "IN", - "NZ_865", - "TH", - "LORA_24", - "UA_433", - "UA_868", - "MY_433", - "MY_" - "919", - "SG_" - "923", - "PH_433", - "PH_868", - "PH_915", - "ANZ_433", - "KZ_433", - "KZ_863", - "NP_865", - "BR_902"}; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "Set the LoRa region"; + static const LoraRegionOption regionOptions[] = { + {"Back", OptionsAction::Back}, + {"US", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_US}, + {"EU_433", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_EU_433}, + {"EU_868", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_EU_868}, + {"CN", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_CN}, + {"JP", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_JP}, + {"ANZ", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ANZ}, + {"KR", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_KR}, + {"TW", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_TW}, + {"RU", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_RU}, + {"IN", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_IN}, + {"NZ_865", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_NZ_865}, + {"TH", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_TH}, + {"LORA_24", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_LORA_24}, + {"UA_433", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_UA_433}, + {"UA_868", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_UA_868}, + {"MY_433", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_MY_433}, + {"MY_919", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_MY_919}, + {"SG_923", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_SG_923}, + {"PH_433", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_PH_433}, + {"PH_868", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_PH_868}, + {"PH_915", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_PH_915}, + {"ANZ_433", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_ANZ_433}, + {"KZ_433", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_KZ_433}, + {"KZ_863", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_KZ_863}, + {"NP_865", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_NP_865}, + {"BR_902", OptionsAction::Select, meshtastic_Config_LoRaConfig_RegionCode_BR_902}, + }; + + constexpr size_t regionCount = sizeof(regionOptions) / sizeof(regionOptions[0]); + static std::array regionLabels{}; + + const char *bannerMessage = "Set the LoRa region"; if (currentResolution == ScreenResolution::UltraLow) { - bannerOptions.message = "LoRa Region"; + bannerMessage = "LoRa Region"; } - bannerOptions.durationMs = duration; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 27; - bannerOptions.InitialSelected = 0; - bannerOptions.bannerCallback = [](int selected) -> void { - if (selected != 0 && config.lora.region != _meshtastic_Config_LoRaConfig_RegionCode(selected)) { - config.lora.region = _meshtastic_Config_LoRaConfig_RegionCode(selected); + + auto bannerOptions = + createStaticBannerOptions(bannerMessage, regionOptions, regionLabels, [](const LoraRegionOption &option, int) -> void { + if (!option.hasValue) { + return; + } + + auto selectedRegion = option.value; + if (config.lora.region == selectedRegion) { + return; + } + + config.lora.region = selectedRegion; auto changes = SEGMENT_CONFIG; - // This is needed as we wait til picking the LoRa region to generate keys for the first time. + // FIXME: This should be a method consolidated with the same logic in the admin message as well + // This is needed as we wait til picking the LoRa region to generate keys for the first time. #if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN || MESHTASTIC_EXCLUDE_PKI) if (!owner.is_licensed) { bool keygenSuccess = false; @@ -187,8 +197,19 @@ void menuHandler::LoraRegionPicker(uint32_t duration) service->reloadConfig(changes); rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000); + }); + + bannerOptions.durationMs = duration; + + int initialSelection = 0; + for (size_t i = 0; i < regionCount; ++i) { + if (regionOptions[i].hasValue && regionOptions[i].value == config.lora.region) { + initialSelection = static_cast(i); + break; } - }; + } + bannerOptions.InitialSelected = initialSelection; + screen->showOverlayBanner(bannerOptions); } @@ -303,102 +324,100 @@ void menuHandler::showConfirmationBanner(const char *message, std::function void { - if (selected == Back) { - menuHandler::menuQueue = menuHandler::clock_menu; - screen->runNow(); - } else if (selected == Digital) { - uiconfig.is_clockface_analog = false; - saveUIConfig(); - screen->setFrames(Screen::FOCUS_CLOCK); - } else { - uiconfig.is_clockface_analog = true; - saveUIConfig(); - screen->setFrames(Screen::FOCUS_CLOCK); - } + static const ClockFaceOption clockFaceOptions[] = { + {"Back", OptionsAction::Back}, + {"Digital", OptionsAction::Select, false}, + {"Analog", OptionsAction::Select, true}, }; + + constexpr size_t clockFaceCount = sizeof(clockFaceOptions) / sizeof(clockFaceOptions[0]); + static std::array clockFaceLabels{}; + + auto bannerOptions = createStaticBannerOptions("Which Face?", clockFaceOptions, clockFaceLabels, + [](const ClockFaceOption &option, int) -> void { + if (option.action == OptionsAction::Back) { + menuHandler::menuQueue = menuHandler::clock_menu; + screen->runNow(); + return; + } + + if (!option.hasValue) { + return; + } + + if (uiconfig.is_clockface_analog == option.value) { + return; + } + + uiconfig.is_clockface_analog = option.value; + saveUIConfig(); + screen->setFrames(Screen::FOCUS_CLOCK); + }); + bannerOptions.InitialSelected = uiconfig.is_clockface_analog ? 2 : 1; screen->showOverlayBanner(bannerOptions); } void menuHandler::TZPicker() { - static const char *optionsArray[] = {"Back", - "US/Hawaii", - "US/Alaska", - "US/Pacific", - "US/Arizona", - "US/Mountain", - "US/Central", - "US/Eastern", - "BR/Brasilia", - "UTC", - "EU/Western", - "EU/" - "Central", - "EU/Eastern", - "Asia/Kolkata", - "Asia/Hong_Kong", - "AU/AWST", - "AU/ACST", - "AU/AEST", - "Pacific/NZ"}; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "Pick Timezone"; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 19; - bannerOptions.bannerCallback = [](int selected) -> void { - if (selected == 0) { - menuHandler::menuQueue = menuHandler::clock_menu; - screen->runNow(); - } else if (selected == 1) { // Hawaii - strncpy(config.device.tzdef, "HST10", sizeof(config.device.tzdef)); - } else if (selected == 2) { // Alaska - strncpy(config.device.tzdef, "AKST9AKDT,M3.2.0,M11.1.0", sizeof(config.device.tzdef)); - } else if (selected == 3) { // Pacific - strncpy(config.device.tzdef, "PST8PDT,M3.2.0,M11.1.0", sizeof(config.device.tzdef)); - } else if (selected == 4) { // Arizona - strncpy(config.device.tzdef, "MST7", sizeof(config.device.tzdef)); - } else if (selected == 5) { // Mountain - strncpy(config.device.tzdef, "MST7MDT,M3.2.0,M11.1.0", sizeof(config.device.tzdef)); - } else if (selected == 6) { // Central - strncpy(config.device.tzdef, "CST6CDT,M3.2.0,M11.1.0", sizeof(config.device.tzdef)); - } else if (selected == 7) { // Eastern - strncpy(config.device.tzdef, "EST5EDT,M3.2.0,M11.1.0", sizeof(config.device.tzdef)); - } else if (selected == 8) { // Brazil - strncpy(config.device.tzdef, "BRT3", sizeof(config.device.tzdef)); - } else if (selected == 9) { // UTC - strncpy(config.device.tzdef, "UTC0", sizeof(config.device.tzdef)); - } else if (selected == 10) { // EU/Western - strncpy(config.device.tzdef, "GMT0BST,M3.5.0/1,M10.5.0", sizeof(config.device.tzdef)); - } else if (selected == 11) { // EU/Central - strncpy(config.device.tzdef, "CET-1CEST,M3.5.0,M10.5.0/3", sizeof(config.device.tzdef)); - } else if (selected == 12) { // EU/Eastern - strncpy(config.device.tzdef, "EET-2EEST,M3.5.0/3,M10.5.0/4", sizeof(config.device.tzdef)); - } else if (selected == 13) { // Asia/Kolkata - strncpy(config.device.tzdef, "IST-5:30", sizeof(config.device.tzdef)); - } else if (selected == 14) { // China - strncpy(config.device.tzdef, "HKT-8", sizeof(config.device.tzdef)); - } else if (selected == 15) { // AU/AWST - strncpy(config.device.tzdef, "AWST-8", sizeof(config.device.tzdef)); - } else if (selected == 16) { // AU/ACST - strncpy(config.device.tzdef, "ACST-9:30ACDT,M10.1.0,M4.1.0/3", sizeof(config.device.tzdef)); - } else if (selected == 17) { // AU/AEST - strncpy(config.device.tzdef, "AEST-10AEDT,M10.1.0,M4.1.0/3", sizeof(config.device.tzdef)); - } else if (selected == 18) { // NZ - strncpy(config.device.tzdef, "NZST-12NZDT,M9.5.0,M4.1.0/3", sizeof(config.device.tzdef)); - } - if (selected != 0) { + static const TimezoneOption timezoneOptions[] = { + {"Back", OptionsAction::Back}, + {"US/Hawaii", OptionsAction::Select, "HST10"}, + {"US/Alaska", OptionsAction::Select, "AKST9AKDT,M3.2.0,M11.1.0"}, + {"US/Pacific", OptionsAction::Select, "PST8PDT,M3.2.0,M11.1.0"}, + {"US/Arizona", OptionsAction::Select, "MST7"}, + {"US/Mountain", OptionsAction::Select, "MST7MDT,M3.2.0,M11.1.0"}, + {"US/Central", OptionsAction::Select, "CST6CDT,M3.2.0,M11.1.0"}, + {"US/Eastern", OptionsAction::Select, "EST5EDT,M3.2.0,M11.1.0"}, + {"BR/Brasilia", OptionsAction::Select, "BRT3"}, + {"UTC", OptionsAction::Select, "UTC0"}, + {"EU/Western", OptionsAction::Select, "GMT0BST,M3.5.0/1,M10.5.0"}, + {"EU/Central", OptionsAction::Select, "CET-1CEST,M3.5.0,M10.5.0/3"}, + {"EU/Eastern", OptionsAction::Select, "EET-2EEST,M3.5.0/3,M10.5.0/4"}, + {"Asia/Kolkata", OptionsAction::Select, "IST-5:30"}, + {"Asia/Hong_Kong", OptionsAction::Select, "HKT-8"}, + {"AU/AWST", OptionsAction::Select, "AWST-8"}, + {"AU/ACST", OptionsAction::Select, "ACST-9:30ACDT,M10.1.0,M4.1.0/3"}, + {"AU/AEST", OptionsAction::Select, "AEST-10AEDT,M10.1.0,M4.1.0/3"}, + {"Pacific/NZ", OptionsAction::Select, "NZST-12NZDT,M9.5.0,M4.1.0/3"}, + }; + + constexpr size_t timezoneCount = sizeof(timezoneOptions) / sizeof(timezoneOptions[0]); + static std::array timezoneLabels{}; + + auto bannerOptions = createStaticBannerOptions( + "Pick Timezone", timezoneOptions, timezoneLabels, [](const TimezoneOption &option, int) -> void { + if (option.action == OptionsAction::Back) { + menuHandler::menuQueue = menuHandler::clock_menu; + screen->runNow(); + return; + } + + if (!option.hasValue) { + return; + } + + if (strncmp(config.device.tzdef, option.value, sizeof(config.device.tzdef)) == 0) { + return; + } + + strncpy(config.device.tzdef, option.value, sizeof(config.device.tzdef)); + config.device.tzdef[sizeof(config.device.tzdef) - 1] = '\0'; + setenv("TZ", config.device.tzdef, 1); service->reloadConfig(SEGMENT_CONFIG); + }); + + int initialSelection = 0; + for (size_t i = 0; i < timezoneCount; ++i) { + if (timezoneOptions[i].hasValue && + strncmp(config.device.tzdef, timezoneOptions[i].value, sizeof(config.device.tzdef)) == 0) { + initialSelection = static_cast(i); + break; } - }; + } + bannerOptions.InitialSelected = initialSelection; + screen->showOverlayBanner(bannerOptions); } @@ -430,13 +449,14 @@ void menuHandler::clockMenu() } void menuHandler::messageResponseMenu() { - enum optionsNumbers { Back = 0, ViewMode, DeleteAll, DeleteOldest, ReplyMenu, Aloud, enumEnd }; + enum optionsNumbers { Back = 0, ViewMode, DeleteAll, DeleteOldest, ReplyMenu, MuteChannel, Aloud, enumEnd }; static const char *optionsArray[enumEnd]; static int optionsEnumArray[enumEnd]; int options = 0; auto mode = graphics::MessageRenderer::getThreadMode(); + int threadChannel = graphics::MessageRenderer::getThreadChannel(); optionsArray[options] = "Back"; optionsEnumArray[options++] = Back; @@ -448,6 +468,15 @@ void menuHandler::messageResponseMenu() optionsArray[options] = "View Chats"; optionsEnumArray[options++] = ViewMode; + // If viewing ALL chats, hide “Mute Chat” + if (mode != graphics::MessageRenderer::ThreadMode::ALL && mode != graphics::MessageRenderer::ThreadMode::DIRECT) { + const uint8_t chIndex = (threadChannel != 0) ? (uint8_t)threadChannel : channels.getPrimaryIndex(); + auto &chan = channels.getByIndex(chIndex); + + optionsArray[options] = chan.settings.module_settings.is_muted ? "Unmute Channel" : "Mute Channel"; + optionsEnumArray[options++] = MuteChannel; + } + // Delete submenu optionsArray[options] = "Delete"; optionsEnumArray[options++] = 900; @@ -458,10 +487,9 @@ void menuHandler::messageResponseMenu() #endif BannerOverlayOptions bannerOptions; + bannerOptions.message = "Message Action"; if (currentResolution == ScreenResolution::UltraLow) { bannerOptions.message = "Message"; - } else { - bannerOptions.message = "Message Action"; } bannerOptions.optionsArrayPtr = optionsArray; bannerOptions.optionsEnumPtr = optionsEnumArray; @@ -484,6 +512,14 @@ void menuHandler::messageResponseMenu() menuHandler::menuQueue = menuHandler::reply_menu; screen->runNow(); + } else if (selected == MuteChannel) { + const uint8_t chIndex = (ch != 0) ? (uint8_t)ch : channels.getPrimaryIndex(); + auto &chan = channels.getByIndex(chIndex); + if (chan.settings.has_module_settings) { + chan.settings.module_settings.is_muted = !chan.settings.module_settings.is_muted; + nodeDB->saveToDisk(); + } + // Delete submenu } else if (selected == 900) { menuHandler::menuQueue = menuHandler::delete_messages_menu; @@ -910,8 +946,12 @@ void menuHandler::homeBaseMenu() } else if (selected == Sleep) { screen->setOn(false); } else if (selected == Position) { - InputEvent event = {.inputEvent = (input_broker_event)INPUT_BROKER_SEND_PING, .kbchar = 0, .touchX = 0, .touchY = 0}; - inputBroker->injectInputEvent(&event); + service->refreshLocalMeshNode(); + if (service->trySendPosition(NODENUM_BROADCAST, true)) { + IF_SCREEN(screen->showSimpleBanner("Position\nSent", 3000)); + } else { + IF_SCREEN(screen->showSimpleBanner("Node Info\nSent", 3000)); + } } else if (selected == Preset) { cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST); } else if (selected == Freetext) { @@ -1108,57 +1148,92 @@ void menuHandler::favoriteBaseMenu() void menuHandler::positionBaseMenu() { - enum optionsNumbers { - Back, - GPSToggle, - GPSFormat, + enum class PositionAction { + GpsToggle, + GpsFormat, CompassMenu, CompassCalibrate, GPSSmartPosition, GPSUpdateInterval, - GPSPositionBroadcast, - enumEnd + GPSPositionBroadcast }; - static const char *optionsArray[enumEnd] = { - "Back", "On/Off Toggle", "Format", "Smart Position", "Update Interval", "Broadcast Interval", "Compass"}; - static int optionsEnumArray[enumEnd] = { - Back, GPSToggle, GPSFormat, GPSSmartPosition, GPSUpdateInterval, GPSPositionBroadcast, CompassMenu}; - int options = 7; + static const PositionMenuOption baseOptions[] = { + {"Back", OptionsAction::Back}, + {"On/Off Toggle", OptionsAction::Select, static_cast(PositionAction::GpsToggle)}, + {"Format", OptionsAction::Select, static_cast(PositionAction::GpsFormat)}, + {"Smart Position", OptionsAction::Select, static_cast(PositionAction::GPSSmartPosition)}, + {"Update Interval", OptionsAction::Select, static_cast(PositionAction::GPSUpdateInterval)}, + {"Broadcast Interval", OptionsAction::Select, static_cast(PositionAction::GPSPositionBroadcast)}, + {"Compass", OptionsAction::Select, static_cast(PositionAction::CompassMenu)}, + }; - if (accelerometerThread) { - optionsArray[options] = "Compass Calibrate"; - optionsEnumArray[options++] = CompassCalibrate; - } + static const PositionMenuOption calibrateOptions[] = { + {"Back", OptionsAction::Back}, + {"On/Off Toggle", OptionsAction::Select, static_cast(PositionAction::GpsToggle)}, + {"Format", OptionsAction::Select, static_cast(PositionAction::GpsFormat)}, + {"Smart Position", OptionsAction::Select, static_cast(PositionAction::GPSSmartPosition)}, + {"Update Interval", OptionsAction::Select, static_cast(PositionAction::GPSUpdateInterval)}, + {"Broadcast Interval", OptionsAction::Select, static_cast(PositionAction::GPSPositionBroadcast)}, + {"Compass", OptionsAction::Select, static_cast(PositionAction::CompassMenu)}, + {"Compass Calibrate", OptionsAction::Select, static_cast(PositionAction::CompassCalibrate)}, + }; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "GPS Action"; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsEnumPtr = optionsEnumArray; - bannerOptions.optionsCount = options; - bannerOptions.bannerCallback = [](int selected) -> void { - if (selected == GPSToggle) { + constexpr size_t baseCount = sizeof(baseOptions) / sizeof(baseOptions[0]); + constexpr size_t calibrateCount = sizeof(calibrateOptions) / sizeof(calibrateOptions[0]); + static std::array baseLabels{}; + static std::array calibrateLabels{}; + + auto onSelection = [](const PositionMenuOption &option, int) -> void { + if (option.action == OptionsAction::Back) { + return; + } + + if (!option.hasValue) { + return; + } + + auto action = static_cast(option.value); + switch (action) { + case PositionAction::GpsToggle: menuQueue = gps_toggle_menu; screen->runNow(); - } else if (selected == GPSFormat) { + break; + case PositionAction::GpsFormat: menuQueue = gps_format_menu; screen->runNow(); - } else if (selected == CompassMenu) { + break; + case PositionAction::CompassMenu: menuQueue = compass_point_north_menu; screen->runNow(); - } else if (selected == CompassCalibrate) { - accelerometerThread->calibrate(30); - } else if (selected == GPSSmartPosition) { + break; + case PositionAction::CompassCalibrate: + if (accelerometerThread) { + accelerometerThread->calibrate(30); + } + break; + case PositionAction::GPSSmartPosition: menuQueue = gps_smart_position_menu; screen->runNow(); - } else if (selected == GPSUpdateInterval) { + break; + case PositionAction::GPSUpdateInterval: menuQueue = gps_update_interval_menu; screen->runNow(); - } else if (selected == GPSPositionBroadcast) { + break; + case PositionAction::GPSPositionBroadcast: menuQueue = gps_position_broadcast_menu; screen->runNow(); + break; } }; + + BannerOverlayOptions bannerOptions; + if (accelerometerThread) { + bannerOptions = createStaticBannerOptions("GPS Action", calibrateOptions, calibrateLabels, onSelection); + } else { + bannerOptions = createStaticBannerOptions("GPS Action", baseOptions, baseLabels, onSelection); + } + screen->showOverlayBanner(bannerOptions); } @@ -1214,27 +1289,38 @@ void menuHandler::nodeListMenu() void menuHandler::nodeNameLengthMenu() { - enum OptionsNumbers { Back, Long, Short }; - static const char *optionsArray[] = {"Back", "Long", "Short"}; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "Node Name Length"; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 3; - bannerOptions.bannerCallback = [](int selected) -> void { - if (selected == Long) { - // Set names to long - LOG_INFO("Setting names to long"); - config.display.use_long_node_name = true; - } else if (selected == Short) { - // Set names to short - LOG_INFO("Setting names to short"); - config.display.use_long_node_name = false; - } else if (selected == Back) { - menuQueue = node_base_menu; - screen->runNow(); - } + static const NodeNameOption nodeNameOptions[] = { + {"Back", OptionsAction::Back}, + {"Long", OptionsAction::Select, true}, + {"Short", OptionsAction::Select, false}, }; - bannerOptions.InitialSelected = config.display.use_long_node_name == true ? 1 : 2; + + constexpr size_t nodeNameCount = sizeof(nodeNameOptions) / sizeof(nodeNameOptions[0]); + static std::array nodeNameLabels{}; + + auto bannerOptions = createStaticBannerOptions("Node Name Length", nodeNameOptions, nodeNameLabels, + [](const NodeNameOption &option, int) -> void { + if (option.action == OptionsAction::Back) { + menuQueue = node_base_menu; + screen->runNow(); + return; + } + + if (!option.hasValue) { + return; + } + + if (config.display.use_long_node_name == option.value) { + return; + } + + config.display.use_long_node_name = option.value; + LOG_INFO("Setting names to %s", option.value ? "long" : "short"); + }); + + int initialSelection = config.display.use_long_node_name ? 1 : 2; + bannerOptions.InitialSelected = initialSelection; + screen->showOverlayBanner(bannerOptions); } @@ -1268,119 +1354,169 @@ void menuHandler::resetNodeDBMenu() void menuHandler::compassNorthMenu() { - enum optionsNumbers { Back, Dynamic, Fixed, Freeze }; - static const char *optionsArray[] = {"Back", "Dynamic", "Fixed Ring", "Freeze Heading"}; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "North Directions?"; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 4; - bannerOptions.InitialSelected = uiconfig.compass_mode + 1; - bannerOptions.bannerCallback = [](int selected) -> void { - if (selected == Dynamic) { - if (uiconfig.compass_mode != meshtastic_CompassMode_DYNAMIC) { - uiconfig.compass_mode = meshtastic_CompassMode_DYNAMIC; - saveUIConfig(); - screen->setFrames(graphics::Screen::FOCUS_PRESERVE); - } - } else if (selected == Fixed) { - if (uiconfig.compass_mode != meshtastic_CompassMode_FIXED_RING) { - uiconfig.compass_mode = meshtastic_CompassMode_FIXED_RING; - saveUIConfig(); - screen->setFrames(graphics::Screen::FOCUS_PRESERVE); - } - } else if (selected == Freeze) { - if (uiconfig.compass_mode != meshtastic_CompassMode_FREEZE_HEADING) { - uiconfig.compass_mode = meshtastic_CompassMode_FREEZE_HEADING; - saveUIConfig(); - screen->setFrames(graphics::Screen::FOCUS_PRESERVE); - } - } else if (selected == Back) { - menuQueue = position_base_menu; - screen->runNow(); - } + static const CompassOption compassOptions[] = { + {"Back", OptionsAction::Back}, + {"Dynamic", OptionsAction::Select, meshtastic_CompassMode_DYNAMIC}, + {"Fixed Ring", OptionsAction::Select, meshtastic_CompassMode_FIXED_RING}, + {"Freeze Heading", OptionsAction::Select, meshtastic_CompassMode_FREEZE_HEADING}, }; + + constexpr size_t compassCount = sizeof(compassOptions) / sizeof(compassOptions[0]); + static std::array compassLabels{}; + + auto bannerOptions = createStaticBannerOptions("North Directions?", compassOptions, compassLabels, + [](const CompassOption &option, int) -> void { + if (option.action == OptionsAction::Back) { + menuQueue = position_base_menu; + screen->runNow(); + return; + } + + if (!option.hasValue) { + return; + } + + if (uiconfig.compass_mode == option.value) { + return; + } + + uiconfig.compass_mode = option.value; + saveUIConfig(); + screen->setFrames(graphics::Screen::FOCUS_PRESERVE); + }); + + int initialSelection = 0; + for (size_t i = 0; i < compassCount; ++i) { + if (compassOptions[i].hasValue && uiconfig.compass_mode == compassOptions[i].value) { + initialSelection = static_cast(i); + break; + } + } + bannerOptions.InitialSelected = initialSelection; + screen->showOverlayBanner(bannerOptions); } #if !MESHTASTIC_EXCLUDE_GPS void menuHandler::GPSToggleMenu() { - - static const char *optionsArray[] = {"Back", "Enabled", "Disabled"}; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "Toggle GPS"; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 3; - bannerOptions.bannerCallback = [](int selected) -> void { - if (selected == 1) { - config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_ENABLED; - playGPSEnableBeep(); - gps->enable(); - service->reloadConfig(SEGMENT_CONFIG); - } else if (selected == 2) { - config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_DISABLED; - playGPSDisableBeep(); - gps->disable(); - service->reloadConfig(SEGMENT_CONFIG); - } else { - menuQueue = position_base_menu; - screen->runNow(); - } + static const GPSToggleOption gpsToggleOptions[] = { + {"Back", OptionsAction::Back}, + {"Enabled", OptionsAction::Select, meshtastic_Config_PositionConfig_GpsMode_ENABLED}, + {"Disabled", OptionsAction::Select, meshtastic_Config_PositionConfig_GpsMode_DISABLED}, }; - bannerOptions.InitialSelected = config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED ? 1 : 2; + + constexpr size_t toggleCount = sizeof(gpsToggleOptions) / sizeof(gpsToggleOptions[0]); + static std::array toggleLabels{}; + + auto bannerOptions = + createStaticBannerOptions("Toggle GPS", gpsToggleOptions, toggleLabels, [](const GPSToggleOption &option, int) -> void { + if (option.action == OptionsAction::Back) { + menuQueue = position_base_menu; + screen->runNow(); + return; + } + + if (!option.hasValue) { + return; + } + + if (config.position.gps_mode == option.value) { + return; + } + + config.position.gps_mode = option.value; + if (option.value == meshtastic_Config_PositionConfig_GpsMode_ENABLED) { + playGPSEnableBeep(); + gps->enable(); + } else { + playGPSDisableBeep(); + gps->disable(); + } + service->reloadConfig(SEGMENT_CONFIG); + }); + + int initialSelection = 0; + for (size_t i = 0; i < toggleCount; ++i) { + if (gpsToggleOptions[i].hasValue && config.position.gps_mode == gpsToggleOptions[i].value) { + initialSelection = static_cast(i); + break; + } + } + bannerOptions.InitialSelected = initialSelection; + screen->showOverlayBanner(bannerOptions); } void menuHandler::GPSFormatMenu() { + static const GPSFormatOption formatOptionsHigh[] = { + {"Back", OptionsAction::Back}, + {"Decimal Degrees", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_DEC}, + {"Degrees Minutes Seconds", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_DMS}, + {"Universal Transverse Mercator", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_UTM}, + {"Military Grid Reference System", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_MGRS}, + {"Open Location Code", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_OLC}, + {"Ordnance Survey Grid Ref", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_OSGR}, + {"Maidenhead Locator", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_MLS}, + }; - static const char *optionsArray[] = {"Back", - (currentResolution == ScreenResolution::High) ? "Decimal Degrees" : "DEC", - (currentResolution == ScreenResolution::High) ? "Degrees Minutes Seconds" : "DMS", - (currentResolution == ScreenResolution::High) ? "Universal Transverse Mercator" : "UTM", - (currentResolution == ScreenResolution::High) ? "Military Grid Reference System" - : "MGRS", - (currentResolution == ScreenResolution::High) ? "Open Location Code" : "OLC", - (currentResolution == ScreenResolution::High) ? "Ordnance Survey Grid Ref" : "OSGR", - (currentResolution == ScreenResolution::High) ? "Maidenhead Locator" : "MLS"}; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "GPS Format"; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 8; - bannerOptions.bannerCallback = [](int selected) -> void { - if (selected == 1) { - uiconfig.gps_format = meshtastic_DeviceUIConfig_GpsCoordinateFormat_DEC; - saveUIConfig(); - service->reloadConfig(SEGMENT_CONFIG); - } else if (selected == 2) { - uiconfig.gps_format = meshtastic_DeviceUIConfig_GpsCoordinateFormat_DMS; - saveUIConfig(); - service->reloadConfig(SEGMENT_CONFIG); - } else if (selected == 3) { - uiconfig.gps_format = meshtastic_DeviceUIConfig_GpsCoordinateFormat_UTM; - saveUIConfig(); - service->reloadConfig(SEGMENT_CONFIG); - } else if (selected == 4) { - uiconfig.gps_format = meshtastic_DeviceUIConfig_GpsCoordinateFormat_MGRS; - saveUIConfig(); - service->reloadConfig(SEGMENT_CONFIG); - } else if (selected == 5) { - uiconfig.gps_format = meshtastic_DeviceUIConfig_GpsCoordinateFormat_OLC; - saveUIConfig(); - service->reloadConfig(SEGMENT_CONFIG); - } else if (selected == 6) { - uiconfig.gps_format = meshtastic_DeviceUIConfig_GpsCoordinateFormat_OSGR; - saveUIConfig(); - service->reloadConfig(SEGMENT_CONFIG); - } else if (selected == 7) { - uiconfig.gps_format = meshtastic_DeviceUIConfig_GpsCoordinateFormat_MLS; - saveUIConfig(); - service->reloadConfig(SEGMENT_CONFIG); - } else { + static const GPSFormatOption formatOptionsLow[] = { + {"Back", OptionsAction::Back}, + {"DEC", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_DEC}, + {"DMS", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_DMS}, + {"UTM", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_UTM}, + {"MGRS", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_MGRS}, + {"OLC", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_OLC}, + {"OSGR", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_OSGR}, + {"MLS", OptionsAction::Select, meshtastic_DeviceUIConfig_GpsCoordinateFormat_MLS}, + }; + + constexpr size_t formatCount = sizeof(formatOptionsHigh) / sizeof(formatOptionsHigh[0]); + static std::array formatLabelsHigh{}; + static std::array formatLabelsLow{}; + + auto onSelection = [](const GPSFormatOption &option, int) -> void { + if (option.action == OptionsAction::Back) { menuQueue = position_base_menu; screen->runNow(); + return; } + + if (!option.hasValue) { + return; + } + + if (uiconfig.gps_format == option.value) { + return; + } + + uiconfig.gps_format = option.value; + saveUIConfig(); + service->reloadConfig(SEGMENT_CONFIG); }; - bannerOptions.InitialSelected = uiconfig.gps_format + 1; + + BannerOverlayOptions bannerOptions; + int initialSelection = 0; + + if (currentResolution == ScreenResolution::High) { + bannerOptions = createStaticBannerOptions("GPS Format", formatOptionsHigh, formatLabelsHigh, onSelection); + for (size_t i = 0; i < formatCount; ++i) { + if (formatOptionsHigh[i].hasValue && uiconfig.gps_format == formatOptionsHigh[i].value) { + initialSelection = static_cast(i); + break; + } + } + } else { + bannerOptions = createStaticBannerOptions("GPS Format", formatOptionsLow, formatLabelsLow, onSelection); + for (size_t i = 0; i < formatCount; ++i) { + if (formatOptionsLow[i].hasValue && uiconfig.gps_format == formatOptionsLow[i].value) { + initialSelection = static_cast(i); + break; + } + } + } + + bannerOptions.InitialSelected = initialSelection; screen->showOverlayBanner(bannerOptions); } @@ -1701,100 +1837,63 @@ void menuHandler::switchToMUIMenu() void menuHandler::TFTColorPickerMenu(OLEDDisplay *display) { - static const char *optionsArray[] = { - "Back", "Default", "Meshtastic Green", "Yellow", "Red", "Orange", "Purple", "Blue", "Teal", "Cyan", "Ice", "Pink", - "White", "Gray"}; - BannerOverlayOptions bannerOptions; - bannerOptions.message = "Select Screen Color"; - bannerOptions.optionsArrayPtr = optionsArray; - bannerOptions.optionsCount = 14; - bannerOptions.bannerCallback = [display](int selected) -> void { + static const ScreenColorOption colorOptions[] = { + {"Back", OptionsAction::Back}, + {"Default", OptionsAction::Select, ScreenColor(0, 0, 0, true)}, + {"Meshtastic Green", OptionsAction::Select, ScreenColor(103, 234, 148)}, + {"Yellow", OptionsAction::Select, ScreenColor(255, 255, 128)}, + {"Red", OptionsAction::Select, ScreenColor(255, 64, 64)}, + {"Orange", OptionsAction::Select, ScreenColor(255, 160, 20)}, + {"Purple", OptionsAction::Select, ScreenColor(204, 153, 255)}, + {"Blue", OptionsAction::Select, ScreenColor(0, 0, 255)}, + {"Teal", OptionsAction::Select, ScreenColor(16, 102, 102)}, + {"Cyan", OptionsAction::Select, ScreenColor(0, 255, 255)}, + {"Ice", OptionsAction::Select, ScreenColor(173, 216, 230)}, + {"Pink", OptionsAction::Select, ScreenColor(255, 105, 180)}, + {"White", OptionsAction::Select, ScreenColor(255, 255, 255)}, + {"Gray", OptionsAction::Select, ScreenColor(128, 128, 128)}, + }; + + constexpr size_t colorCount = sizeof(colorOptions) / sizeof(colorOptions[0]); + static std::array colorLabels{}; + + auto bannerOptions = createStaticBannerOptions( + "Select Screen Color", colorOptions, colorLabels, [display](const ScreenColorOption &option, int) -> void { + if (option.action == OptionsAction::Back) { + menuQueue = system_base_menu; + screen->runNow(); + return; + } + + if (!option.hasValue) { + return; + } + #if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) || defined(T_DECK) || defined(T_LORA_PAGER) || \ HAS_TFT || defined(HACKADAY_COMMUNICATOR) - uint8_t TFT_MESH_r = 0; - uint8_t TFT_MESH_g = 0; - uint8_t TFT_MESH_b = 0; - if (selected == 1) { - LOG_INFO("Setting color to system default or defined variant"); - // Given just before we set all these to zero, we will allow this to go through - } else if (selected == 2) { - LOG_INFO("Setting color to Meshtastic Green"); - TFT_MESH_r = 103; - TFT_MESH_g = 234; - TFT_MESH_b = 148; - } else if (selected == 3) { - LOG_INFO("Setting color to Yellow"); - TFT_MESH_r = 255; - TFT_MESH_g = 255; - TFT_MESH_b = 128; - } else if (selected == 4) { - LOG_INFO("Setting color to Red"); - TFT_MESH_r = 255; - TFT_MESH_g = 64; - TFT_MESH_b = 64; - } else if (selected == 5) { - LOG_INFO("Setting color to Orange"); - TFT_MESH_r = 255; - TFT_MESH_g = 160; - TFT_MESH_b = 20; - } else if (selected == 6) { - LOG_INFO("Setting color to Purple"); - TFT_MESH_r = 204; - TFT_MESH_g = 153; - TFT_MESH_b = 255; - } else if (selected == 7) { - LOG_INFO("Setting color to Blue"); - TFT_MESH_r = 0; - TFT_MESH_g = 0; - TFT_MESH_b = 255; - } else if (selected == 8) { - LOG_INFO("Setting color to Teal"); - TFT_MESH_r = 16; - TFT_MESH_g = 102; - TFT_MESH_b = 102; - } else if (selected == 9) { - LOG_INFO("Setting color to Cyan"); - TFT_MESH_r = 0; - TFT_MESH_g = 255; - TFT_MESH_b = 255; - } else if (selected == 10) { - LOG_INFO("Setting color to Ice"); - TFT_MESH_r = 173; - TFT_MESH_g = 216; - TFT_MESH_b = 230; - } else if (selected == 11) { - LOG_INFO("Setting color to Pink"); - TFT_MESH_r = 255; - TFT_MESH_g = 105; - TFT_MESH_b = 180; - } else if (selected == 12) { - LOG_INFO("Setting color to White"); - TFT_MESH_r = 255; - TFT_MESH_g = 255; - TFT_MESH_b = 255; - } else if (selected == 13) { - LOG_INFO("Setting color to Gray"); - TFT_MESH_r = 128; - TFT_MESH_g = 128; - TFT_MESH_b = 128; - } else { - menuQueue = system_base_menu; - screen->runNow(); - } + const ScreenColor &color = option.value; + if (color.useVariant) { + LOG_INFO("Setting color to system default or defined variant"); + } else { + LOG_INFO("Setting color to %s", option.label); + } + + uint8_t r = color.r; + uint8_t g = color.g; + uint8_t b = color.b; - if (selected != 0) { display->setColor(BLACK); display->fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); display->setColor(WHITE); - if (TFT_MESH_r == 0 && TFT_MESH_g == 0 && TFT_MESH_b == 0) { + if (color.useVariant || (r == 0 && g == 0 && b == 0)) { #ifdef TFT_MESH_OVERRIDE TFT_MESH = TFT_MESH_OVERRIDE; #else TFT_MESH = COLOR565(0x67, 0xEA, 0x94); #endif } else { - TFT_MESH = COLOR565(TFT_MESH_r, TFT_MESH_g, TFT_MESH_b); + TFT_MESH = COLOR565(r, g, b); } #if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) @@ -1802,16 +1901,40 @@ void menuHandler::TFTColorPickerMenu(OLEDDisplay *display) #endif screen->setFrames(graphics::Screen::FOCUS_SYSTEM); - if (TFT_MESH_r == 0 && TFT_MESH_g == 0 && TFT_MESH_b == 0) { + if (color.useVariant || (r == 0 && g == 0 && b == 0)) { uiconfig.screen_rgb_color = 0; } else { - uiconfig.screen_rgb_color = (TFT_MESH_r << 16) | (TFT_MESH_g << 8) | TFT_MESH_b; + uiconfig.screen_rgb_color = + (static_cast(r) << 16) | (static_cast(g) << 8) | static_cast(b); } LOG_INFO("Storing Value of %d to uiconfig.screen_rgb_color", uiconfig.screen_rgb_color); saveUIConfig(); - } #endif - }; + }); + + int initialSelection = 0; + if (uiconfig.screen_rgb_color == 0) { + initialSelection = 1; + } else { + uint32_t currentColor = uiconfig.screen_rgb_color; + for (size_t i = 0; i < colorCount; ++i) { + if (!colorOptions[i].hasValue) { + continue; + } + const ScreenColor &color = colorOptions[i].value; + if (color.useVariant) { + continue; + } + uint32_t encoded = + (static_cast(color.r) << 16) | (static_cast(color.g) << 8) | static_cast(color.b); + if (encoded == currentColor) { + initialSelection = static_cast(i); + break; + } + } + } + bannerOptions.InitialSelected = initialSelection; + screen->showOverlayBanner(bannerOptions); } diff --git a/src/graphics/draw/MenuHandler.h b/src/graphics/draw/MenuHandler.h index a9a18b8e3..445513e25 100644 --- a/src/graphics/draw/MenuHandler.h +++ b/src/graphics/draw/MenuHandler.h @@ -128,7 +128,28 @@ template struct MenuOption { MenuOption(const char *labelIn, OptionsAction actionIn) : label(labelIn), action(actionIn), hasValue(false), value() {} }; +struct ScreenColor { + uint8_t r; + uint8_t g; + uint8_t b; + bool useVariant; + + ScreenColor(uint8_t rIn = 0, uint8_t gIn = 0, uint8_t bIn = 0, bool variantIn = false) + : r(rIn), g(gIn), b(bIn), useVariant(variantIn) + { + } +}; + using RadioPresetOption = MenuOption; +using LoraRegionOption = MenuOption; +using TimezoneOption = MenuOption; +using CompassOption = MenuOption; +using ScreenColorOption = MenuOption; +using GPSToggleOption = MenuOption; +using GPSFormatOption = MenuOption; +using NodeNameOption = MenuOption; +using PositionMenuOption = MenuOption; +using ClockFaceOption = MenuOption; } // namespace graphics #endif diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index b7459abe0..78602a9ec 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -4,6 +4,7 @@ #include "configuration.h" #include "mesh-pb-constants.h" #include "meshUtils.h" +#include "modules/TextMessageModule.h" #if !MESHTASTIC_EXCLUDE_TRACEROUTE #include "modules/TraceRouteModule.h" #endif @@ -35,6 +36,10 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) return true; // we handled it, so stop processing } + if (!seenRecently && !wasUpgraded && textMessageModule) { + seenRecently = textMessageModule->recentlySeen(p->id); + } + if (seenRecently) { printPacket("Ignore dupe incoming msg", p); rxDupe++; diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 9ed07a8e8..6660549eb 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -246,7 +246,8 @@ uint32_t RadioInterface::getPacketTime(const meshtastic_MeshPacket *p, bool rece /** The delay to use for retransmitting dropped packets */ uint32_t RadioInterface::getRetransmissionMsec(const meshtastic_MeshPacket *p) { - size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded); + size_t numbytes =p->which_payload_variant == meshtastic_MeshPacket_decoded_tag ? + pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded) : p->encrypted.size+MESHTASTIC_HEADER_LENGTH; uint32_t packetAirtime = getPacketTime(numbytes + sizeof(PacketHeader)); // Make sure enough time has elapsed for this packet to be sent and an ACK is received. // LOG_DEBUG("Waiting for flooding message with airtime %d and slotTime is %d", packetAirtime, slotTimeMsec); @@ -520,6 +521,10 @@ void RadioInterface::applyModemConfig() sf = 12; break; } + if (loraConfig.coding_rate >= 5 && loraConfig.coding_rate <= 8 && loraConfig.coding_rate != cr) { + cr = loraConfig.coding_rate; + LOG_INFO("Using custom Coding Rate %u", cr); + } } else { sf = loraConfig.spread_factor; cr = loraConfig.coding_rate; diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 3aaef97f6..a3861521a 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -113,7 +113,7 @@ bool Router::shouldDecrementHopLimit(const meshtastic_MeshPacket *p) // Check 3: role check (moderate cost - multiple comparisons) if (!IS_ONE_OF(node->user.role, meshtastic_Config_DeviceConfig_Role_ROUTER, - meshtastic_Config_DeviceConfig_Role_ROUTER_LATE)) { + meshtastic_Config_DeviceConfig_Role_ROUTER_LATE, meshtastic_Config_DeviceConfig_Role_CLIENT_BASE)) { continue; } @@ -745,15 +745,19 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src) MeshModule::callModules(*p, src); #if !MESHTASTIC_EXCLUDE_MQTT - // Mark as pki_encrypted if it is not yet decoded and MQTT encryption is also enabled, hash matches and it's a DM not to - // us (because we would be able to decrypt it) - if (decodedState == DecodeState::DECODE_FAILURE && moduleConfig.mqtt.encryption_enabled && p->channel == 0x00 && - !isBroadcast(p->to) && !isToUs(p)) - p_encrypted->pki_encrypted = true; - // After potentially altering it, publish received message to MQTT if we're not the original transmitter of the packet - if ((decodedState == DecodeState::DECODE_SUCCESS || p_encrypted->pki_encrypted) && moduleConfig.mqtt.enabled && - !isFromUs(p) && mqtt) - mqtt->onSend(*p_encrypted, *p, p->channel); + if (p_encrypted == nullptr) { + LOG_WARN("p_encrypted is null, skipping MQTT publish"); + } else { + // Mark as pki_encrypted if it is not yet decoded and MQTT encryption is also enabled, hash matches and it's a DM not + // to us (because we would be able to decrypt it) + if (decodedState == DecodeState::DECODE_FAILURE && moduleConfig.mqtt.encryption_enabled && p->channel == 0x00 && + !isBroadcast(p->to) && !isToUs(p)) + p_encrypted->pki_encrypted = true; + // After potentially altering it, publish received message to MQTT if we're not the original transmitter of the packet + if ((decodedState == DecodeState::DECODE_SUCCESS || p_encrypted->pki_encrypted) && moduleConfig.mqtt.enabled && + !isFromUs(p) && mqtt) + mqtt->onSend(*p_encrypted, *p, p->channel); + } #endif } diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index e1f07a32b..2d7996a13 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -62,6 +62,11 @@ template bool SX126xInterface::init() digitalWrite(LORA_PA_TX_EN, LOW); #endif +#ifdef RF95_FAN_EN + digitalWrite(RF95_FAN_EN, HIGH); + pinMode(RF95_FAN_EN, OUTPUT); +#endif + #if ARCH_PORTDUINO tcxoVoltage = (float)portduino_config.dio3_tcxo_voltage / 1000; if (portduino_config.lora_sx126x_ant_sw_pin.pin != RADIOLIB_NC) { @@ -85,6 +90,13 @@ template bool SX126xInterface::init() power = -9; int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO); + +#ifdef SX126X_PA_RAMP_US + // Set custom PA ramp time for boards requiring longer stabilization (e.g., T-Beam 1W needs >800us) + if (res == RADIOLIB_ERR_NONE) { + lora.setPaRampTime(SX126X_PA_RAMP_US); + } +#endif // \todo Display actual typename of the adapter, not just `SX126x` LOG_INFO("SX126x init result %d", res); if (res == RADIOLIB_ERR_CHIP_NOT_FOUND || res == RADIOLIB_ERR_SPI_CMD_FAILED) diff --git a/src/modules/SystemCommandsModule.cpp b/src/modules/SystemCommandsModule.cpp index 51543eab6..1da756366 100644 --- a/src/modules/SystemCommandsModule.cpp +++ b/src/modules/SystemCommandsModule.cpp @@ -45,9 +45,9 @@ int SystemCommandsModule::handleInputEvent(const InputEvent *event) // Mute case INPUT_BROKER_MSG_MUTE_TOGGLE: if (moduleConfig.external_notification.enabled && externalNotificationModule) { - externalNotificationModule->setMute(externalNotificationModule->getMute()); + externalNotificationModule->setMute(!externalNotificationModule->getMute()); IF_SCREEN(if (!externalNotificationModule->getMute()) externalNotificationModule->stopNow(); screen->showSimpleBanner( - externalNotificationModule->getMute() ? "Notifications\nEnabled" : "Notifications\nDisabled", 3000);) + externalNotificationModule->getMute() ? "Notifications\nDisabled" : "Notifications\nEnabled", 3000);) } return 0; // Bluetooth diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 41062662b..843d7b8d5 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -53,7 +53,7 @@ extern void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const c #include "Sensor/LTR390UVSensor.h" #endif -#if __has_include() +#if __has_include(MESHTASTIC_BME680_HEADER) #include "Sensor/BME680Sensor.h" #endif @@ -214,7 +214,7 @@ void EnvironmentTelemetryModule::i2cScanFinished(ScanI2C *i2cScanner) #if __has_include() addSensor(i2cScanner, ScanI2C::DeviceType::LTR390UV); #endif -#if __has_include() +#if __has_include(MESHTASTIC_BME680_HEADER) addSensor(i2cScanner, ScanI2C::DeviceType::BME_680); #endif #if __has_include() diff --git a/src/modules/Telemetry/HealthTelemetry.cpp b/src/modules/Telemetry/HealthTelemetry.cpp index 215e49c7a..572f0281a 100644 --- a/src/modules/Telemetry/HealthTelemetry.cpp +++ b/src/modules/Telemetry/HealthTelemetry.cpp @@ -136,12 +136,12 @@ void HealthTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState * display->drawString(x, y += _fontHeight(FONT_SMALL), tempStr); if (lastMeasurement.variant.health_metrics.has_heart_bpm) { char heartStr[32]; - snprintf(heartStr, sizeof(heartStr), "Heart Rate: %.0f bpm", lastMeasurement.variant.health_metrics.heart_bpm); + snprintf(heartStr, sizeof(heartStr), "Heart Rate: %u bpm", lastMeasurement.variant.health_metrics.heart_bpm); display->drawString(x, y += _fontHeight(FONT_SMALL), heartStr); } if (lastMeasurement.variant.health_metrics.has_spO2) { char spo2Str[32]; - snprintf(spo2Str, sizeof(spo2Str), "spO2: %.0f %%", lastMeasurement.variant.health_metrics.spO2); + snprintf(spo2Str, sizeof(spo2Str), "spO2: %u %%", lastMeasurement.variant.health_metrics.spO2); display->drawString(x, y += _fontHeight(FONT_SMALL), spo2Str); } } diff --git a/src/modules/Telemetry/Sensor/BME680Sensor.cpp b/src/modules/Telemetry/Sensor/BME680Sensor.cpp index 95f3dc5f0..22330ca75 100644 --- a/src/modules/Telemetry/Sensor/BME680Sensor.cpp +++ b/src/modules/Telemetry/Sensor/BME680Sensor.cpp @@ -1,6 +1,6 @@ #include "configuration.h" -#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include(MESHTASTIC_BME680_HEADER) #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "BME680Sensor.h" @@ -10,6 +10,7 @@ BME680Sensor::BME680Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BME680, "BME680") {} +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 int32_t BME680Sensor::runOnce() { if (!bme680.run()) { @@ -17,10 +18,13 @@ int32_t BME680Sensor::runOnce() } return 35; } +#endif // defined(MESHTASTIC_BME680_BSEC2_SUPPORTED) bool BME680Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev) { status = 0; + +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 if (!bme680.begin(dev->address.address, *bus)) checkStatus("begin"); @@ -42,12 +46,25 @@ bool BME680Sensor::initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev) if (status == 0) LOG_DEBUG("BME680Sensor::runOnce: bme680.status %d", bme680.status); +#else + bme680 = makeBME680(bus); + + if (!bme680->begin(dev->address.address)) { + LOG_ERROR("Init sensor: %s failed at begin()", sensorName); + return status; + } + + status = 1; + +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED + initI2CSensor(); return status; } bool BME680Sensor::getMetrics(meshtastic_Telemetry *measurement) { +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 if (bme680.getData(BSEC_OUTPUT_RAW_PRESSURE).signal == 0) return false; @@ -65,9 +82,27 @@ bool BME680Sensor::getMetrics(meshtastic_Telemetry *measurement) // Check if we need to save state to filesystem (every STATE_SAVE_PERIOD ms) measurement->variant.environment_metrics.iaq = bme680.getData(BSEC_OUTPUT_IAQ).signal; updateState(); +#else + if (!bme680->performReading()) { + LOG_ERROR("BME680Sensor::getMetrics: performReading failed"); + return false; + } + + measurement->variant.environment_metrics.has_temperature = true; + measurement->variant.environment_metrics.has_relative_humidity = true; + measurement->variant.environment_metrics.has_barometric_pressure = true; + measurement->variant.environment_metrics.has_gas_resistance = true; + + measurement->variant.environment_metrics.temperature = bme680->readTemperature(); + measurement->variant.environment_metrics.relative_humidity = bme680->readHumidity(); + measurement->variant.environment_metrics.barometric_pressure = bme680->readPressure() / 100.0F; + measurement->variant.environment_metrics.gas_resistance = bme680->readGas() / 1000.0; + +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED return true; } +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 void BME680Sensor::loadState() { #ifdef FSCom @@ -144,5 +179,6 @@ void BME680Sensor::checkStatus(const char *functionName) else if (bme680.sensor.status > BME68X_OK) LOG_WARN("%s BME68X code: %d", functionName, bme680.sensor.status); } +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED #endif diff --git a/src/modules/Telemetry/Sensor/BME680Sensor.h b/src/modules/Telemetry/Sensor/BME680Sensor.h index f4ead95f7..9bef56e1e 100644 --- a/src/modules/Telemetry/Sensor/BME680Sensor.h +++ b/src/modules/Telemetry/Sensor/BME680Sensor.h @@ -1,23 +1,40 @@ #include "configuration.h" -#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include(MESHTASTIC_BME680_HEADER) #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "TelemetrySensor.h" + +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 +#include #include +#else +#include +#include +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED #define STATE_SAVE_PERIOD UINT32_C(360 * 60 * 1000) // That's 6 hours worth of millis() +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 const uint8_t bsec_config[] = { #include "config/bme680/bme680_iaq_33v_3s_4d/bsec_iaq.txt" }; - +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED class BME680Sensor : public TelemetrySensor { private: +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 Bsec2 bme680; +#else + using BME680Ptr = std::unique_ptr; + + static BME680Ptr makeBME680(TwoWire *bus) { return std::make_unique(bus); } + + BME680Ptr bme680; +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED protected: +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 const char *bsecConfigFileName = "/prefs/bsec.dat"; uint8_t bsecState[BSEC_MAX_STATE_BLOB_SIZE] = {0}; uint8_t accuracy = 0; @@ -34,10 +51,13 @@ class BME680Sensor : public TelemetrySensor void loadState(); void updateState(); void checkStatus(const char *functionName); +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED public: BME680Sensor(); +#if MESHTASTIC_BME680_BSEC2_SUPPORTED == 1 virtual int32_t runOnce() override; +#endif // MESHTASTIC_BME680_BSEC2_SUPPORTED virtual bool getMetrics(meshtastic_Telemetry *measurement) override; virtual bool initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev) override; }; diff --git a/src/modules/TextMessageModule.cpp b/src/modules/TextMessageModule.cpp index 7f889e087..d94701c6b 100644 --- a/src/modules/TextMessageModule.cpp +++ b/src/modules/TextMessageModule.cpp @@ -17,6 +17,9 @@ ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp auto &p = mp.decoded; LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes); #endif + // add packet ID to the rolling list of packets + textPacketList[textPacketListIndex] = mp.id; + textPacketListIndex = (textPacketListIndex + 1) % TEXT_PACKET_LIST_SIZE; // We only store/display messages destined for us. devicestate.rx_text_message = mp; @@ -47,3 +50,13 @@ bool TextMessageModule::wantPacket(const meshtastic_MeshPacket *p) { return MeshService::isTextPayload(p); } + +bool TextMessageModule::recentlySeen(uint32_t id) +{ + for (size_t i = 0; i < TEXT_PACKET_LIST_SIZE; i++) { + if (textPacketList[i] != 0 && textPacketList[i] == id) { + return true; + } + } + return false; +} \ No newline at end of file diff --git a/src/modules/TextMessageModule.h b/src/modules/TextMessageModule.h index e719f1abc..42900a78e 100644 --- a/src/modules/TextMessageModule.h +++ b/src/modules/TextMessageModule.h @@ -1,6 +1,7 @@ #pragma once #include "Observer.h" #include "SinglePortModule.h" +#define TEXT_PACKET_LIST_SIZE 50 /** * Text message handling for Meshtastic. @@ -19,6 +20,8 @@ class TextMessageModule : public SinglePortModule, public Observable #include +#ifdef NIMBLE_TWO #include "NimBLEAdvertising.h" -#ifdef CONFIG_BT_NIMBLE_EXT_ADV #include "NimBLEExtAdvertising.h" -#endif #include "PowerStatus.h" +#endif #if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_gap.h" @@ -26,12 +26,15 @@ #include "nimble/nimble/host/include/host/ble_gap.h" #endif +#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) + namespace { constexpr uint16_t kPreferredBleMtu = 517; constexpr uint16_t kPreferredBleTxOctets = 251; constexpr uint16_t kPreferredBleTxTimeUs = (kPreferredBleTxOctets + 14) * 8; } // namespace +#endif // Debugging options: careful, they slow things down quite a bit! // #define DEBUG_NIMBLE_ON_READ_TIMING // uncomment to time onRead duration @@ -310,9 +313,11 @@ class BluetoothPhoneAPI : public PhoneAPI, public concurrency::OSThread { PhoneAPI::onNowHasData(fromRadioNum); -#ifdef DEBUG_NIMBLE_NOTIFY int currentNotifyCount = notifyCount.fetch_add(1); + uint8_t cc = bleServer->getConnectedCount(); + +#ifdef DEBUG_NIMBLE_NOTIFY // This logging slows things down when there are lots of packets going to the phone, like initial connection: LOG_DEBUG("BLE notify(%d) fromNum: %d connections: %d", currentNotifyCount, fromRadioNum, cc); #endif @@ -321,7 +326,13 @@ class BluetoothPhoneAPI : public PhoneAPI, public concurrency::OSThread put_le32(val, fromRadioNum); fromNumCharacteristic->setValue(val, sizeof(val)); +#ifdef NIMBLE_TWO + // NOTE: I don't have any NIMBLE_TWO devices, but this line makes me suspicious, and I suspect it needs to just be + // notify(). fromNumCharacteristic->notify(val, sizeof(val), BLE_HS_CONN_HANDLE_NONE); +#else + fromNumCharacteristic->notify(); +#endif } /// Check the current underlying physical link to see if the client is currently connected @@ -386,7 +397,12 @@ static uint8_t lastToRadio[MAX_TO_FROM_RADIO_SIZE]; class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks { - void onWrite(NimBLECharacteristic *pCharacteristic, NimBLEConnInfo &) override +#ifdef NIMBLE_TWO + virtual void onWrite(NimBLECharacteristic *pCharacteristic, NimBLEConnInfo &connInfo) +#else + virtual void onWrite(NimBLECharacteristic *pCharacteristic) + +#endif { // CAUTION: This callback runs in the NimBLE task!!! Don't do anything except communicate with the main task's runOnce. // Assumption: onWrite is serialized by NimBLE, so we don't need to lock here against multiple concurrent onWrite calls. @@ -433,7 +449,11 @@ class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks { - void onRead(NimBLECharacteristic *pCharacteristic, NimBLEConnInfo &) override +#ifdef NIMBLE_TWO + virtual void onRead(NimBLECharacteristic *pCharacteristic, NimBLEConnInfo &connInfo) +#else + virtual void onRead(NimBLECharacteristic *pCharacteristic) +#endif { // CAUTION: This callback runs in the NimBLE task!!! Don't do anything except communicate with the main task's runOnce. @@ -541,27 +561,32 @@ class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks class NimbleBluetoothServerCallback : public NimBLEServerCallbacks { +#ifdef NIMBLE_TWO public: - explicit NimbleBluetoothServerCallback(NimbleBluetooth *ble) : ble(ble) {} + NimbleBluetoothServerCallback(NimbleBluetooth *ble) { this->ble = ble; } private: NimbleBluetooth *ble; - uint32_t onPassKeyDisplay() override + virtual uint32_t onPassKeyDisplay() +#else + virtual uint32_t onPassKeyRequest() +#endif { uint32_t passkey = config.bluetooth.fixed_pin; if (config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN) { LOG_INFO("Use random passkey"); + // This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits passkey = random(100000, 999999); } - LOG_INFO("*** Enter passkey %06u on the peer side ***", passkey); + LOG_INFO("*** Enter passkey %d on the peer side ***", passkey); powerFSM.trigger(EVENT_BLUETOOTH_PAIR); meshtastic::BluetoothStatus newStatus(std::to_string(passkey)); bluetoothStatus->updateStatus(&newStatus); -#if HAS_SCREEN +#if HAS_SCREEN // Todo: migrate this display code back into Screen class, and observe bluetoothStatus if (screen) { screen->startAlert([passkey](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void { char btPIN[16] = "888888"; @@ -590,29 +615,39 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks }); } #endif - passkeyShowing = true; + return passkey; } - void onAuthenticationComplete(NimBLEConnInfo &connInfo) override +#ifdef NIMBLE_TWO + virtual void onAuthenticationComplete(NimBLEConnInfo &connInfo) +#else + virtual void onAuthenticationComplete(ble_gap_conn_desc *desc) +#endif { LOG_INFO("BLE authentication complete"); meshtastic::BluetoothStatus newStatus(meshtastic::BluetoothStatus::ConnectionState::CONNECTED); bluetoothStatus->updateStatus(&newStatus); + // Todo: migrate this display code back into Screen class, and observe bluetoothStatus if (passkeyShowing) { passkeyShowing = false; - if (screen) { + if (screen) screen->endAlert(); - } } + // Store the connection handle for future use +#ifdef NIMBLE_TWO nimbleBluetoothConnHandle = connInfo.getConnHandle(); +#else + nimbleBluetoothConnHandle = desc->conn_handle; +#endif } - void onConnect(NimBLEServer *pServer, NimBLEConnInfo &connInfo) override +#ifdef NIMBLE_TWO + virtual void onConnect(NimBLEServer *pServer, NimBLEConnInfo &connInfo) { LOG_INFO("BLE incoming connection %s", connInfo.getAddress().toString().c_str()); @@ -637,12 +672,21 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks LOG_INFO("BLE conn %u initial MTU %u (target %u)", connHandle, connInfo.getMTU(), kPreferredBleMtu); pServer->updateConnParams(connHandle, 6, 12, 0, 200); } +#endif - void onDisconnect(NimBLEServer *pServer, NimBLEConnInfo &connInfo, int reason) override +#ifdef NIMBLE_TWO + virtual void onDisconnect(NimBLEServer *pServer, NimBLEConnInfo &connInfo, int reason) { LOG_INFO("BLE disconnect reason: %d", reason); +#else + virtual void onDisconnect(NimBLEServer *pServer, ble_gap_conn_desc *desc) + { + LOG_INFO("BLE disconnect"); +#endif +#ifdef NIMBLE_TWO if (ble->isDeInit) return; +#endif meshtastic::BluetoothStatus newStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED); bluetoothStatus->updateStatus(&newStatus); @@ -666,69 +710,35 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks bluetoothPhoneAPI->writeCount = 0; } + // Clear the last ToRadio packet buffer to avoid rejecting first packet from new connection memset(lastToRadio, 0, sizeof(lastToRadio)); - nimbleBluetoothConnHandle = BLE_HS_CONN_HANDLE_NONE; + nimbleBluetoothConnHandle = BLE_HS_CONN_HANDLE_NONE; // BLE_HS_CONN_HANDLE_NONE means "no connection" +#ifdef NIMBLE_TWO + // Restart Advertising ble->startAdvertising(); +#else + NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); + if (!pAdvertising->start(0)) { + if (pAdvertising->isAdvertising()) { + LOG_DEBUG("BLE advertising already running"); + } else { + LOG_ERROR("BLE failed to restart advertising"); + } + } +#endif } }; static NimbleBluetoothToRadioCallback *toRadioCallbacks; static NimbleBluetoothFromRadioCallback *fromRadioCallbacks; -void NimbleBluetooth::startAdvertising() -{ -#if defined(CONFIG_BT_NIMBLE_EXT_ADV) - NimBLEExtAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); - NimBLEExtAdvertisement legacyAdvertising; - - legacyAdvertising.setLegacyAdvertising(true); - legacyAdvertising.setScannable(true); - legacyAdvertising.setConnectable(true); - legacyAdvertising.setFlags(BLE_HS_ADV_F_DISC_GEN); - if (powerStatus->getHasBattery() == 1) { - legacyAdvertising.setCompleteServices(NimBLEUUID((uint16_t)0x180f)); - } - legacyAdvertising.setCompleteServices(NimBLEUUID(MESH_SERVICE_UUID)); - legacyAdvertising.setMinInterval(500); - legacyAdvertising.setMaxInterval(1000); - - NimBLEExtAdvertisement legacyScanResponse; - legacyScanResponse.setLegacyAdvertising(true); - legacyScanResponse.setConnectable(true); - legacyScanResponse.setName(getDeviceName()); - - if (!pAdvertising->setInstanceData(0, legacyAdvertising)) { - LOG_ERROR("BLE failed to set legacyAdvertising"); - } else if (!pAdvertising->setScanResponseData(0, legacyScanResponse)) { - LOG_ERROR("BLE failed to set legacyScanResponse"); - } else if (!pAdvertising->start(0, 0, 0)) { - LOG_ERROR("BLE failed to start legacyAdvertising"); - } -#else - NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); - pAdvertising->reset(); - pAdvertising->addServiceUUID(MESH_SERVICE_UUID); - if (powerStatus->getHasBattery() == 1) { - pAdvertising->addServiceUUID(NimBLEUUID((uint16_t)0x180f)); - } - - NimBLEAdvertisementData scan; - scan.setName(getDeviceName()); - pAdvertising->setScanResponseData(scan); - pAdvertising->enableScanResponse(true); - - if (!pAdvertising->start(0)) { - LOG_ERROR("BLE failed to start advertising"); - } -#endif - LOG_DEBUG("BLE Advertising started"); -} - void NimbleBluetooth::shutdown() { + // No measurable power saving for ESP32 during light-sleep(?) #ifndef ARCH_ESP32 + // Shutdown bluetooth for minimum power draw LOG_INFO("Disable bluetooth"); NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); pAdvertising->reset(); @@ -736,6 +746,7 @@ void NimbleBluetooth::shutdown() #endif } +// Proper shutdown for ESP32. Needs reboot to reverse. void NimbleBluetooth::deinit() { #ifdef ARCH_ESP32 @@ -749,17 +760,21 @@ void NimbleBluetooth::deinit() digitalWrite(BLE_LED, LOW); #endif #endif +#ifndef NIMBLE_TWO + NimBLEDevice::deinit(); +#endif #endif } +// Has initial setup been completed bool NimbleBluetooth::isActive() { - return bleServer != nullptr; + return bleServer; } bool NimbleBluetooth::isConnected() { - return bleServer && bleServer->getConnectedCount() > 0; + return bleServer->getConnectedCount() > 0; } int NimbleBluetooth::getRssi() @@ -803,7 +818,7 @@ void NimbleBluetooth::setup() LOG_INFO("Init the NimBLE bluetooth module"); NimBLEDevice::init(getDeviceName()); - NimBLEDevice::setPower(9); + NimBLEDevice::setPower(ESP_PWR_LVL_P9); #if NIMBLE_ENABLE_2M_PHY && (defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6)) int mtuResult = NimBLEDevice::setMTU(kPreferredBleMtu); @@ -836,7 +851,11 @@ void NimbleBluetooth::setup() NimBLEDevice::setSecurityIOCap(BLE_HS_IO_DISPLAY_ONLY); } bleServer = NimBLEDevice::createServer(); - auto *serverCallbacks = new NimbleBluetoothServerCallback(this); +#ifdef NIMBLE_TWO + NimbleBluetoothServerCallback *serverCallbacks = new NimbleBluetoothServerCallback(this); +#else + NimbleBluetoothServerCallback *serverCallbacks = new NimbleBluetoothServerCallback(); +#endif bleServer->setCallbacks(serverCallbacks, true); setupService(); startAdvertising(); @@ -881,7 +900,11 @@ void NimbleBluetooth::setupService() NimBLEService *batteryService = bleServer->createService(NimBLEUUID((uint16_t)0x180f)); // 0x180F is the Battery Service BatteryCharacteristic = batteryService->createCharacteristic( // 0x2A19 is the Battery Level characteristic) (uint16_t)0x2a19, NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY, 1); +#ifdef NIMBLE_TWO NimBLE2904 *batteryLevelDescriptor = BatteryCharacteristic->create2904(); +#else + NimBLE2904 *batteryLevelDescriptor = (NimBLE2904 *)BatteryCharacteristic->createDescriptor((uint16_t)0x2904); +#endif batteryLevelDescriptor->setFormat(NimBLE2904::FORMAT_UINT8); batteryLevelDescriptor->setNamespace(1); batteryLevelDescriptor->setUnit(0x27ad); @@ -889,12 +912,54 @@ void NimbleBluetooth::setupService() batteryService->start(); } +void NimbleBluetooth::startAdvertising() +{ +#ifdef NIMBLE_TWO + NimBLEExtAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); + NimBLEExtAdvertisement legacyAdvertising; + + legacyAdvertising.setLegacyAdvertising(true); + legacyAdvertising.setScannable(true); + legacyAdvertising.setConnectable(true); + legacyAdvertising.setFlags(BLE_HS_ADV_F_DISC_GEN); + if (powerStatus->getHasBattery() == 1) { + legacyAdvertising.setCompleteServices(NimBLEUUID((uint16_t)0x180f)); + } + legacyAdvertising.setCompleteServices(NimBLEUUID(MESH_SERVICE_UUID)); + legacyAdvertising.setMinInterval(500); + legacyAdvertising.setMaxInterval(1000); + + NimBLEExtAdvertisement legacyScanResponse; + legacyScanResponse.setLegacyAdvertising(true); + legacyScanResponse.setConnectable(true); + legacyScanResponse.setName(getDeviceName()); + + if (!pAdvertising->setInstanceData(0, legacyAdvertising)) { + LOG_ERROR("BLE failed to set legacyAdvertising"); + } else if (!pAdvertising->setScanResponseData(0, legacyScanResponse)) { + LOG_ERROR("BLE failed to set legacyScanResponse"); + } else if (!pAdvertising->start(0, 0, 0)) { + LOG_ERROR("BLE failed to start legacyAdvertising"); + } +#else + NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); + pAdvertising->reset(); + pAdvertising->addServiceUUID(MESH_SERVICE_UUID); + pAdvertising->addServiceUUID(NimBLEUUID((uint16_t)0x180f)); // 0x180F is the Battery Service + pAdvertising->start(0); +#endif +} + /// Given a level between 0-100, update the BLE attribute void updateBatteryLevel(uint8_t level) { if ((config.bluetooth.enabled == true) && bleServer && nimbleBluetooth->isConnected()) { BatteryCharacteristic->setValue(&level, 1); +#ifdef NIMBLE_TWO BatteryCharacteristic->notify(&level, 1, BLE_HS_CONN_HANDLE_NONE); +#else + BatteryCharacteristic->notify(); +#endif } } @@ -909,7 +974,11 @@ void NimbleBluetooth::sendLog(const uint8_t *logMessage, size_t length) if (!bleServer || !isConnected() || length > 512) { return; } +#ifdef NIMBLE_TWO logRadioCharacteristic->notify(logMessage, length, BLE_HS_CONN_HANDLE_NONE); +#else + logRadioCharacteristic->notify(logMessage, length, true); +#endif } void clearNVS() diff --git a/src/nimble/NimbleBluetooth.h b/src/nimble/NimbleBluetooth.h index 2956fe6d0..458fa4a67 100644 --- a/src/nimble/NimbleBluetooth.h +++ b/src/nimble/NimbleBluetooth.h @@ -12,11 +12,16 @@ class NimbleBluetooth : BluetoothApi bool isConnected(); int getRssi(); void sendLog(const uint8_t *logMessage, size_t length); +#if defined(NIMBLE_TWO) void startAdvertising(); +#endif bool isDeInit = false; private: void setupService(); +#if !defined(NIMBLE_TWO) + void startAdvertising(); +#endif }; void setBluetoothEnable(bool enable); diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 4722a66e5..f2b58f333 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -366,6 +366,14 @@ void portduinoSetup() cleanupNameForAutoconf("lora-hat-" + std::string(hat_vendor) + "-" + autoconf_product + ".yaml"); } else if (found_ch341) { product_config = cleanupNameForAutoconf("lora-usb-" + std::string(autoconf_product) + ".yaml"); + // look for more data after the null terminator + size_t len = strlen(autoconf_product); + if (len < 74) { + memcpy(portduino_config.device_id, autoconf_product + len + 1, 16); + if (!memfll(portduino_config.device_id, '\0', 16) && !memfll(portduino_config.device_id, 0xff, 16)) { + portduino_config.has_device_id = true; + } + } } // Don't try to automatically find config for a device with RAK eeprom. diff --git a/src/platform/portduino/USBHal.h b/src/platform/portduino/USBHal.h index ce2a5cfd3..ecc292430 100644 --- a/src/platform/portduino/USBHal.h +++ b/src/platform/portduino/USBHal.h @@ -64,7 +64,7 @@ class Ch341Hal : public RadioLibHal void getProductString(char *_product_string, size_t len) { len = len > 95 ? 95 : len; - strncpy(_product_string, pinedio.product_string, len); + memcpy(_product_string, pinedio.product_string, len); } void init() override {} diff --git a/variants/esp32/diy/dr-dev/platformio.ini b/variants/esp32/diy/dr-dev/platformio.ini index 9dd9b450b..a1022934d 100644 --- a/variants/esp32/diy/dr-dev/platformio.ini +++ b/variants/esp32/diy/dr-dev/platformio.ini @@ -1,5 +1,12 @@ ; Port to Disaster Radio's ESP32-v3 Dev Board [env:meshtastic-dr-dev] +custom_meshtastic_hw_model = 41 +custom_meshtastic_hw_model_slug = DR_DEV +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = false +custom_meshtastic_display_name = DR-DEV +custom_meshtastic_tags = DIY + extends = esp32_base board = esp32doit-devkit-v1 board_level = extra diff --git a/variants/esp32/diy/hydra/platformio.ini b/variants/esp32/diy/hydra/platformio.ini index a922ed874..3afd17e01 100644 --- a/variants/esp32/diy/hydra/platformio.ini +++ b/variants/esp32/diy/hydra/platformio.ini @@ -1,5 +1,13 @@ ; Hydra - Meshtastic DIY v1 hardware with some specific changes [env:hydra] +custom_meshtastic_hw_model = 39 +custom_meshtastic_hw_model_slug = HYDRA +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Hydra +custom_meshtastic_tags = DIY + extends = esp32_base board = esp32doit-devkit-v1 build_flags = diff --git a/variants/esp32/diy/v1/platformio.ini b/variants/esp32/diy/v1/platformio.ini index bcbd57cfa..3d31fc24a 100644 --- a/variants/esp32/diy/v1/platformio.ini +++ b/variants/esp32/diy/v1/platformio.ini @@ -1,5 +1,14 @@ ; Meshtastic DIY v1 by Nano VHF Schematic based on ESP32-WROOM-32 (38 pins) devkit & EBYTE E22 SX1262/SX1268 module [env:meshtastic-diy-v1] +custom_meshtastic_hw_model = 39 +custom_meshtastic_hw_model_slug = DIY_V1 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = DIY V1 +custom_meshtastic_images = diy.svg +custom_meshtastic_tags = DIY + extends = esp32_base board = esp32doit-devkit-v1 board_check = true diff --git a/variants/esp32/esp32-common.ini b/variants/esp32/esp32-common.ini index 15ab8ad44..e582b6880 100644 --- a/variants/esp32/esp32-common.ini +++ b/variants/esp32/esp32-common.ini @@ -38,7 +38,6 @@ build_flags = -DAXP_DEBUG_PORT=Serial -DCONFIG_BT_NIMBLE_ENABLED -DCONFIG_BT_NIMBLE_MAX_BONDS=6 # default is 3 - -DCONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2 -DCONFIG_BT_NIMBLE_MAX_CCCDS=20 -DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=8192 @@ -61,11 +60,11 @@ lib_deps = # renovate: datasource=git-refs depName=meshtastic-esp32_https_server packageName=https://github.com/meshtastic/esp32_https_server gitBranch=master https://github.com/meshtastic/esp32_https_server/archive/3223704846752e6d545139204837bdb2a55459ca.zip # renovate: datasource=custom.pio depName=NimBLE-Arduino packageName=h2zero/library/NimBLE-Arduino - h2zero/NimBLE-Arduino@2.3.7 + h2zero/NimBLE-Arduino@^1.4.3 # renovate: datasource=git-refs depName=libpax packageName=https://github.com/dbinfrago/libpax gitBranch=master https://github.com/dbinfrago/libpax/archive/3cdc0371c375676a97967547f4065607d4c53fd1.zip - # renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib - lewisxhe/XPowersLib@0.3.2 + # renovate: datasource=github-tags depName=XPowersLib packageName=lewisxhe/XPowersLib + https://github.com/lewisxhe/XPowersLib/archive/v0.3.2.zip # renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip # renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto diff --git a/variants/esp32/esp32.ini b/variants/esp32/esp32.ini index 532fd4e12..d1a8a63b0 100644 --- a/variants/esp32/esp32.ini +++ b/variants/esp32/esp32.ini @@ -5,4 +5,4 @@ extends = esp32_common custom_esp32_kind = esp32 build_flags = - ${esp32_common.build_flags} + ${esp32_common.build_flags} \ No newline at end of file diff --git a/variants/esp32/heltec_v1/platformio.ini b/variants/esp32/heltec_v1/platformio.ini index 4be3ba655..770326427 100644 --- a/variants/esp32/heltec_v1/platformio.ini +++ b/variants/esp32/heltec_v1/platformio.ini @@ -1,4 +1,11 @@ [env:heltec-v1] +custom_meshtastic_hw_model = 11 +custom_meshtastic_hw_model_slug = HELTEC_V1 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = false +custom_meshtastic_display_name = Heltec V1 +custom_meshtastic_tags = Heltec + ;build_type = debug ; to make it possible to step through our jtag debugger extends = esp32_base board_level = extra diff --git a/variants/esp32/heltec_v2.1/platformio.ini b/variants/esp32/heltec_v2.1/platformio.ini index 4dcd9e583..1f7caa16f 100644 --- a/variants/esp32/heltec_v2.1/platformio.ini +++ b/variants/esp32/heltec_v2.1/platformio.ini @@ -1,4 +1,11 @@ [env:heltec-v2_1] +custom_meshtastic_hw_model = 10 +custom_meshtastic_hw_model_slug = HELTEC_V2_1 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = false +custom_meshtastic_display_name = Heltec V2.1 +custom_meshtastic_tags = Heltec + board_level = extra ;build_type = debug ; to make it possible to step through our jtag debugger extends = esp32_base diff --git a/variants/esp32/heltec_v2/platformio.ini b/variants/esp32/heltec_v2/platformio.ini index ed455616d..5f15fb321 100644 --- a/variants/esp32/heltec_v2/platformio.ini +++ b/variants/esp32/heltec_v2/platformio.ini @@ -1,4 +1,11 @@ [env:heltec-v2_0] +custom_meshtastic_hw_model = 5 +custom_meshtastic_hw_model_slug = HELTEC_V2_0 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = false +custom_meshtastic_display_name = Heltec V2.0 +custom_meshtastic_tags = Heltec + ;build_type = debug ; to make it possible to step through our jtag debugger board_level = extra extends = esp32_base diff --git a/variants/esp32/m5stack_core/platformio.ini b/variants/esp32/m5stack_core/platformio.ini index 5006d62ff..d6c5c5b4c 100644 --- a/variants/esp32/m5stack_core/platformio.ini +++ b/variants/esp32/m5stack_core/platformio.ini @@ -1,4 +1,12 @@ [env:m5stack-core] +custom_meshtastic_hw_model = 42 +custom_meshtastic_hw_model_slug = M5STACK +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = M5 Stack +custom_meshtastic_tags = M5Stack + extends = esp32_base board = m5stack-core-esp32 monitor_filters = esp32_exception_decoder diff --git a/variants/esp32/nano-g1-explorer/platformio.ini b/variants/esp32/nano-g1-explorer/platformio.ini index f40a0e06c..703bb9d09 100644 --- a/variants/esp32/nano-g1-explorer/platformio.ini +++ b/variants/esp32/nano-g1-explorer/platformio.ini @@ -1,5 +1,13 @@ ; The 1.0 release of the nano-g1-explorer board [env:nano-g1-explorer] +custom_meshtastic_hw_model = 17 +custom_meshtastic_hw_model_slug = NANO_G1_EXPLORER +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Nano G1 Explorer +custom_meshtastic_tags = B&Q + extends = esp32_base board = ttgo-t-beam build_flags = diff --git a/variants/esp32/nano-g1/platformio.ini b/variants/esp32/nano-g1/platformio.ini index c61c9edaf..b0ebd191c 100644 --- a/variants/esp32/nano-g1/platformio.ini +++ b/variants/esp32/nano-g1/platformio.ini @@ -1,5 +1,13 @@ ; The 1.0 release of the nano-g1 board [env:nano-g1] +custom_meshtastic_hw_model = 14 +custom_meshtastic_hw_model_slug = NANO_G1 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Nano G1 +custom_meshtastic_tags = B&Q + extends = esp32_base board = ttgo-t-beam build_flags = diff --git a/variants/esp32/radiomaster_900_bandit_nano/platformio.ini b/variants/esp32/radiomaster_900_bandit_nano/platformio.ini index 887fb7916..924447ee4 100644 --- a/variants/esp32/radiomaster_900_bandit_nano/platformio.ini +++ b/variants/esp32/radiomaster_900_bandit_nano/platformio.ini @@ -1,4 +1,12 @@ [env:radiomaster_900_bandit_nano] +custom_meshtastic_hw_model = 64 +custom_meshtastic_hw_model_slug = RADIOMASTER_900_BANDIT_NANO +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 2 +custom_meshtastic_display_name = RadioMaster 900 Bandit Nano +custom_meshtastic_tags = RadioMaster + extends = esp32_base board = esp32doit-devkit-v1 build_flags = diff --git a/variants/esp32/rak11200/platformio.ini b/variants/esp32/rak11200/platformio.ini index 170e80b41..63821a092 100644 --- a/variants/esp32/rak11200/platformio.ini +++ b/variants/esp32/rak11200/platformio.ini @@ -1,4 +1,13 @@ [env:rak11200] +custom_meshtastic_hw_model = 13 +custom_meshtastic_hw_model_slug = RAK11200 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = RAK WisBlock 11200 +custom_meshtastic_images = rak11200.svg +custom_meshtastic_tags = RAK + extends = esp32_base board = wiscore_rak11200 board_level = pr diff --git a/variants/esp32/station-g1/platformio.ini b/variants/esp32/station-g1/platformio.ini index 609d9cd8e..ab7fcac2b 100644 --- a/variants/esp32/station-g1/platformio.ini +++ b/variants/esp32/station-g1/platformio.ini @@ -1,5 +1,13 @@ ; The 1.0 release of the nano-g1 board [env:station-g1] +custom_meshtastic_hw_model = 25 +custom_meshtastic_hw_model_slug = STATION_G1 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Station G1 +custom_meshtastic_tags = B&Q + extends = esp32_base board = ttgo-t-beam build_flags = diff --git a/variants/esp32/tbeam/platformio.ini b/variants/esp32/tbeam/platformio.ini index ed2bfb1a1..51952457a 100644 --- a/variants/esp32/tbeam/platformio.ini +++ b/variants/esp32/tbeam/platformio.ini @@ -1,8 +1,17 @@ ; The 1.0 release of the TBEAM board [env:tbeam] +custom_meshtastic_hw_model = 4 +custom_meshtastic_hw_model_slug = TBEAM +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = LILYGO T-Beam +custom_meshtastic_images = tbeam.svg +custom_meshtastic_tags = LilyGo + extends = esp32_base board = ttgo-t-beam -board_level = extra + board_check = true build_flags = ${esp32_base.build_flags} -D TBEAM_V10 @@ -13,7 +22,7 @@ upload_speed = 921600 [env:tbeam-displayshield] extends = env:tbeam - +board_level = extra build_flags = ${env:tbeam.build_flags} -D USE_ST7796 diff --git a/variants/esp32/tbeam_v07/platformio.ini b/variants/esp32/tbeam_v07/platformio.ini index 1647d9fd7..e2763fdec 100644 --- a/variants/esp32/tbeam_v07/platformio.ini +++ b/variants/esp32/tbeam_v07/platformio.ini @@ -1,5 +1,12 @@ ; The original TBEAM board without the AXP power chip and a few other changes [env:tbeam0_7] +custom_meshtastic_hw_model = 6 +custom_meshtastic_hw_model_slug = TBEAM_V0P7 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = false +custom_meshtastic_display_name = LILYGO T-Beam V0.7 +custom_meshtastic_tags = LilyGo + board_level = extra extends = esp32_base board = ttgo-t-beam diff --git a/variants/esp32/tlora_v1/platformio.ini b/variants/esp32/tlora_v1/platformio.ini index 1d879b6b0..c45cc2ce9 100644 --- a/variants/esp32/tlora_v1/platformio.ini +++ b/variants/esp32/tlora_v1/platformio.ini @@ -1,4 +1,11 @@ [env:tlora-v1] +custom_meshtastic_hw_model = 2 +custom_meshtastic_hw_model_slug = TLORA_V1 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = false +custom_meshtastic_display_name = LILYGO T-LoRa V1 +custom_meshtastic_tags = LilyGo + board_level = extra extends = esp32_base board = ttgo-lora32-v1 diff --git a/variants/esp32/tlora_v2/platformio.ini b/variants/esp32/tlora_v2/platformio.ini index 4a710ee34..68358bfc3 100644 --- a/variants/esp32/tlora_v2/platformio.ini +++ b/variants/esp32/tlora_v2/platformio.ini @@ -1,4 +1,11 @@ [env:tlora-v2] +custom_meshtastic_hw_model = 1 +custom_meshtastic_hw_model_slug = TLORA_V2 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = false +custom_meshtastic_display_name = LILYGO T-LoRa V2 +custom_meshtastic_tags = LilyGo + board_level = extra extends = esp32_base board = ttgo-lora32-v1 diff --git a/variants/esp32/tlora_v2_1_16/platformio.ini b/variants/esp32/tlora_v2_1_16/platformio.ini index 8d5bdab9e..d9cb8ed3b 100644 --- a/variants/esp32/tlora_v2_1_16/platformio.ini +++ b/variants/esp32/tlora_v2_1_16/platformio.ini @@ -1,4 +1,13 @@ [env:tlora-v2-1-1_6] +custom_meshtastic_hw_model = 3 +custom_meshtastic_hw_model_slug = TLORA_V2_1_1P6 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = LILYGO T-LoRa V2.1-1.6 +custom_meshtastic_images = tlora-v2-1-1_6.svg +custom_meshtastic_tags = LilyGo + extends = esp32_base board = ttgo-lora32-v21 board_check = true diff --git a/variants/esp32/tlora_v2_1_18/platformio.ini b/variants/esp32/tlora_v2_1_18/platformio.ini index 432117485..173a48692 100644 --- a/variants/esp32/tlora_v2_1_18/platformio.ini +++ b/variants/esp32/tlora_v2_1_18/platformio.ini @@ -1,4 +1,13 @@ [env:tlora-v2-1-1_8] +custom_meshtastic_hw_model = 15 +custom_meshtastic_hw_model_slug = TLORA_V2_1_1P8 +custom_meshtastic_architecture = esp32 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = LILYGO T-LoRa V2.1-1.8 +custom_meshtastic_images = tlora-v2-1-1_8.svg +custom_meshtastic_tags = LilyGo, 2.4GHz + extends = esp32_base board_level = extra board = ttgo-lora32-v21 diff --git a/variants/esp32c3/esp32c3.ini b/variants/esp32c3/esp32c3.ini index 7634a4141..2d7ae71bc 100644 --- a/variants/esp32c3/esp32c3.ini +++ b/variants/esp32c3/esp32c3.ini @@ -4,8 +4,3 @@ custom_esp32_kind = esp32c3 monitor_speed = 115200 monitor_filters = esp32_c3_exception_decoder - -build_flags = - ${esp32_common.build_flags} - -DCONFIG_BT_NIMBLE_EXT_ADV=1 - -DCONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES=2 diff --git a/variants/esp32c3/heltec_esp32c3/platformio.ini b/variants/esp32c3/heltec_esp32c3/platformio.ini index ce165bd97..d087e4fd0 100644 --- a/variants/esp32c3/heltec_esp32c3/platformio.ini +++ b/variants/esp32c3/heltec_esp32c3/platformio.ini @@ -1,4 +1,13 @@ [env:heltec-ht62-esp32c3-sx1262] +custom_meshtastic_hw_model = 53 +custom_meshtastic_hw_model_slug = HELTEC_HT62 +custom_meshtastic_architecture = esp32-c3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec HT62 +custom_meshtastic_images = heltec-ht62-esp32c3-sx1262.svg +custom_meshtastic_tags = Heltec + extends = esp32c3_base board = esp32-c3-devkitm-1 board_level = pr diff --git a/variants/esp32c6/m5stack_unitc6l/platformio.ini b/variants/esp32c6/m5stack_unitc6l/platformio.ini index 780f32c4e..3054d342a 100644 --- a/variants/esp32c6/m5stack_unitc6l/platformio.ini +++ b/variants/esp32c6/m5stack_unitc6l/platformio.ini @@ -1,4 +1,13 @@ [env:m5stack-unitc6l] +custom_meshtastic_hw_model = 111 +custom_meshtastic_hw_model_slug = M5STACK_C6L +custom_meshtastic_architecture = esp32-c6 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = M5Stack Unit C6L +custom_meshtastic_images = m5_c6l.svg +custom_meshtastic_tags = M5Stack + extends = esp32c6_base board = esp32-c6-devkitc-1 ;OpenOCD flash method @@ -26,6 +35,7 @@ build_flags = -D HAS_BLUETOOTH=1 -DCONFIG_BT_NIMBLE_EXT_ADV=1 -DCONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES=2 + -D NIMBLE_TWO monitor_speed=115200 lib_ignore = NonBlockingRTTTL diff --git a/variants/esp32s3/CDEBYTE_EoRa-S3/platformio.ini b/variants/esp32s3/CDEBYTE_EoRa-S3/platformio.ini index 3fcfbf281..092b36a2f 100644 --- a/variants/esp32s3/CDEBYTE_EoRa-S3/platformio.ini +++ b/variants/esp32s3/CDEBYTE_EoRa-S3/platformio.ini @@ -1,4 +1,13 @@ [env:CDEBYTE_EoRa-S3] +custom_meshtastic_hw_model = 61 +custom_meshtastic_hw_model_slug = CDEBYTE_EORA_S3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = EBYTE EoRa-S3 +custom_meshtastic_tags = EByte +custom_meshtastic_requires_dfu = true + extends = esp32s3_base board = CDEBYTE_EoRa-S3 build_flags = diff --git a/variants/esp32s3/ELECROW-ThinkNode-M2/platformio.ini b/variants/esp32s3/ELECROW-ThinkNode-M2/platformio.ini index 01e82184b..cfea4c1c0 100644 --- a/variants/esp32s3/ELECROW-ThinkNode-M2/platformio.ini +++ b/variants/esp32s3/ELECROW-ThinkNode-M2/platformio.ini @@ -1,4 +1,14 @@ [env:thinknode_m2] +custom_meshtastic_hw_model = 90 +custom_meshtastic_hw_model_slug = THINKNODE_M2 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = ThinkNode M2 +custom_meshtastic_images = thinknode_m2.svg +custom_meshtastic_tags = Elecrow +custom_meshtastic_requires_dfu = false + extends = esp32s3_base board = ESP32-S3-WROOM-1-N4 build_flags = diff --git a/variants/esp32s3/ELECROW-ThinkNode-M5/platformio.ini b/variants/esp32s3/ELECROW-ThinkNode-M5/platformio.ini index 3e87a5907..59ac625b6 100644 --- a/variants/esp32s3/ELECROW-ThinkNode-M5/platformio.ini +++ b/variants/esp32s3/ELECROW-ThinkNode-M5/platformio.ini @@ -1,4 +1,14 @@ [env:thinknode_m5] +custom_meshtastic_hw_model = 107 +custom_meshtastic_hw_model_slug = THINKNODE_M5 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = ThinkNode M5 +custom_meshtastic_images = thinknode_m1.svg +custom_meshtastic_tags = Elecrow +custom_meshtastic_requires_dfu = false + extends = esp32s3_base board = ESP32-S3-WROOM-1-N4 build_flags = diff --git a/variants/esp32s3/elecrow_panel/platformio.ini b/variants/esp32s3/elecrow_panel/platformio.ini index 3ed90f3f1..5c9a4bfaf 100644 --- a/variants/esp32s3/elecrow_panel/platformio.ini +++ b/variants/esp32s3/elecrow_panel/platformio.ini @@ -75,6 +75,17 @@ build_flags = -D DISPLAY_SET_RESOLUTION [env:elecrow-adv-24-28-tft] +custom_meshtastic_hw_model = 97 +custom_meshtastic_hw_model_slug = CROWPANEL +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Crowpanel Adv 2.4/2.8 TFT +custom_meshtastic_images = crowpanel_2_4.svg, crowpanel_2_8.svg +custom_meshtastic_tags = Elecrow +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = crowpanel_small_esp32s3_base build_flags = ${crowpanel_small_esp32s3_base.build_flags} @@ -99,6 +110,17 @@ build_flags = -D LGFX_TOUCH_ROTATION=0 [env:elecrow-adv-35-tft] +custom_meshtastic_hw_model = 97 +custom_meshtastic_hw_model_slug = CROWPANEL +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Crowpanel Adv 3.5 TFT +custom_meshtastic_images = crowpanel_3_5.svg +custom_meshtastic_tags = Elecrow +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = crowpanel_small_esp32s3_base board_level = pr build_flags = @@ -127,6 +149,17 @@ build_flags = ; 4.3, 5.0, 7.0 inch 800x480 IPS (V1) [env:elecrow-adv1-43-50-70-tft] +custom_meshtastic_hw_model = 97 +custom_meshtastic_hw_model_slug = CROWPANEL +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Crowpanel Adv 4.3/5.0/7.0 TFT +custom_meshtastic_images = crowpanel_5_0.svg, crowpanel_7_0.svg +custom_meshtastic_tags = Elecrow +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = crowpanel_large_esp32s3_base build_flags = ${crowpanel_large_esp32s3_base.build_flags} diff --git a/variants/esp32s3/esp32s3.ini b/variants/esp32s3/esp32s3.ini index 92ce25084..5e333f3ce 100644 --- a/variants/esp32s3/esp32s3.ini +++ b/variants/esp32s3/esp32s3.ini @@ -3,8 +3,3 @@ extends = esp32_common custom_esp32_kind = esp32s3 monitor_speed = 115200 - -build_flags = - ${esp32_common.build_flags} - -DCONFIG_BT_NIMBLE_EXT_ADV=1 - -DCONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES=2 diff --git a/variants/esp32s3/heltec_v3/platformio.ini b/variants/esp32s3/heltec_v3/platformio.ini index af0854e49..2f53c8756 100644 --- a/variants/esp32s3/heltec_v3/platformio.ini +++ b/variants/esp32s3/heltec_v3/platformio.ini @@ -1,4 +1,14 @@ -[env:heltec-v3] +[env:heltec-v3] +custom_meshtastic_hw_model = 43 +custom_meshtastic_hw_model_slug = HELTEC_V3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec V3 +custom_meshtastic_images = heltec-v3.svg, heltec-v3-case.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_wifi_lora_32_V3 board_level = pr diff --git a/variants/esp32s3/heltec_v4/platformio.ini b/variants/esp32s3/heltec_v4/platformio.ini index 28f7e0484..6582335af 100644 --- a/variants/esp32s3/heltec_v4/platformio.ini +++ b/variants/esp32s3/heltec_v4/platformio.ini @@ -10,6 +10,17 @@ build_flags = [env:heltec-v4] +custom_meshtastic_hw_model = 110 +custom_meshtastic_hw_model_slug = HELTEC_V4 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec V4 +custom_meshtastic_images = heltec_v4.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = heltec_v4_base build_flags = ${heltec_v4_base.build_flags} diff --git a/variants/esp32s3/heltec_vision_master_e213/platformio.ini b/variants/esp32s3/heltec_vision_master_e213/platformio.ini index cf28eb3e6..a03755970 100644 --- a/variants/esp32s3/heltec_vision_master_e213/platformio.ini +++ b/variants/esp32s3/heltec_vision_master_e213/platformio.ini @@ -1,4 +1,15 @@ [env:heltec-vision-master-e213] +custom_meshtastic_hw_model = 67 +custom_meshtastic_hw_model_slug = HELTEC_VISION_MASTER_E213 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec Vision Master E213 +custom_meshtastic_images = heltec-vision-master-e213.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_vision_master_e213 board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/heltec_vision_master_e290/platformio.ini b/variants/esp32s3/heltec_vision_master_e290/platformio.ini index 0e069120b..4cc913668 100644 --- a/variants/esp32s3/heltec_vision_master_e290/platformio.ini +++ b/variants/esp32s3/heltec_vision_master_e290/platformio.ini @@ -1,5 +1,16 @@ ; Using the original screen class [env:heltec-vision-master-e290] +custom_meshtastic_hw_model = 68 +custom_meshtastic_hw_model_slug = HELTEC_VISION_MASTER_E290 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec Vision Master E290 +custom_meshtastic_images = heltec-vision-master-e290.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_vision_master_e290 board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/heltec_vision_master_t190/platformio.ini b/variants/esp32s3/heltec_vision_master_t190/platformio.ini index 0b0754f60..bbc518b39 100644 --- a/variants/esp32s3/heltec_vision_master_t190/platformio.ini +++ b/variants/esp32s3/heltec_vision_master_t190/platformio.ini @@ -1,4 +1,15 @@ [env:heltec-vision-master-t190] +custom_meshtastic_hw_model = 66 +custom_meshtastic_hw_model_slug = HELTEC_VISION_MASTER_T190 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec Vision Master T190 +custom_meshtastic_images = heltec-vision-master-t190.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_vision_master_t190 board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/heltec_wireless_paper/platformio.ini b/variants/esp32s3/heltec_wireless_paper/platformio.ini index 4d9eab9d6..ac32fb219 100644 --- a/variants/esp32s3/heltec_wireless_paper/platformio.ini +++ b/variants/esp32s3/heltec_wireless_paper/platformio.ini @@ -1,5 +1,15 @@ ; Using the original screen class [env:heltec-wireless-paper] +custom_meshtastic_hw_model = 49 +custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_PAPER +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec Wireless Paper +custom_meshtastic_images = heltec-wireless-paper.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_wifi_lora_32_V3 board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/heltec_wireless_paper_v1/platformio.ini b/variants/esp32s3/heltec_wireless_paper_v1/platformio.ini index bff1fa71f..a4a21c55c 100644 --- a/variants/esp32s3/heltec_wireless_paper_v1/platformio.ini +++ b/variants/esp32s3/heltec_wireless_paper_v1/platformio.ini @@ -1,4 +1,14 @@ [env:heltec-wireless-paper-v1_0] +custom_meshtastic_hw_model = 57 +custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_PAPER_V1_0 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = false +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Heltec Wireless Paper V1.0 +custom_meshtastic_images = heltec-wireless-paper-v1_0.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board_level = extra board = heltec_wifi_lora_32_V3 diff --git a/variants/esp32s3/heltec_wireless_tracker/platformio.ini b/variants/esp32s3/heltec_wireless_tracker/platformio.ini index 45d3870fc..c2dab0c93 100644 --- a/variants/esp32s3/heltec_wireless_tracker/platformio.ini +++ b/variants/esp32s3/heltec_wireless_tracker/platformio.ini @@ -1,4 +1,15 @@ [env:heltec-wireless-tracker] +custom_meshtastic_hw_model = 48 +custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_TRACKER +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec Wireless Tracker V1.1 +custom_meshtastic_images = heltec-wireless-tracker.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_wireless_tracker board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/heltec_wireless_tracker_V1_0/platformio.ini b/variants/esp32s3/heltec_wireless_tracker_V1_0/platformio.ini index e3bc1c850..efeb63b8e 100644 --- a/variants/esp32s3/heltec_wireless_tracker_V1_0/platformio.ini +++ b/variants/esp32s3/heltec_wireless_tracker_V1_0/platformio.ini @@ -1,4 +1,14 @@ [env:heltec-wireless-tracker-V1-0] +custom_meshtastic_hw_model = 58 +custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_TRACKER_V1_0 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = false +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Heltec Wireless Tracker V1.0 +custom_meshtastic_images = heltec-wireless-tracker.svg +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board_level = extra board = heltec_wireless_tracker diff --git a/variants/esp32s3/heltec_wsl_v3/platformio.ini b/variants/esp32s3/heltec_wsl_v3/platformio.ini index c038a463e..0903a6bc7 100644 --- a/variants/esp32s3/heltec_wsl_v3/platformio.ini +++ b/variants/esp32s3/heltec_wsl_v3/platformio.ini @@ -1,4 +1,14 @@ -[env:heltec-wsl-v3] +[env:heltec-wsl-v3] +custom_meshtastic_hw_model = 44 +custom_meshtastic_hw_model_slug = HELTEC_WSL_V3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec Wireless Stick Lite V3 +custom_meshtastic_images = heltec-wsl-v3.svg +custom_meshtastic_tags = Heltec +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_wifi_lora_32_V3 board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/mesh-tab/variant.h b/variants/esp32s3/mesh-tab/variant.h index 63ef17d85..99204bba3 100644 --- a/variants/esp32s3/mesh-tab/variant.h +++ b/variants/esp32s3/mesh-tab/variant.h @@ -55,5 +55,6 @@ #define SX126X_RESET 14 #define SX126X_RXEN 47 #define SX126X_TXEN RADIOLIB_NC // Assuming that DIO2 is connected to TXEN pin +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #endif diff --git a/variants/esp32s3/picomputer-s3/platformio.ini b/variants/esp32s3/picomputer-s3/platformio.ini index ccc6f7839..bef7b19a0 100644 --- a/variants/esp32s3/picomputer-s3/platformio.ini +++ b/variants/esp32s3/picomputer-s3/platformio.ini @@ -1,4 +1,12 @@ [env:picomputer-s3] +custom_meshtastic_hw_model = 52 +custom_meshtastic_hw_model_slug = PICOMPUTER_S3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Pi Computer S3 +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = bpi_picow_esp32_s3 board_check = true diff --git a/variants/esp32s3/rak3312/platformio.ini b/variants/esp32s3/rak3312/platformio.ini index 1f95c3b73..113c2f527 100644 --- a/variants/esp32s3/rak3312/platformio.ini +++ b/variants/esp32s3/rak3312/platformio.ini @@ -1,4 +1,15 @@ [env:rak3312] +custom_meshtastic_hw_model = 106 +custom_meshtastic_hw_model_slug = RAK3312 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = RAK3312 +custom_meshtastic_images = rak_3312.svg +custom_meshtastic_tags = RAK +custom_meshtastic_requires_dfu = false +custom_meshtastic_partition_scheme = 16MB + extends = esp32s3_base board = wiscore_rak3312 board_level = pr @@ -13,8 +24,7 @@ build_flags = [env:rak3112] extends = esp32s3_base board = wiscore_rak3312 -board_level = pr -board_check = true +board_level = extra upload_protocol = esptool build_flags = diff --git a/variants/esp32s3/seeed-sensecap-indicator/platformio.ini b/variants/esp32s3/seeed-sensecap-indicator/platformio.ini index dd9dfc668..70a10e0d4 100644 --- a/variants/esp32s3/seeed-sensecap-indicator/platformio.ini +++ b/variants/esp32s3/seeed-sensecap-indicator/platformio.ini @@ -1,5 +1,16 @@ ; Seeed Studio SenseCAP Indicator [env:seeed-sensecap-indicator] +custom_meshtastic_hw_model = 70 +custom_meshtastic_hw_model_slug = SENSECAP_INDICATOR +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Seeed SenseCAP Indicator +custom_meshtastic_images = seeed-sensecap-indicator.svg +custom_meshtastic_tags = Seeed +custom_meshtastic_partition_scheme = 8MB + = true + extends = esp32s3_base platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32/archive/aef7fef6de3329ed6f75512d46d63bba12b09bb5.zip ; add_tca9535 (based on 2.0.16) diff --git a/variants/esp32s3/seeed_xiao_s3/platformio.ini b/variants/esp32s3/seeed_xiao_s3/platformio.ini index 3460399d9..b0e66241b 100644 --- a/variants/esp32s3/seeed_xiao_s3/platformio.ini +++ b/variants/esp32s3/seeed_xiao_s3/platformio.ini @@ -1,4 +1,15 @@ [env:seeed-xiao-s3] +custom_meshtastic_hw_model = 81 +custom_meshtastic_hw_model_slug = SEEED_XIAO_S3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Seeed Xiao ESP32-S3 +custom_meshtastic_images = seeed-xiao-s3.svg +custom_meshtastic_tags = Seeed +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = seeed-xiao-s3 board_level = pr diff --git a/variants/esp32s3/station-g2/platformio.ini b/variants/esp32s3/station-g2/platformio.ini index a528151be..091b35f00 100755 --- a/variants/esp32s3/station-g2/platformio.ini +++ b/variants/esp32s3/station-g2/platformio.ini @@ -1,4 +1,15 @@ [env:station-g2] +custom_meshtastic_hw_model = 31 +custom_meshtastic_hw_model_slug = STATION_G2 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 2 +custom_meshtastic_display_name = Station G2 +custom_meshtastic_images = station-g2.svg +custom_meshtastic_tags = B&Q +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = esp32s3_base board = station-g2 board_level = pr diff --git a/variants/esp32s3/t-beam-1w/pins_arduino.h b/variants/esp32s3/t-beam-1w/pins_arduino.h new file mode 100644 index 000000000..92b74615d --- /dev/null +++ b/variants/esp32s3/t-beam-1w/pins_arduino.h @@ -0,0 +1,25 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +// I2C for OLED and sensors +static const uint8_t SDA = 8; +static const uint8_t SCL = 9; + +// Default SPI mapped to Radio/SD +static const uint8_t SS = 15; // LoRa CS +static const uint8_t MOSI = 11; +static const uint8_t MISO = 12; +static const uint8_t SCK = 13; + +// SD Card CS +#define SDCARD_CS 10 + +#endif /* Pins_Arduino_h */ diff --git a/variants/esp32s3/t-beam-1w/platformio.ini b/variants/esp32s3/t-beam-1w/platformio.ini new file mode 100644 index 000000000..54ddb6c3e --- /dev/null +++ b/variants/esp32s3/t-beam-1w/platformio.ini @@ -0,0 +1,14 @@ +; LilyGo T-Beam-1W (1 Watt LoRa with external PA) +[env:t-beam-1w] +extends = esp32s3_base +board = t-beam-1w +board_build.partitions = default_8MB.csv +board_check = true + +lib_deps = + ${esp32s3_base.lib_deps} + +build_flags = + ${esp32s3_base.build_flags} + -I variants/esp32s3/t-beam-1w + -D T_BEAM_1W diff --git a/variants/esp32s3/t-beam-1w/variant.h b/variants/esp32s3/t-beam-1w/variant.h new file mode 100644 index 000000000..01404afcb --- /dev/null +++ b/variants/esp32s3/t-beam-1w/variant.h @@ -0,0 +1,97 @@ +// LilyGo T-Beam-1W variant.h +// Configuration based on LilyGO utilities.h and RF documentation + +// I2C for OLED display (SH1106 at 0x3C) +#define I2C_SDA 8 +#define I2C_SCL 9 + +// GPS - Quectel L76K +#define GPS_RX_PIN 5 +#define GPS_TX_PIN 6 +#define GPS_1PPS_PIN 7 +#define GPS_WAKEUP_PIN 16 // GPS_EN_PIN in LilyGO code +#define HAS_GPS 1 +#define GPS_BAUDRATE 9600 + +// Buttons +#define BUTTON_PIN 0 // BUTTON 1 +#define BUTTON_PIN_ALT 17 // BUTTON 2 + +// SPI (shared by LoRa and SD) +#define SPI_MOSI 11 +#define SPI_SCK 13 +#define SPI_MISO 12 +#define SPI_CS 10 + +// SD Card +#define HAS_SDCARD +#define SDCARD_USE_SPI1 +#define SDCARD_CS SPI_CS + +// LoRa Radio - SX1262 with 1W PA +#define USE_SX1262 + +#define LORA_SCK SPI_SCK +#define LORA_MISO SPI_MISO +#define LORA_MOSI SPI_MOSI +#define LORA_CS 15 +#define LORA_RESET 3 +#define LORA_DIO1 1 +#define LORA_BUSY 38 + +// CRITICAL: Radio power enable - MUST be HIGH before lora.begin()! +// GPIO 40 powers the SX1262 + PA module via LDO +#define SX126X_POWER_EN 40 + +// TX power offset for external PA (0 = no offset, full SX1262 power) +#define TX_GAIN_LORA 10 + +#ifdef USE_SX1262 +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_BUSY +#define SX126X_RESET LORA_RESET + +// RF switching configuration for 1W PA module +// DIO2 controls PA (via SX126X_DIO2_AS_RF_SWITCH) +// CTRL PIN (GPIO 21) controls LNA - must be HIGH during RX +// Truth table: DIO2=1,CTRL=0 → TX (PA on, LNA off) +// DIO2=0,CTRL=1 → RX (PA off, LNA on) +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_RXEN 21 // LNA enable - HIGH during RX + +// TCXO voltage - required for radio init +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + +#define SX126X_MAX_POWER 22 +#endif + +// LED +#define LED_PIN 18 +#define LED_STATE_ON 1 // HIGH = ON + +// Battery ADC +#define BATTERY_PIN 4 +#define ADC_CHANNEL ADC1_GPIO4_CHANNEL +#define BATTERY_SENSE_SAMPLES 30 +#define ADC_MULTIPLIER 2.9333 + +// NTC temperature sensor +#define NTC_PIN 14 + +// Fan control +#define FAN_CTRL_PIN 41 +// Meshtastic standard fan control pin macro +#define RF95_FAN_EN FAN_CTRL_PIN + +// PA Ramp Time - T-Beam 1W requires >800us stabilization (default is 200us) +// Value 0x05 = RADIOLIB_SX126X_PA_RAMP_800U +#define SX126X_PA_RAMP_US 0x05 + +// Display - SH1106 OLED (128x64) +#define USE_SH1106 +#define OLED_WIDTH 128 +#define OLED_HEIGHT 64 + +// 32768 Hz crystal present +#define HAS_32768HZ 1 diff --git a/variants/esp32s3/t-deck-pro/platformio.ini b/variants/esp32s3/t-deck-pro/platformio.ini index b97d7ac3f..28fef86ba 100644 --- a/variants/esp32s3/t-deck-pro/platformio.ini +++ b/variants/esp32s3/t-deck-pro/platformio.ini @@ -1,4 +1,15 @@ [env:t-deck-pro] +custom_meshtastic_hw_model = 102 +custom_meshtastic_hw_model_slug = T_DECK_PRO +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-Deck Pro +custom_meshtastic_images = tdeck_pro.svg +custom_meshtastic_tags = LilyGo +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = esp32s3_base board = t-deck-pro board_check = true diff --git a/variants/esp32s3/t-deck/platformio.ini b/variants/esp32s3/t-deck/platformio.ini index c8f3c8d5e..58335796a 100644 --- a/variants/esp32s3/t-deck/platformio.ini +++ b/variants/esp32s3/t-deck/platformio.ini @@ -1,5 +1,16 @@ ; LilyGo T-Deck [env:t-deck] +custom_meshtastic_hw_model = 50 +custom_meshtastic_hw_model_slug = T_DECK +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-Deck +custom_meshtastic_images = t-deck.svg +custom_meshtastic_tags = LilyGo +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = esp32s3_base board = t-deck board_check = true diff --git a/variants/esp32s3/t-watch-s3/platformio.ini b/variants/esp32s3/t-watch-s3/platformio.ini index 9785119b5..7d7b07ff6 100644 --- a/variants/esp32s3/t-watch-s3/platformio.ini +++ b/variants/esp32s3/t-watch-s3/platformio.ini @@ -1,5 +1,15 @@ ; LilyGo T-Watch S3 [env:t-watch-s3] +custom_meshtastic_hw_model = 51 +custom_meshtastic_hw_model_slug = T_WATCH_S3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = LILYGO T-Watch S3 +custom_meshtastic_images = t-watch-s3.svg +custom_meshtastic_tags = LilyGo +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = t-watch-s3 board_check = true diff --git a/variants/esp32s3/tbeam-s3-core/platformio.ini b/variants/esp32s3/tbeam-s3-core/platformio.ini index 5522e1d37..c0a32c49c 100644 --- a/variants/esp32s3/tbeam-s3-core/platformio.ini +++ b/variants/esp32s3/tbeam-s3-core/platformio.ini @@ -1,5 +1,16 @@ ; The 1.0 release of the LilyGo TBEAM-S3-Core board [env:tbeam-s3-core] +custom_meshtastic_hw_model = 12 +custom_meshtastic_hw_model_slug = LILYGO_TBEAM_S3_CORE +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-Beam Supreme +custom_meshtastic_images = tbeam-s3-core.svg +custom_meshtastic_tags = LilyGo +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = tbeam-s3-core board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/tlora-pager/platformio.ini b/variants/esp32s3/tlora-pager/platformio.ini index 98b9f51f5..3a7afb016 100644 --- a/variants/esp32s3/tlora-pager/platformio.ini +++ b/variants/esp32s3/tlora-pager/platformio.ini @@ -1,5 +1,16 @@ ; LilyGo T-Lora-Pager [env:tlora-pager] +custom_meshtastic_hw_model = 103 +custom_meshtastic_hw_model_slug = T_LORA_PAGER +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-LoRa Pager +custom_meshtastic_images = lilygo-tlora-pager.svg +custom_meshtastic_tags = LilyGo +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 16MB + extends = esp32s3_base board = t-deck-pro ; same as T-Deck Pro board_check = true diff --git a/variants/esp32s3/tlora_t3s3_epaper/platformio.ini b/variants/esp32s3/tlora_t3s3_epaper/platformio.ini index 18b9e136e..fdf3f7814 100644 --- a/variants/esp32s3/tlora_t3s3_epaper/platformio.ini +++ b/variants/esp32s3/tlora_t3s3_epaper/platformio.ini @@ -1,4 +1,14 @@ [env:tlora-t3s3-epaper] +custom_meshtastic_hw_model = 16 +custom_meshtastic_hw_model_slug = TLORA_T3_S3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-LoRa T3-S3 E-Ink +custom_meshtastic_images = tlora-t3s3-epaper.svg +custom_meshtastic_tags = LilyGo +custom_meshtastic_requires_dfu = true + extends = esp32s3_base board = tlora-t3s3-v1 board_check = true diff --git a/variants/esp32s3/tlora_t3s3_v1/platformio.ini b/variants/esp32s3/tlora_t3s3_v1/platformio.ini index 7a5e3df4b..95686e417 100644 --- a/variants/esp32s3/tlora_t3s3_v1/platformio.ini +++ b/variants/esp32s3/tlora_t3s3_v1/platformio.ini @@ -1,4 +1,14 @@ [env:tlora-t3s3-v1] +custom_meshtastic_hw_model = 16 +custom_meshtastic_hw_model_slug = TLORA_T3_S3 +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-LoRa T3-S3 +custom_meshtastic_images = tlora-t3s3-v1.svg +custom_meshtastic_tags = LilyGo +custom_meshtastic_requires_dfu = true + extends = esp32s3_base board = tlora-t3s3-v1 board_check = true diff --git a/variants/esp32s3/tracksenger/platformio.ini b/variants/esp32s3/tracksenger/platformio.ini index 73212c546..419a3539b 100644 --- a/variants/esp32s3/tracksenger/platformio.ini +++ b/variants/esp32s3/tracksenger/platformio.ini @@ -1,4 +1,13 @@ [env:tracksenger] +custom_meshtastic_hw_model = 48 +custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_TRACKER +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = TrackSenger (small TFT) +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_wireless_tracker board_build.partitions = default_8MB.csv @@ -16,6 +25,15 @@ lib_deps = lovyan03/LovyanGFX@1.2.7 [env:tracksenger-lcd] +custom_meshtastic_hw_model = 48 +custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_TRACKER +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = false +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = TrackSenger (big TFT) +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_wireless_tracker board_build.partitions = default_8MB.csv @@ -33,6 +51,14 @@ lib_deps = lovyan03/LovyanGFX@1.2.7 [env:tracksenger-oled] +custom_meshtastic_hw_model = 48 +custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_TRACKER +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = TrackSenger (big OLED) +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = heltec_wireless_tracker board_build.partitions = default_8MB.csv diff --git a/variants/esp32s3/unphone/platformio.ini b/variants/esp32s3/unphone/platformio.ini index 6c638af29..28be1f3e1 100644 --- a/variants/esp32s3/unphone/platformio.ini +++ b/variants/esp32s3/unphone/platformio.ini @@ -1,6 +1,15 @@ ; platformio.ini for unphone meshtastic [env:unphone] +custom_meshtastic_hw_model = 59 +custom_meshtastic_hw_model_slug = UNPHONE +custom_meshtastic_architecture = esp32-s3 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = unPhone +custom_meshtastic_requires_dfu = true +custom_meshtastic_partition_scheme = 8MB + extends = esp32s3_base board = unphone board_build.partitions = partition-table-8MB.csv diff --git a/variants/native/portduino.ini b/variants/native/portduino.ini index 76520091c..cc6c39aa2 100644 --- a/variants/native/portduino.ini +++ b/variants/native/portduino.ini @@ -34,6 +34,8 @@ lib_deps = adafruit/Adafruit seesaw Library@1.7.9 # renovate: datasource=git-refs depName=RAK12034-BMX160 packageName=https://github.com/RAKWireless/RAK12034-BMX160 gitBranch=main https://github.com/RAKWireless/RAK12034-BMX160/archive/dcead07ffa267d3c906e9ca4a1330ab989e957e2.zip + # renovate: datasource=custom.pio depName=adafruit/Adafruit BME680 Library packageName=adafruit/library/Adafruit BME680 + adafruit/Adafruit BME680 Library@^2.0.5 build_flags = ${arduino_base.build_flags} diff --git a/variants/nrf52840/ELECROW-ThinkNode-M1/platformio.ini b/variants/nrf52840/ELECROW-ThinkNode-M1/platformio.ini index 25f1b78b2..041d3b76f 100644 --- a/variants/nrf52840/ELECROW-ThinkNode-M1/platformio.ini +++ b/variants/nrf52840/ELECROW-ThinkNode-M1/platformio.ini @@ -1,5 +1,14 @@ ; First prototype eink/nrf52840/sx1262 device [env:thinknode_m1] +custom_meshtastic_hw_model = 89 +custom_meshtastic_hw_model_slug = THINKNODE_M1 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = ThinkNode M1 +custom_meshtastic_images = thinknode_m1.svg +custom_meshtastic_tags = Elecrow + extends = nrf52840_base board = ThinkNode-M1 board_check = true diff --git a/variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini b/variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini index 0ed46896f..bf9492075 100644 --- a/variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini +++ b/variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini @@ -1,8 +1,17 @@ [env:thinknode_m3] +custom_meshtastic_support_level = 1 +custom_meshtastic_images = thinknode_m3.svg +custom_meshtastic_tags = Elecrow + extends = nrf52840_base board = ThinkNode-M3 board_check = true debug_tool = jlink +custom_meshtastic_hw_model = 115 +custom_meshtastic_hw_model_slug = THINKNODE_M3 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_display_name = Elecrow ThinkNode M3 +custom_meshtastic_actively_supported = true build_flags = ${nrf52840_base.build_flags} -Ivariants/nrf52840/ELECROW-ThinkNode-M3 diff --git a/variants/nrf52840/ELECROW-ThinkNode-M6/platformio.ini b/variants/nrf52840/ELECROW-ThinkNode-M6/platformio.ini index 18108df83..413eb4fab 100644 --- a/variants/nrf52840/ELECROW-ThinkNode-M6/platformio.ini +++ b/variants/nrf52840/ELECROW-ThinkNode-M6/platformio.ini @@ -1,5 +1,14 @@ ; ThinkNode M6 - Outdoor Solar Power nrf52840/sx1262 device [env:thinknode_m6] +custom_meshtastic_hw_model = 120 +custom_meshtastic_hw_model_slug = THINKNODE_M6 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = false +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = ThinkNode M6 +custom_meshtastic_images = thinknode_m6.svg +custom_meshtastic_tags = Elecrow + extends = nrf52840_base board = ThinkNode-M6 board_check = true diff --git a/variants/nrf52840/canaryone/platformio.ini b/variants/nrf52840/canaryone/platformio.ini index 1be04c9aa..a2cf55972 100644 --- a/variants/nrf52840/canaryone/platformio.ini +++ b/variants/nrf52840/canaryone/platformio.ini @@ -1,5 +1,13 @@ ; Public Beta oled/nrf52840/sx1262 device [env:canaryone] +custom_meshtastic_hw_model = 29 +custom_meshtastic_hw_model_slug = CANARYONE +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Canary One +custom_meshtastic_tags = Canary + extends = nrf52840_base board = canaryone debug_tool = jlink diff --git a/variants/nrf52840/diy/nrf52_promicro_diy_tcxo/platformio.ini b/variants/nrf52840/diy/nrf52_promicro_diy_tcxo/platformio.ini index ca8f1777e..006f5c875 100644 --- a/variants/nrf52840/diy/nrf52_promicro_diy_tcxo/platformio.ini +++ b/variants/nrf52840/diy/nrf52_promicro_diy_tcxo/platformio.ini @@ -1,5 +1,15 @@ ; Promicro + E22(0)-xxxM / HT-RA62 modules board variant - DIY - with TCXO [env:nrf52_promicro_diy_tcxo] +custom_meshtastic_hw_model = 63 +custom_meshtastic_hw_model_slug = NRF52_PROMICRO_DIY +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = NRF52 Pro-micro DIY +custom_meshtastic_images = promicro.svg +custom_meshtastic_tags = DIY +custom_meshtastic_requires_dfu = true + extends = nrf52840_base board = promicro-nrf52840 build_flags = ${nrf52840_base.build_flags} diff --git a/variants/nrf52840/heltec_mesh_node_t114/platformio.ini b/variants/nrf52840/heltec_mesh_node_t114/platformio.ini index 7971e33c6..a39872205 100644 --- a/variants/nrf52840/heltec_mesh_node_t114/platformio.ini +++ b/variants/nrf52840/heltec_mesh_node_t114/platformio.ini @@ -1,5 +1,14 @@ ; First prototype nrf52840/sx1262 device [env:heltec-mesh-node-t114] +custom_meshtastic_hw_model = 69 +custom_meshtastic_hw_model_slug = HELTEC_MESH_NODE_T114 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec Mesh Node T114 +custom_meshtastic_images = heltec-mesh-node-t114.svg, heltec-mesh-node-t114-case.svg +custom_meshtastic_tags = Heltec + extends = nrf52840_base board = heltec_mesh_node_t114 board_level = pr diff --git a/variants/nrf52840/heltec_mesh_pocket/platformio.ini b/variants/nrf52840/heltec_mesh_pocket/platformio.ini index 4d3610fda..4dc8b78e7 100644 --- a/variants/nrf52840/heltec_mesh_pocket/platformio.ini +++ b/variants/nrf52840/heltec_mesh_pocket/platformio.ini @@ -1,8 +1,20 @@ ; First prototype nrf52840/sx1262 device [env:heltec-mesh-pocket-5000] +custom_meshtastic_support_level = 1 +custom_meshtastic_images = heltec_mesh_pocket.svg +custom_meshtastic_tags = Heltec + extends = nrf52840_base board = heltec_mesh_pocket debug_tool = jlink +custom_device_hw_model = 94 +custom_meshtastic_hw_model = 94 +custom_meshtastic_hw_model_slug = HELTEC_MESH_POCKET +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_display_name = Heltec Mesh Pocket +custom_meshtastic_actively_supported = true +custom_meshtastic_variant = 5000mAh +custom_meshtastic_key = heltec_mesh_pocket # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} @@ -31,6 +43,13 @@ lib_deps = [env:heltec-mesh-pocket-5000-inkhud] extends = nrf52840_base, inkhud board = heltec_mesh_pocket +custom_meshtastic_hw_model = 94 +custom_meshtastic_hw_model_slug = HELTEC_MESH_POCKET +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_display_name = Heltec Mesh Pocket +custom_meshtastic_actively_supported = true +custom_meshtastic_variant = 5000mAh InkHUD +custom_meshtastic_key = heltec_mesh_pocket build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/heltec_mesh_pocket> ${inkhud.build_src_filter} build_flags = ${inkhud.build_flags} @@ -45,9 +64,20 @@ lib_deps = ; First prototype nrf52840/sx1262 device [env:heltec-mesh-pocket-10000] +custom_meshtastic_support_level = 1 +custom_meshtastic_images = heltec_mesh_pocket.svg +custom_meshtastic_tags = Heltec + extends = nrf52840_base board = heltec_mesh_pocket debug_tool = jlink +custom_meshtastic_hw_model = 94 +custom_meshtastic_hw_model_slug = HELTEC_MESH_POCKET +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_display_name = Heltec Mesh Pocket +custom_meshtastic_actively_supported = true +custom_meshtastic_variant = 10000mAh +custom_meshtastic_key = heltec_mesh_pocket # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} @@ -76,6 +106,13 @@ lib_deps = [env:heltec-mesh-pocket-10000-inkhud] extends = nrf52840_base, inkhud board = heltec_mesh_pocket +custom_meshtastic_hw_model = 94 +custom_meshtastic_hw_model_slug = HELTEC_MESH_POCKET +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_display_name = Heltec Mesh Pocket +custom_meshtastic_actively_supported = true +custom_meshtastic_variant = 10000mAh InkHUD +custom_meshtastic_key = heltec_mesh_pocket build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/heltec_mesh_pocket> ${inkhud.build_src_filter} build_flags = ${inkhud.build_flags} diff --git a/variants/nrf52840/heltec_mesh_solar/platformio.ini b/variants/nrf52840/heltec_mesh_solar/platformio.ini index fa8965a64..2ad699544 100644 --- a/variants/nrf52840/heltec_mesh_solar/platformio.ini +++ b/variants/nrf52840/heltec_mesh_solar/platformio.ini @@ -19,6 +19,15 @@ lib_deps = bblanchon/ArduinoJson@6.21.4 [env:heltec-mesh-solar] +custom_meshtastic_hw_model = 108 +custom_meshtastic_hw_model_slug = HELTEC_MESH_SOLAR +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = false +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Heltec MeshSolar +custom_meshtastic_images = heltec-mesh-solar.svg +custom_meshtastic_tags = Heltec + extends = heltec_mesh_solar_base build_flags = ${heltec_mesh_solar_base.build_flags} -DSPI_INTERFACES_COUNT=1 diff --git a/variants/nrf52840/muzi_base/platformio.ini b/variants/nrf52840/muzi_base/platformio.ini index 29d93d1cd..52c558ff1 100644 --- a/variants/nrf52840/muzi_base/platformio.ini +++ b/variants/nrf52840/muzi_base/platformio.ini @@ -1,4 +1,13 @@ [env:muzi-base] +custom_meshtastic_hw_model = 93 +custom_meshtastic_hw_model_slug = MUZI_BASE +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = muzi BASE +custom_meshtastic_images = muzi_base.svg +custom_meshtastic_tags = muzi + extends = nrf52840_base board = muzi-base build_flags = ${nrf52840_base.build_flags} diff --git a/variants/nrf52840/nano-g2-ultra/platformio.ini b/variants/nrf52840/nano-g2-ultra/platformio.ini index 5952029fd..0748b7e38 100644 --- a/variants/nrf52840/nano-g2-ultra/platformio.ini +++ b/variants/nrf52840/nano-g2-ultra/platformio.ini @@ -1,5 +1,14 @@ ; First prototype eink/nrf52840/sx1262 device [env:nano-g2-ultra] +custom_meshtastic_hw_model = 18 +custom_meshtastic_hw_model_slug = NANO_G2_ULTRA +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 2 +custom_meshtastic_display_name = Nano G2 Ultra +custom_meshtastic_images = nano-g2-ultra.svg +custom_meshtastic_tags = B&Q + extends = nrf52840_base board = nano-g2-ultra debug_tool = jlink diff --git a/variants/nrf52840/r1-neo/platformio.ini b/variants/nrf52840/r1-neo/platformio.ini index af3cd052d..85fe49cf1 100644 --- a/variants/nrf52840/r1-neo/platformio.ini +++ b/variants/nrf52840/r1-neo/platformio.ini @@ -1,5 +1,14 @@ ; The R1 Neo board [env:r1-neo] +custom_meshtastic_hw_model = 101 +custom_meshtastic_hw_model_slug = MUZI_R1_NEO +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = muzi R1 Neo +custom_meshtastic_images = muzi_r1_neo.svg +custom_meshtastic_tags = muzi + extends = nrf52840_base board = r1-neo board_check = true diff --git a/variants/nrf52840/rak2560/platformio.ini b/variants/nrf52840/rak2560/platformio.ini index 21b3776f8..1703a13ae 100644 --- a/variants/nrf52840/rak2560/platformio.ini +++ b/variants/nrf52840/rak2560/platformio.ini @@ -1,5 +1,14 @@ ; Firmware for the WisMesh HUB RAK2560, including a onewire module to talk to the RAK 9154 solar battery. [env:rak2560] +custom_meshtastic_hw_model = 22 +custom_meshtastic_hw_model_slug = WISMESH_HUB +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = RAK WisMesh Repeater +custom_meshtastic_images = rak2560.svg +custom_meshtastic_tags = RAK + extends = nrf52840_base board = wiscore_rak4631 board_check = true diff --git a/variants/nrf52840/rak3401_1watt/platformio.ini b/variants/nrf52840/rak3401_1watt/platformio.ini index 268274b13..bb8fa28df 100644 --- a/variants/nrf52840/rak3401_1watt/platformio.ini +++ b/variants/nrf52840/rak3401_1watt/platformio.ini @@ -1,5 +1,15 @@ ; The very slick RAK wireless RAK 4631 / 4630 board - Unified firmware for 5005/19003, with or without OLED RAK 1921 [env:rak3401-1watt] +custom_meshtastic_hw_model = 117 +custom_meshtastic_hw_model_slug = RAK3401 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = RAK3401 1W +custom_meshtastic_images = rak3401.svg +custom_meshtastic_tags = RAK +custom_meshtastic_requires_dfu = true + extends = nrf52840_base board = wiscore_rak4631 board_check = true diff --git a/variants/nrf52840/rak4631/platformio.ini b/variants/nrf52840/rak4631/platformio.ini index ed30692be..4a96fc8d9 100644 --- a/variants/nrf52840/rak4631/platformio.ini +++ b/variants/nrf52840/rak4631/platformio.ini @@ -1,5 +1,14 @@ ; The very slick RAK wireless RAK 4631 / 4630 board - Unified firmware for 5005/19003, with or without OLED RAK 1921 [env:rak4631] +custom_meshtastic_hw_model = 9 +custom_meshtastic_hw_model_slug = RAK4631 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = RAK WisBlock 4631 +custom_meshtastic_images = rak4631.svg, rak4631_case.svg +custom_meshtastic_tags = RAK + extends = nrf52840_base board = wiscore_rak4631 board_level = pr diff --git a/variants/nrf52840/rak4631_nomadstar_meteor_pro/platformio.ini b/variants/nrf52840/rak4631_nomadstar_meteor_pro/platformio.ini index 500242c24..07d763df3 100644 --- a/variants/nrf52840/rak4631_nomadstar_meteor_pro/platformio.ini +++ b/variants/nrf52840/rak4631_nomadstar_meteor_pro/platformio.ini @@ -1,5 +1,14 @@ ; NomadStar Meteor Pro based on RAK4631 with RGBW LED LP5562 support [env:rak4631_nomadstar_meteor_pro] +custom_meshtastic_hw_model = 96 +custom_meshtastic_hw_model_slug = NOMADSTAR_METEOR_PRO +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = NomadStar Meteor Pro +custom_meshtastic_images = meteor_pro.svg +custom_meshtastic_tags = NomadStar + extends = nrf52840_base board = wiscore_rak4631 board_check = true diff --git a/variants/nrf52840/rak_wismeshtag/platformio.ini b/variants/nrf52840/rak_wismeshtag/platformio.ini index 1cc00e253..1e6e63e60 100644 --- a/variants/nrf52840/rak_wismeshtag/platformio.ini +++ b/variants/nrf52840/rak_wismeshtag/platformio.ini @@ -1,8 +1,17 @@ ; The very slick RAK wireless RAK 4631 / 4630 board - Unified firmware for 5005/19003, with or without OLED RAK 1921 [env:rak_wismeshtag] +custom_meshtastic_support_level = 1 +custom_meshtastic_images = rak_wismesh_tag.svg +custom_meshtastic_tags = RAK + extends = nrf52840_base board = wiscore_rak4631 board_check = true +custom_meshtastic_hw_model = 105 +custom_meshtastic_hw_model_slug = WISMESH_TAG +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_display_name = RAK WisMesh Tag +custom_meshtastic_actively_supported = true build_flags = ${nrf52840_base.build_flags} -I variants/nrf52840/rak_wismeshtag -D WISMESH_TAG diff --git a/variants/nrf52840/rak_wismeshtap/platformio.ini b/variants/nrf52840/rak_wismeshtap/platformio.ini index 485b7174f..f058d9153 100644 --- a/variants/nrf52840/rak_wismeshtap/platformio.ini +++ b/variants/nrf52840/rak_wismeshtap/platformio.ini @@ -1,5 +1,14 @@ ; The very slick RAK wireless RAK10701 Field Tester device. Note you will have to flash to Arduino bootloader to use this firmware. Be aware touch is not currently working. [env:rak_wismeshtap] +custom_meshtastic_hw_model = 84 +custom_meshtastic_hw_model_slug = WISMESH_TAP +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = RAK WisMesh Tap +custom_meshtastic_images = rak-wismeshtap.svg +custom_meshtastic_tags = RAK + extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} diff --git a/variants/nrf52840/seeed_solar_node/platformio.ini b/variants/nrf52840/seeed_solar_node/platformio.ini index 5a2518331..18894c049 100644 --- a/variants/nrf52840/seeed_solar_node/platformio.ini +++ b/variants/nrf52840/seeed_solar_node/platformio.ini @@ -1,4 +1,13 @@ [env:seeed_solar_node] +custom_meshtastic_hw_model = 95 +custom_meshtastic_hw_model_slug = SEEED_SOLAR_NODE +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Seeed SenseCAP Solar Node +custom_meshtastic_images = seeed_solar.svg +custom_meshtastic_tags = Seeed + board = seeed_solar_node extends = nrf52840_base ;board_level = extra diff --git a/variants/nrf52840/seeed_wio_tracker_L1/platformio.ini b/variants/nrf52840/seeed_wio_tracker_L1/platformio.ini index d11ad0ab9..d5b56b7bf 100644 --- a/variants/nrf52840/seeed_wio_tracker_L1/platformio.ini +++ b/variants/nrf52840/seeed_wio_tracker_L1/platformio.ini @@ -1,4 +1,14 @@ [env:seeed_wio_tracker_L1] +custom_meshtastic_hw_model = 99 +custom_meshtastic_hw_model_slug = SEEED_WIO_TRACKER_L1 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Seeed Wio Tracker L1 +custom_meshtastic_images = wio_tracker_l1_case.svg +custom_meshtastic_tags = Seeed +custom_meshtastic_requires_dfu = true + board = seeed_wio_tracker_L1 extends = nrf52840_base build_flags = ${nrf52840_base.build_flags} diff --git a/variants/nrf52840/seeed_wio_tracker_L1_eink/platformio.ini b/variants/nrf52840/seeed_wio_tracker_L1_eink/platformio.ini index 3007a8c7b..6b36a79c3 100644 --- a/variants/nrf52840/seeed_wio_tracker_L1_eink/platformio.ini +++ b/variants/nrf52840/seeed_wio_tracker_L1_eink/platformio.ini @@ -1,4 +1,13 @@ [env:seeed_wio_tracker_L1_eink] +custom_meshtastic_hw_model = 100 +custom_meshtastic_hw_model_slug = SEEED_WIO_TRACKER_L1_EINK +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Seeed Wio Tracker L1 E-Ink +custom_meshtastic_images = wio_tracker_l1_eink.svg +custom_meshtastic_tags = Seeed + board = seeed_wio_tracker_L1 extends = nrf52840_base ;board_level = extra diff --git a/variants/nrf52840/seeed_xiao_nrf52840_kit/platformio.ini b/variants/nrf52840/seeed_xiao_nrf52840_kit/platformio.ini index 079cd5c52..68be47622 100644 --- a/variants/nrf52840/seeed_xiao_nrf52840_kit/platformio.ini +++ b/variants/nrf52840/seeed_xiao_nrf52840_kit/platformio.ini @@ -1,5 +1,14 @@ ; Seeed Xiao BLE: https://wiki.seeedstudio.com/XIAO_BLE/ [env:seeed_xiao_nrf52840_kit] +custom_meshtastic_hw_model = 88 +custom_meshtastic_hw_model_slug = XIAO_NRF52_KIT +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = Seeed Xiao NRF52840 Kit +custom_meshtastic_images = seeed_xiao_nrf52_kit.svg +custom_meshtastic_tags = Seeed + extends = nrf52840_base board = xiao_ble_sense board_level = pr diff --git a/variants/nrf52840/t-echo-lite/platformio.ini b/variants/nrf52840/t-echo-lite/platformio.ini index 217b76a2d..c873dea37 100644 --- a/variants/nrf52840/t-echo-lite/platformio.ini +++ b/variants/nrf52840/t-echo-lite/platformio.ini @@ -1,5 +1,14 @@ ; Using original screen class [env:t-echo-lite] +custom_meshtastic_hw_model = 109 +custom_meshtastic_hw_model_slug = T_ECHO_LITE +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = false +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-Echo Lite +custom_meshtastic_images = techo_lite.svg +custom_meshtastic_tags = LilyGo + extends = nrf52840_base board = t-echo board_check = true diff --git a/variants/nrf52840/t-echo/platformio.ini b/variants/nrf52840/t-echo/platformio.ini index 4244419b7..a8fc027c8 100644 --- a/variants/nrf52840/t-echo/platformio.ini +++ b/variants/nrf52840/t-echo/platformio.ini @@ -1,5 +1,14 @@ ; Using original screen class [env:t-echo] +custom_meshtastic_hw_model = 7 +custom_meshtastic_hw_model_slug = T_ECHO +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 1 +custom_meshtastic_display_name = LILYGO T-Echo +custom_meshtastic_images = t-echo.svg +custom_meshtastic_tags = LilyGo + extends = nrf52840_base board = t-echo board_level = pr diff --git a/variants/nrf52840/tracker-t1000-e/platformio.ini b/variants/nrf52840/tracker-t1000-e/platformio.ini index 86d74f68a..43ba7a8b4 100644 --- a/variants/nrf52840/tracker-t1000-e/platformio.ini +++ b/variants/nrf52840/tracker-t1000-e/platformio.ini @@ -1,7 +1,16 @@ [env:tracker-t1000-e] +custom_meshtastic_support_level = 1 +custom_meshtastic_images = tracker-t1000-e.svg +custom_meshtastic_tags = Seeed + extends = nrf52840_base board = tracker-t1000-e board_level = pr +custom_meshtastic_hw_model = 71 +custom_meshtastic_hw_model_slug = TRACKER_T1000_E +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_display_name = Seeed SenseCAP T1000-E +custom_meshtastic_actively_supported = true build_flags = ${nrf52840_base.build_flags} -Ivariants/nrf52840/tracker-t1000-e -Isrc/platform/nrf52/softdevice diff --git a/variants/nrf52840/wio-tracker-wm1110/platformio.ini b/variants/nrf52840/wio-tracker-wm1110/platformio.ini index b3513a242..515712062 100644 --- a/variants/nrf52840/wio-tracker-wm1110/platformio.ini +++ b/variants/nrf52840/wio-tracker-wm1110/platformio.ini @@ -1,5 +1,15 @@ ; The red tracker Dev Board with the WM1110 module [env:wio-tracker-wm1110] +custom_meshtastic_hw_model = 21 +custom_meshtastic_hw_model_slug = WIO_WM1110 +custom_meshtastic_architecture = nrf52840 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Seeed Wio WM1110 Tracker +custom_meshtastic_images = wio-tracker-wm1110.svg +custom_meshtastic_tags = Seeed +custom_meshtastic_requires_dfu = true + extends = nrf52840_base board = wio-tracker-wm1110 build_flags = ${nrf52840_base.build_flags} diff --git a/variants/rp2040/rak11310/platformio.ini b/variants/rp2040/rak11310/platformio.ini index 3234d3b99..2c2b2a4bf 100644 --- a/variants/rp2040/rak11310/platformio.ini +++ b/variants/rp2040/rak11310/platformio.ini @@ -1,4 +1,14 @@ [env:rak11310] +custom_meshtastic_hw_model = 26 +custom_meshtastic_hw_model_slug = RAK11310 +custom_meshtastic_architecture = rp2040 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 2 +custom_meshtastic_display_name = RAK WisBlock 11310 +custom_meshtastic_images = rak11310.svg +custom_meshtastic_tags = RAK +custom_meshtastic_requires_dfu = true + extends = rp2040_base board = rakwireless_rak11300 board_level = pr diff --git a/variants/rp2040/rp2040-lora/platformio.ini b/variants/rp2040/rp2040-lora/platformio.ini index a85869260..f1e0b9af6 100644 --- a/variants/rp2040/rp2040-lora/platformio.ini +++ b/variants/rp2040/rp2040-lora/platformio.ini @@ -1,4 +1,13 @@ [env:rp2040-lora] +custom_meshtastic_hw_model = 30 +custom_meshtastic_hw_model_slug = RP2040_LORA +custom_meshtastic_architecture = rp2040 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 2 +custom_meshtastic_display_name = RP2040 LoRa +custom_meshtastic_tags = Waveshare +custom_meshtastic_requires_dfu = true + extends = rp2040_base board = rpipico upload_protocol = picotool diff --git a/variants/rp2040/rpipico/platformio.ini b/variants/rp2040/rpipico/platformio.ini index 953aee625..4ae134b28 100644 --- a/variants/rp2040/rpipico/platformio.ini +++ b/variants/rp2040/rpipico/platformio.ini @@ -1,4 +1,14 @@ [env:pico] +custom_meshtastic_hw_model = 47 +custom_meshtastic_hw_model_slug = RPI_PICO +custom_meshtastic_architecture = rp2040 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Raspberry Pi Pico +custom_meshtastic_images = pico.svg +custom_meshtastic_tags = RPi, DIY +custom_meshtastic_requires_dfu = true + extends = rp2040_base board = rpipico board_level = pr diff --git a/variants/rp2040/rpipicow/platformio.ini b/variants/rp2040/rpipicow/platformio.ini index 00b7b1f01..99e02a1aa 100644 --- a/variants/rp2040/rpipicow/platformio.ini +++ b/variants/rp2040/rpipicow/platformio.ini @@ -1,4 +1,14 @@ [env:picow] +custom_meshtastic_hw_model = 47 +custom_meshtastic_hw_model_slug = RPI_PICO +custom_meshtastic_architecture = rp2040 +custom_meshtastic_actively_supported = true +custom_meshtastic_support_level = 3 +custom_meshtastic_display_name = Raspberry Pi Pico W +custom_meshtastic_images = rpipicow.svg +custom_meshtastic_tags = RPi, DIY +custom_meshtastic_requires_dfu = true + extends = rp2040_base board = rpipicow board_level = pr diff --git a/version.properties b/version.properties index 8e40687e9..0a028eff0 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 7 -build = 17 +build = 18