Skip to content

feat(lora+gps): Add components for gps, sx126x lora radio. Add preliminary meshtastic component (ai-generated), and update bsps to start testing#678

Open
finger563 wants to merge 1 commit into
mainfrom
feat/gps-lora-meshtastic
Open

feat(lora+gps): Add components for gps, sx126x lora radio. Add preliminary meshtastic component (ai-generated), and update bsps to start testing#678
finger563 wants to merge 1 commit into
mainfrom
feat/gps-lora-meshtastic

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Description

Motivation and Context

How has this been tested?

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

Hardware

  • I have updated the design files (schematic, board, libraries).
  • I have attached the PDFs of the SCH / BRD to this PR
  • I have updated the design output (GERBER, BOM) files.

…eliminary meshtastic component (ai-generated), and update bsps to start testing
Copilot AI review requested due to automatic review settings July 27, 2026 01:19
@github-actions

Copy link
Copy Markdown

⚡ Static analysis result ⚡

🔴 cppcheck found 6 issues! Click here to see details.

for (auto seen : seen_packets_) {
if (seen == key) {
return true;
}
}
seen_packets_.push_back(key);

!Line: 58 - style: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]

hash = ((hash << 5) + hash) + c; // hash * 33 + c
}
return hash;
}
uint8_t xor_hash(std::span<const uint8_t> data) {

!Line: 60 - style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]

hash ^= b;
}
return hash;
}
uint8_t channel_hash(std::string_view channel_name, std::span<const uint8_t> psk) {

!Line: 68 - style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]

int text_count = 0;
auto last_nodeinfo = std::chrono::steady_clock::now();
while (true) {
#if CONFIG_EXAMPLE_TEXT_INTERVAL_S > 0
std::this_thread::sleep_for(std::chrono::seconds(CONFIG_EXAMPLE_TEXT_INTERVAL_S));
std::string message = "hello from " + std::string(CONFIG_EXAMPLE_SHORT_NAME) + " #" +

!Line: 135 - style: Variable 'text_count' is assigned a value that is never used. [unreadVariable]

out.push_back((b >= 0x20 && b < 0x7f) ? static_cast<char>(b) : '.');
}
return out;
}
static void play_click(espp::TDeck &tdeck) {

!Line: 606 - style: Consider using std::transform algorithm instead of a raw loop. [useStlAlgorithm]

out.push_back((b >= 0x20 && b < 0x7f) ? static_cast<char>(b) : '.');
}
return out;
}
// Synthesize a short fading sine beep and queue it on the speaker

!Line: 58 - style: Consider using std::transform algorithm instead of a raw loop. [useStlAlgorithm]


Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “wireless” documentation section and introduces new gps, sx126x (LoRa radio), and preliminary meshtastic components, then wires LoRa/GPS support into the LilyGo T-Deck and M5Stack Cardputer-Adv BSPs and examples so they can be built/tested in CI.

