diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 16e8686..a5f06c1 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -84,6 +84,14 @@ #include #include static RAK4631Board board; +#elif defined(HELTEC_T114) + #include + #include + static T114Board board; +#elif defined(LILYGO_TECHO) + #include + #include + static TechoBoard board; #else #error "need to provide a 'board' object" #endif @@ -165,7 +173,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks { return oldest; } - int handleRequest(ClientInfo* sender, uint8_t* payload, size_t payload_len) { + int handleRequest(ClientInfo* sender, uint8_t* payload, size_t payload_len) { uint32_t now = getRTCClock()->getCurrentTimeUnique(); memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp @@ -226,7 +234,7 @@ protected: return !_prefs.disable_fwd; } - const char* getLogDateTime() override { + const char* getLogDateTime() override { static char tmp[32]; uint32_t now = getRTCClock()->getCurrentTime(); DateTime dt = DateTime(now); @@ -258,7 +266,7 @@ protected: File f = openAppend(PACKET_LOG_FILE); if (f) { f.print(getLogDateTime()); - f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)", + f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)", len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len); if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ @@ -276,7 +284,7 @@ protected: File f = openAppend(PACKET_LOG_FILE); if (f) { f.print(getLogDateTime()); - f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n", + f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n", len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len); f.close(); } @@ -318,7 +326,7 @@ protected: auto client = putClient(sender); // add to known clients (if not already known) if (timestamp <= client->last_timestamp) { MESH_DEBUG_PRINTLN("Possible login replay attack!"); - return; // FATAL: client table is full -OR- replay attack + return; // FATAL: client table is full -OR- replay attack } MESH_DEBUG_PRINTLN("Login success!"); @@ -389,7 +397,7 @@ protected: uint32_t timestamp; memcpy(×tamp, data, 4); - if (timestamp > client->last_timestamp) { // prevent replay attacks + if (timestamp > client->last_timestamp) { // prevent replay attacks int reply_len = handleRequest(client, &data[4], len - 4); if (reply_len == 0) return; // invalid command @@ -421,7 +429,7 @@ protected: if (!(flags == TXT_TYPE_PLAIN || flags == TXT_TYPE_CLI_DATA)) { MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported text type received: flags=%02x", (uint32_t)flags); - } else if (sender_timestamp >= client->last_timestamp) { // prevent replay attacks + } else if (sender_timestamp >= client->last_timestamp) { // prevent replay attacks bool is_retry = (sender_timestamp == client->last_timestamp); client->last_timestamp = sender_timestamp; client->last_activity = getRTCClock()->getCurrentTime(); @@ -626,7 +634,7 @@ SimpleMeshTables tables; #ifdef ESP32 ESP32RTCClock fallback_clock; #else -VolatileRTCClock fallback_clock; +VolatileRTCClock fallback_clock; #endif AutoDiscoverRTCClock rtc_clock(fallback_clock); @@ -653,7 +661,7 @@ void setup() { #else float tcxo = 1.6f; #endif - + #ifdef DISPLAY_CLASS display.begin(); #endif @@ -722,7 +730,7 @@ void loop() { int len = strlen(command); while (Serial.available() && len < sizeof(command)-1) { char c = Serial.read(); - if (c != '\n') { + if (c != '\n') { command[len++] = c; command[len] = 0; } diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble.h b/lib/nrf52/include/ble.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble.h rename to lib/nrf52/include/ble.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_err.h b/lib/nrf52/include/ble_err.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_err.h rename to lib/nrf52/include/ble_err.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gap.h b/lib/nrf52/include/ble_gap.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gap.h rename to lib/nrf52/include/ble_gap.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gatt.h b/lib/nrf52/include/ble_gatt.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gatt.h rename to lib/nrf52/include/ble_gatt.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gattc.h b/lib/nrf52/include/ble_gattc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gattc.h rename to lib/nrf52/include/ble_gattc.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gatts.h b/lib/nrf52/include/ble_gatts.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_gatts.h rename to lib/nrf52/include/ble_gatts.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_hci.h b/lib/nrf52/include/ble_hci.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_hci.h rename to lib/nrf52/include/ble_hci.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_l2cap.h b/lib/nrf52/include/ble_l2cap.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_l2cap.h rename to lib/nrf52/include/ble_l2cap.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_ranges.h b/lib/nrf52/include/ble_ranges.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_ranges.h rename to lib/nrf52/include/ble_ranges.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_types.h b/lib/nrf52/include/ble_types.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/ble_types.h rename to lib/nrf52/include/ble_types.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf52/nrf_mbr.h b/lib/nrf52/include/nrf52/nrf_mbr.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf52/nrf_mbr.h rename to lib/nrf52/include/nrf52/nrf_mbr.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_error.h b/lib/nrf52/include/nrf_error.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_error.h rename to lib/nrf52/include/nrf_error.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_error_sdm.h b/lib/nrf52/include/nrf_error_sdm.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_error_sdm.h rename to lib/nrf52/include/nrf_error_sdm.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_error_soc.h b/lib/nrf52/include/nrf_error_soc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_error_soc.h rename to lib/nrf52/include/nrf_error_soc.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_nvic.h b/lib/nrf52/include/nrf_nvic.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_nvic.h rename to lib/nrf52/include/nrf_nvic.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_sdm.h b/lib/nrf52/include/nrf_sdm.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_sdm.h rename to lib/nrf52/include/nrf_sdm.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_soc.h b/lib/nrf52/include/nrf_soc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_soc.h rename to lib/nrf52/include/nrf_soc.h diff --git a/src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_svc.h b/lib/nrf52/include/nrf_svc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf_svc.h rename to lib/nrf52/include/nrf_svc.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_err.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_err.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_err.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_err.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gap.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gap.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gap.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gap.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gatt.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gatt.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gatt.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gatt.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gattc.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gattc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gattc.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gattc.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gatts.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gatts.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_gatts.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_gatts.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_hci.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_hci.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_hci.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_hci.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_l2cap.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_l2cap.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_l2cap.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_l2cap.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_ranges.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_ranges.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_ranges.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_ranges.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_types.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/ble_types.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/ble_types.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/ble_types.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf52/nrf_mbr.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52/nrf_mbr.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf52/nrf_mbr.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52/nrf_mbr.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_error.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_error.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_error.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_error.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_sdm.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_sdm.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_sdm.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_sdm.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_soc.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_soc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_soc.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_error_soc.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_nvic.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_nvic.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_nvic.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_nvic.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_sdm.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_sdm.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_sdm.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_sdm.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_soc.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_soc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_soc.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_soc.h diff --git a/src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_svc.h b/lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_svc.h similarity index 100% rename from src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf_svc.h rename to lib/nrf52/s140_nrf52_7.3.0_API/include/nrf_svc.h diff --git a/platformio.ini b/platformio.ini index 8281f2f..631e78e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -628,8 +628,8 @@ extends = nrf52_base platform_packages = framework-arduinoadafruitnrf52 build_flags = ${nrf52_base.build_flags} -I src/helpers/nrf52 - -I src/helpers/nrf52/s140_nrf52_7.3.0_API/include - -I src/helpers/nrf52/s140_nrf52_7.3.0_API/include/nrf52 + -I lib/nrf52/s140_nrf52_7.3.0_API/include + -I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52 lib_ignore = BluetoothOTA lvgl @@ -675,8 +675,8 @@ extends = nrf52_base platform_packages = framework-arduinoadafruitnrf52 build_flags = ${nrf52_base.build_flags} -I src/helpers/nrf52 - -I src/helpers/nrf52/s140_nrf52_6.1.1_API/include - -I src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf52 + -I lib/nrf52/s140_nrf52_6.1.1_API/include + -I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52 lib_deps = ${nrf52_base.lib_deps} rweather/Crypto @ ^0.4.0 @@ -699,6 +699,18 @@ build_src_filter = ${nrf52840_t114.build_src_filter} debug_tool = jlink upload_protocol = nrfutil +[env:Heltec_t114_repeater] +extends = Heltec_t114 +build_src_filter = ${Heltec_t114.build_src_filter} +<../examples/simple_repeater/main.cpp> +build_flags = + ${Heltec_t114.build_flags} + -D ADVERT_NAME="\"Heltec_T114 Repeater\"" + -D ADVERT_LAT=-37.0 + -D ADVERT_LON=145.0 + -D ADMIN_PASSWORD="\"password\"" +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 + [env:Heltec_t114_companion_radio_ble] extends = Heltec_t114 build_flags = @@ -721,8 +733,8 @@ extends = nrf52_base platform_packages = framework-arduinoadafruitnrf52 build_flags = ${nrf52_base.build_flags} -I src/helpers/nrf52 - -I src/helpers/nrf52/s140_nrf52_6.1.1_API/include - -I src/helpers/nrf52/s140_nrf52_6.1.1_API/include/nrf52 + -I lib/nrf52/s140_nrf52_6.1.1_API/include + -I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52 lib_deps = ${nrf52_base.lib_deps} rweather/Crypto @ ^0.4.0 @@ -745,6 +757,18 @@ build_src_filter = ${nrf52840_techo.build_src_filter} debug_tool = jlink upload_protocol = nrfutil +[env:LilyGo_T-Echo_repeater] +extends = LilyGo_Techo +build_src_filter = ${LilyGo_Techo.build_src_filter} +<../examples/simple_repeater/main.cpp> +build_flags = + ${LilyGo_Techo.build_flags} + -D ADVERT_NAME="\"T-Echo Repeater\"" + -D ADVERT_LAT=-37.0 + -D ADVERT_LON=145.0 + -D ADMIN_PASSWORD="\"password\"" +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 + [env:LilyGo_T-Echo_companion_radio_ble] extends = LilyGo_Techo build_flags =