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 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) { 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 - 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"); } 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;