From 901cc536efbe9d1419062b9c3613388513721480 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sat, 29 Aug 2020 15:17:32 -0700 Subject: [PATCH 1/5] less logspam --- src/nimble/BluetoothUtil.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nimble/BluetoothUtil.cpp b/src/nimble/BluetoothUtil.cpp index efc378d0..490bc13d 100644 --- a/src/nimble/BluetoothUtil.cpp +++ b/src/nimble/BluetoothUtil.cpp @@ -330,7 +330,7 @@ static void on_sync(void) int isPrivate = 0; rc = ble_hs_id_copy_addr(own_addr_type, addr_val, &isPrivate); assert(rc == 0); - DEBUG_MSG("Addr type %d, Private=%d, Device Address: ", own_addr_type, isPrivate); + DEBUG_MSG("BLE advertisting type=%d, Private=%d, Device Address: ", own_addr_type, isPrivate); print_addr(addr_val); DEBUG_MSG("\n"); /* Begin advertising. */ @@ -357,17 +357,17 @@ void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg) break; case BLE_GATT_REGISTER_OP_CHR: - DEBUG_MSG("registering characteristic %s with " + /* DEBUG_MSG("registering characteristic %s with " "def_handle=%d val_handle=%d\n", - ble_uuid_to_str(ctxt->chr.chr_def->uuid, buf), ctxt->chr.def_handle, ctxt->chr.val_handle); + ble_uuid_to_str(ctxt->chr.chr_def->uuid, buf), ctxt->chr.def_handle, ctxt->chr.val_handle); */ if (ctxt->chr.chr_def->uuid == &fromnum_uuid.u) { fromNumValHandle = ctxt->chr.val_handle; - DEBUG_MSG("FromNum handle %d\n", fromNumValHandle); + // DEBUG_MSG("FromNum handle %d\n", fromNumValHandle); } if (ctxt->chr.chr_def->uuid == &update_result_uuid.u) { updateResultHandle = ctxt->chr.val_handle; - DEBUG_MSG("update result handle %d\n", updateResultHandle); + // DEBUG_MSG("update result handle %d\n", updateResultHandle); } break; From 8dc4492ba3f574aba3a5c925203344e7068e9c09 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 30 Aug 2020 12:20:43 -0700 Subject: [PATCH 2/5] add taiwan frequencies --- src/mesh/MeshRadio.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mesh/MeshRadio.h b/src/mesh/MeshRadio.h index 3d41d23c..5b3a27b9 100644 --- a/src/mesh/MeshRadio.h +++ b/src/mesh/MeshRadio.h @@ -26,11 +26,16 @@ #define CH_SPACING_CN 2.0f // MHz FIXME, this is just a guess for 470-510 #define NUM_CHANNELS_CN 20 -// JP channel settings -#define CH0_JP 920.0f // MHz -#define CH_SPACING_JP 0.5f // MHz FIXME, this is just a guess for 920-925 +// JP channel settings (AS1 bandplan) +#define CH0_JP 920.0f // MHz +#define CH_SPACING_JP 0.5f #define NUM_CHANNELS_JP 10 +// TW channel settings (AS2 bandplan 923-925MHz) +#define CH0_TW 923.0f // MHz +#define CH_SPACING_TW 0.2 +#define NUM_CHANNELS_TW 10 + // FIXME add defs for other regions and use them here #ifdef HW_VERSION_US #define CH0 CH0_US @@ -49,13 +54,18 @@ #define CH_SPACING CH_SPACING_CN #define NUM_CHANNELS NUM_CHANNELS_CN #elif defined(HW_VERSION_JP) +// Also called AS1 bandplan #define CH0 CH0_JP #define CH_SPACING CH_SPACING_JP #define NUM_CHANNELS NUM_CHANNELS_JP +#elif defined(HW_VERSION_TW) +// Also called AS2 bandplan +#define CH0 CH0_TW +#define CH_SPACING CH_SPACING_TW +#define NUM_CHANNELS NUM_CHANNELS_TW #else // HW version not set - assume US #define CH0 CH0_US #define CH_SPACING CH_SPACING_US #define NUM_CHANNELS NUM_CHANNELS_US #endif - From c370eb4a888658cf674935ec9080e650c872c6df Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 30 Aug 2020 12:21:05 -0700 Subject: [PATCH 3/5] allow restarting failed upgrades (fixes an android autobug report) --- src/esp32/BluetoothSoftwareUpdate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/esp32/BluetoothSoftwareUpdate.cpp b/src/esp32/BluetoothSoftwareUpdate.cpp index ea1a50ef..9bc7445a 100644 --- a/src/esp32/BluetoothSoftwareUpdate.cpp +++ b/src/esp32/BluetoothSoftwareUpdate.cpp @@ -31,6 +31,8 @@ int update_size_callback(uint16_t conn_handle, uint16_t attr_handle, struct ble_ if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR && updateExpectedSize != 0) { updateActualSize = 0; crc.reset(); + if (Update.isRunning()) + Update.abort(); bool canBegin = Update.begin(updateExpectedSize); DEBUG_MSG("Setting update size %u, result %d\n", updateExpectedSize, canBegin); if (!canBegin) { From 6cdaf8c6009ce72b2819f33e2ac700178f078154 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 30 Aug 2020 12:38:15 -0700 Subject: [PATCH 4/5] fix #349 channel suffix letter didn't match between device and phone --- src/mesh/NodeDB.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 1b7a1cd8..93d0787d 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -86,7 +86,7 @@ const char *getChannelName() static char buf[32]; uint8_t code = 0; - for (int i = 0; i < sizeof(channelSettings.psk.size); i++) + for (int i = 0; i < channelSettings.psk.size; i++) code ^= channelSettings.psk.bytes[i]; snprintf(buf, sizeof(buf), "#%s-%c", channelSettings.name, 'A' + (code % 26)); @@ -121,7 +121,7 @@ void NodeDB::resetRadioConfig() channelSettings.modem_config = ChannelSettings_ModemConfig_Bw125Cr48Sf4096; // slow and long range channelSettings.tx_power = 0; // default - memcpy(&channelSettings.psk.bytes, &defaultpsk, sizeof(channelSettings.psk)); + memcpy(&channelSettings.psk.bytes, defaultpsk, sizeof(channelSettings.psk)); channelSettings.psk.size = sizeof(defaultpsk); strcpy(channelSettings.name, "Default"); } From 347484baaf0014697dde3c0f0a905921c3c3fafd Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 30 Aug 2020 14:38:23 -0700 Subject: [PATCH 5/5] 0.9.5 --- bin/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/version.sh b/bin/version.sh index 00e26542..388402b6 100644 --- a/bin/version.sh +++ b/bin/version.sh @@ -1,3 +1,3 @@ -export VERSION=0.9.3 \ No newline at end of file +export VERSION=0.9.5 \ No newline at end of file