Changes:

  • Add new components: gps (UART NMEA GNSS), sx126x (SX1261/2/LLCC68 LoRa driver), meshtastic (radio-agnostic Meshtastic-compatible node + example).
  • Update BSPs/examples (t-deck, m5stack-cardputer) to initialize and demonstrate LoRa + GPS (plus shared-bus handling on the Cardputer Cap).
  • Update docs (new doc/en/wireless/*) and CI/component publishing lists to include the new components and examples.

Reviewed changes

Copilot reviewed 68 out of 68 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
doc/en/wireless/index.rst Introduces the “Wireless & Radio APIs” doc section and links new wireless component pages.
doc/en/wireless/sx126x.rst Adds SX126x component documentation entry and API include hooks.
doc/en/wireless/gps.rst Adds GPS component documentation entry and API include hooks.
doc/en/wireless/meshtastic.rst Adds Meshtastic component documentation entry and API include hooks.
doc/en/index.rst Adds the wireless docs section to the top-level docs index.
doc/Doxyfile Adds new components’ headers/examples to Doxygen inputs/example paths.
components/sx126x/CMakeLists.txt Registers the sx126x component build.
components/sx126x/include/sx126x.hpp Defines the public SX126x driver API/types/config.
components/sx126x/src/sx126x.cpp Implements the SX126x driver (SPI command layer + LoRa modem support).
components/sx126x/README.md Adds SX126x component overview and feature list.
components/sx126x/idf_component.yml Adds SX126x component manager metadata (deps/tags/docs link).
components/sx126x/example/CMakeLists.txt Adds SX126x example project configuration.
components/sx126x/example/sdkconfig.defaults Adds SX126x example default sdkconfig.
components/sx126x/example/README.md Adds SX126x example usage documentation.
components/sx126x/example/main/CMakeLists.txt Registers the SX126x example “main” component.
components/sx126x/example/main/Kconfig.projbuild Adds SX126x example menuconfig options (hardware/pins/frequency/etc.).
components/sx126x/example/main/sx126x_example.cpp Adds SX126x example app (bring-up + RX + periodic TX ping).
components/gps/CMakeLists.txt Registers the gps component build.
components/gps/include/gps.hpp Defines the UART-attached GPS driver public API.
components/gps/include/nmea_parser.hpp Defines the platform-independent NMEA parser API.
components/gps/include/gps_fix.hpp Defines the parsed fix struct and timestamp conversion helper.
components/gps/src/gps.cpp Implements the UART driver + background read/parsing task.
components/gps/src/nmea_parser.cpp Implements NMEA parsing/checksum and fix extraction.
components/gps/README.md Adds GPS component overview and capabilities.
components/gps/idf_component.yml Adds GPS component manager metadata (deps/tags/docs link).
components/gps/example/CMakeLists.txt Adds GPS example project configuration.
components/gps/example/sdkconfig.defaults Adds GPS example default sdkconfig.
components/gps/example/README.md Adds GPS example usage documentation.
components/gps/example/main/CMakeLists.txt Registers the GPS example “main” component.
components/gps/example/main/Kconfig.projbuild Adds GPS example menuconfig options (hardware/pins/baud).
components/gps/example/main/gps_example.cpp Adds GPS example app (print fixes).
components/meshtastic/CMakeLists.txt Registers the meshtastic component build.
components/meshtastic/include/meshtastic.hpp Defines MeshtasticNode public API/config/callbacks.
components/meshtastic/include/meshtastic_types.hpp Adds protocol constants and message structs.
components/meshtastic/include/meshtastic_protocol.hpp Declares channel hashing/modem config/header pack/unpack helpers.
components/meshtastic/include/meshtastic_crypto.hpp Declares PSK expansion and AES-CTR payload crypt helpers.
components/meshtastic/include/meshtastic_protobuf.hpp Declares minimal protobuf encode/decode helpers for used messages.
components/meshtastic/src/meshtastic.cpp Implements node behavior (send/receive/dedup/rebroadcast).
components/meshtastic/src/meshtastic_protocol.cpp Implements region/preset-based modem config + header pack/unpack + hashes.
components/meshtastic/src/meshtastic_crypto.cpp Implements PSK expansion and AES-CTR crypt via mbedtls.
components/meshtastic/src/meshtastic_protobuf.cpp Implements minimal protobuf wire-format encode/decode for required messages.
components/meshtastic/README.md Adds Meshtastic component overview/scope/licensing notes.
components/meshtastic/idf_component.yml Adds Meshtastic component manager metadata (deps/tags/docs link).
components/meshtastic/example/CMakeLists.txt Adds Meshtastic example project configuration.
components/meshtastic/example/sdkconfig.defaults Adds Meshtastic example default sdkconfig.
components/meshtastic/example/README.md Adds Meshtastic example usage documentation.
components/meshtastic/example/main/CMakeLists.txt Registers the Meshtastic example “main” component.
components/meshtastic/example/main/Kconfig.projbuild Adds Meshtastic example menuconfig options (hardware/region/intervals/etc.).
components/meshtastic/example/main/meshtastic_example.cpp Adds Meshtastic node example using BSP-provided SX1262 radio.
components/t-deck/CMakeLists.txt Adds gps/sx126x to T-Deck component requirements.
components/t-deck/idf_component.yml Adds gps/sx126x dependencies to the T-Deck component manifest.
components/t-deck/include/t-deck.hpp Adds LoRa + GPS APIs/pins/state to the T-Deck BSP.
components/t-deck/src/lora.cpp Implements T-Deck LoRa + GPS initialization.
components/t-deck/example/README.md Updates T-Deck example docs to include LoRa demo behavior.
components/t-deck/example/main/t_deck_example.cpp Adds LoRa tab/demo wiring and non-blocking TX dispatch via main loop.
components/t-deck/example/main/gui.hpp Extends T-Deck example GUI API to support a LoRa tab and logging.
components/t-deck/example/main/gui.cpp Implements the new LoRa tab UI and thread-safe message/status updates.
components/m5stack-cardputer/CMakeLists.txt Adds gps/sx126x to Cardputer component requirements.
components/m5stack-cardputer/idf_component.yml Adds gps/sx126x dependencies to the Cardputer component manifest.
components/m5stack-cardputer/include/m5stack-cardputer.hpp Adds LoRa+GPS Cap APIs/pins/state and new helper methods.
components/m5stack-cardputer/src/lora_gps_cap.cpp Implements LoRa+GPS Cap SPI-bus bring-up and LoRa/GPS initialization.
components/m5stack-cardputer/src/sdcard.cpp Adjusts SD init to reuse the shared expansion SPI bus when LoRa is present.
components/m5stack-cardputer/example/README.md Updates Cardputer example docs for new tabbed UI + LoRa/GPS features.
components/m5stack-cardputer/example/main/m5stack_cardputer_example.cpp Wires LoRa+GPS demos into the example and updates tab/shortcut behavior.
components/m5stack-cardputer/example/main/gui.hpp Refactors Cardputer GUI into tabbed layout with LoRa/GPS/Sys tabs.
components/m5stack-cardputer/example/main/gui.cpp Implements tabbed UI, LoRa log/status rendering, and new per-tab helpers.
.github/workflows/build.yml Adds gps/meshtastic/sx126x examples to CI build matrix.
.github/workflows/upload_components.yml Adds gps/meshtastic/sx126x to component upload list.

Comment on lines +1 to +4
#include <chrono>
#include <cstring>
#include <string>
#include <vector>
Comment on lines +1 to +3
#include <chrono>
#include <memory>
#include <string>
Comment on lines +47 to +54
uint32_t MeshtasticNode::next_packet_id() {
// packet ids must be nonzero and non-repeating; seed from the hardware RNG
uint32_t id = esp_random();
if (id == 0) {
id = 1;
}
return id;
}
Comment on lines +28 to +34
// expand the PSK and compute the channel hash
key_ = expand_psk(config_.psk);
resolved_channel_name_ =
config_.channel_name.empty() ? preset_display_name(config_.preset) : config_.channel_name;
// the channel hash uses the expanded key; for an unencrypted channel the
// PSK contribution is empty
channel_hash_ = channel_hash(resolved_channel_name_, key_);
Comment on lines +692 to +693
// NOTE: the reset line is shared with the digital microphone clock
// (dmic_clk_io), so the radio and microphone are mutually exclusive
Comment on lines +83 to +84
// connect the antenna (via the Cap's IO expander, if present)
enable_cap_expander_outputs(cap_expander_lora_rf_switch_mask);
Comment on lines +14 to +16
.. toctree::

sx126x_example
Comment thread doc/en/wireless/gps.rst
Comment on lines +14 to +16
.. toctree::

gps_example
Comment on lines +22 to +24
.. toctree::

meshtastic_example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants