diff --git a/binaries/AP_FW_1.54.bin b/binaries/AP_FW_1.54.bin index dcc86d33..57257267 100644 Binary files a/binaries/AP_FW_1.54.bin and b/binaries/AP_FW_1.54.bin differ diff --git a/binaries/AP_FW_Nodisplay.bin b/binaries/AP_FW_Nodisplay.bin index 10213230..f6f38c6f 100644 Binary files a/binaries/AP_FW_Nodisplay.bin and b/binaries/AP_FW_Nodisplay.bin differ diff --git a/binaries/AP_FW_Segmented_UK.bin b/binaries/AP_FW_Segmented_UK.bin index 8dd0effd..351b2682 100644 Binary files a/binaries/AP_FW_Segmented_UK.bin and b/binaries/AP_FW_Segmented_UK.bin differ diff --git a/binaries/Tag_FW_1.54.bin b/binaries/Tag_FW_1.54.bin index d003d251..58548752 100644 Binary files a/binaries/Tag_FW_1.54.bin and b/binaries/Tag_FW_1.54.bin differ diff --git a/binaries/Tag_FW_2.9-uc8151.bin b/binaries/Tag_FW_2.9-uc8151.bin index a8ac2c83..e26a025a 100644 Binary files a/binaries/Tag_FW_2.9-uc8151.bin and b/binaries/Tag_FW_2.9-uc8151.bin differ diff --git a/binaries/Tag_FW_2.9.bin b/binaries/Tag_FW_2.9.bin index 7e10e273..58adde62 100644 Binary files a/binaries/Tag_FW_2.9.bin and b/binaries/Tag_FW_2.9.bin differ diff --git a/binaries/Tag_FW_4.2.bin b/binaries/Tag_FW_4.2.bin index 254ec5fb..84616106 100644 Binary files a/binaries/Tag_FW_4.2.bin and b/binaries/Tag_FW_4.2.bin differ diff --git a/zbs243_Tag_FW/builder.php b/zbs243_Tag_FW/builder.php index 21af91eb..d93607f6 100644 --- a/zbs243_Tag_FW/builder.php +++ b/zbs243_Tag_FW/builder.php @@ -23,7 +23,7 @@ $stackdisturbed = false; $mem = checkmem(); while(1){ $errlist = array(); - exec("make BUILD=zbs154v033 CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist); + exec("make BUILD=zbs29v033 CPU=8051 SOC=zbs243 2>&1 | grep error | grep -v make", $errlist); if(checkmem()!=$mem){ $stackdisturbed = true; echo "Stack size was $mem, is now ".checkmem()." !!!\n"; diff --git a/zbs243_Tag_FW/main.c b/zbs243_Tag_FW/main.c old mode 100644 new mode 100755 index 364c4216..35344236 --- a/zbs243_Tag_FW/main.c +++ b/zbs243_Tag_FW/main.c @@ -90,28 +90,25 @@ void displayLoop() { } uint8_t showChannelSelect() { // returns 0 if no accesspoints were found - uint8_t __xdata result[16]; + uint8_t __xdata result[sizeof(channelList)]; memset(result, 0, sizeof(result)); showScanningWindow(); + drawNoWait(); powerUp(INIT_RADIO); - for (uint8_t i = 0; i < 5; i++) { - for (uint8_t c = 11; c < 27; c++) { - if (detectAP(c)) { - if (mLastLqi > result[c - 11]) result[c - 11] = mLastLqi; - pr("Channel: %d - LQI: %d RSSI %d\n", c, mLastLqi, mLastRSSI); + for (uint8_t i = 0; i < 4; i++) { + for (uint8_t c = 0; c < sizeof(channelList); c++) { + if (detectAP(channelList[c])) { + if (mLastLqi > result[c]) result[c] = mLastLqi; + pr("Channel: %d - LQI: %d RSSI %d\n", channelList[c], mLastLqi, mLastRSSI); } } - epdWaitRdy(); - for (uint8_t c = 0; c < 16; c++) { - addScanResult(11 + c, result[c]); - } - drawNoWait(); } + uint8_t __xdata highestLqi = 0; uint8_t __xdata highestSlot = 0; for (uint8_t c = 0; c < sizeof(result); c++) { if (result[c] > highestLqi) { - highestSlot = c + 11; + highestSlot = channelList[c]; highestLqi = result[c]; } } @@ -123,18 +120,20 @@ uint8_t showChannelSelect() { // returns 0 if no accesspoints were found uint8_t channelSelect() { // returns 0 if no accesspoints were found uint8_t __xdata result[16]; memset(result, 0, sizeof(result)); + for (uint8_t i = 0; i < 2; i++) { - for (uint8_t c = 11; c < 27; c++) { - if (detectAP(c)) { - if (mLastLqi > result[c - 11]) result[c - 11] = mLastLqi; + for (uint8_t c = 0; c < sizeof(channelList); c++) { + if (detectAP(channelList[c])) { + if (mLastLqi > result[c]) result[c] = mLastLqi; } } } + uint8_t __xdata highestLqi = 0; uint8_t __xdata highestSlot = 0; for (uint8_t c = 0; c < sizeof(result); c++) { if (result[c] > highestLqi) { - highestSlot = c + 11; + highestSlot = channelList[c]; highestLqi = result[c]; } } diff --git a/zbs243_Tag_FW/userinterface.c b/zbs243_Tag_FW/userinterface.c old mode 100644 new mode 100755 index 863e8c44..8cb586c0 --- a/zbs243_Tag_FW/userinterface.c +++ b/zbs243_Tag_FW/userinterface.c @@ -210,9 +210,9 @@ void showScanningWindow() { epdPrintBegin(2, 275, EPD_DIRECTION_Y, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK); epdpr("Scanning for APs"); epdPrintEnd(); - epdPrintBegin(40, 262, EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_RED); - epdpr("Channel - Quality"); - epdPrintEnd(); + //epdPrintBegin(40, 262, EPD_DIRECTION_Y, EPD_SIZE_SINGLE, EPD_COLOR_RED); + //epdpr("Channel - Quality"); + //epdPrintEnd(); loadRawBitmap(receive, 36, 24, EPD_COLOR_BLACK); #endif #if (SCREEN_WIDTH == 152) // 1.54" @@ -226,9 +226,9 @@ void showScanningWindow() { epdpr("Scanning for APs"); epdPrintEnd(); - epdPrintBegin(2, 40, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_RED); - epdpr("Channel - Quality"); - epdPrintEnd(); + //epdPrintBegin(2, 40, EPD_DIRECTION_X, EPD_SIZE_SINGLE, EPD_COLOR_RED); + //epdpr("Channel - Quality"); + //epdPrintEnd(); loadRawBitmap(receive, 320, 125, EPD_COLOR_BLACK); #endif diff --git a/zbs243_shared/soc/radioCommon.h b/zbs243_shared/soc/radioCommon.h old mode 100644 new mode 100755 index 99937234..4fa1f8e1 --- a/zbs243_shared/soc/radioCommon.h +++ b/zbs243_shared/soc/radioCommon.h @@ -7,7 +7,7 @@ //radio cfg #define RADIO_FIRST_CHANNEL (11) //2.4-GHz channels start at 11 -#define RADIO_NUM_CHANNELS (15) +#define RADIO_NUM_CHANNELS (16) #define RADIO_MAX_PACKET_LEN (125) //useful payload, not including the crc diff --git a/zbs243_shared/soc/zbs243/radio.c b/zbs243_shared/soc/zbs243/radio.c old mode 100644 new mode 100755 index 802f2561..6d04c02f --- a/zbs243_shared/soc/zbs243/radio.c +++ b/zbs243_shared/soc/zbs243/radio.c @@ -13,6 +13,8 @@ static volatile uint8_t __xdata mRxBufs[RX_BUFFER_NUM][RX_BUFFER_SIZE]; static volatile uint8_t __xdata mLastRSSI, mLastTxedSeq, mRxOn, mRxBufNextR, mRxBufNextW, mRxBufNumFree; static volatile __bit mAckTimePassed, mGotAck; +const uint8_t __code channelList[6] = {11, 15, 20, 25, 26, 27}; + // some things look like: https://www.ti.com/lit/ds/symlink/cc2430.pdf // maybe a licensed and heavily modified version? @@ -30,7 +32,6 @@ void RF_IRQ1(void) __interrupt(4) { // radio will report ACK if we (1) got an ack or (2) sent a packet that did not require it mAckTimePassed = true; mGotAck = !!(cause & 0x10); - } if (cause & 0x20) { // radio has RXed a packet into its internal buffer. vet it quickly and set up DMA @@ -144,11 +145,11 @@ bool radioTx(const void __xdata *packetP) // waits for tx end CFGPAGE = bkp; - //RADIO_unk_C8 = 0xff; /// stock fw does this but seems unnecessary + // RADIO_unk_C8 = 0xff; /// stock fw does this but seems unnecessary // wait for tx to start wait = 0; - wait--; + wait--; do { if (RADIO_curRfState & 0x80) break; @@ -158,12 +159,12 @@ bool radioTx(const void __xdata *packetP) // waits for tx end if (wait) { while (!mAckTimePassed) ; - return true; + return true; } else { - return false; - } + return false; + } - //RADIO_unk_C8 = 0x7f; /// stock fw does this but seems unnecessary + // RADIO_unk_C8 = 0x7f; /// stock fw does this but seems unnecessary } void radioRxAckReset(void) { @@ -212,13 +213,10 @@ void radioSetTxPower(int8_t dBm) { } void radioSetChannel(uint8_t ch) { - static const uint8_t perChannelSetting1[] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x33, 0x33}; - static const uint8_t perChannelSetting2[] = {4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2}; + static const uint8_t perChannelSetting1[] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33}; + static const uint8_t perChannelSetting2[] = {4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2}; - if (ch < RADIO_FIRST_CHANNEL || ch >= RADIO_FIRST_CHANNEL + RADIO_NUM_CHANNELS) - return; - - RADIO_channel = ch; // configmed to be at least RX channel + RADIO_channel = ch; // confirmed to be at least RX channel RADIO_command = RADIO_CMD_RECEIVE; RADIO_perChannelSetting1 = perChannelSetting1[ch - 11]; RADIO_perChannelSetting2 = perChannelSetting2[ch - 11]; diff --git a/zbs243_shared/soc/zbs243/radio.h b/zbs243_shared/soc/zbs243/radio.h old mode 100644 new mode 100755 index d5922781..2e48aa6e --- a/zbs243_shared/soc/zbs243/radio.h +++ b/zbs243_shared/soc/zbs243/radio.h @@ -9,14 +9,8 @@ void RF_IRQ1(void) __interrupt (4); void RF_IRQ2(void) __interrupt (5); #define RADIO_PAD_LEN_BY 2 +extern uint8_t __code channelList[6]; + #include "../radioCommon.h" - - - - -#endif - - - - +#endif \ No newline at end of file