portapack-mayhem/firmware/baseband/proc_btlerx.cpp

387 lines
12 KiB
C++
Raw Normal View History

/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
* Copyright (C) 2020 Shao
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
* Copyright (C) 2023 TJ Baginski
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "proc_btlerx.hpp"
#include "portapack_shared_memory.hpp"
#include "event_m4.hpp"
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
uint32_t BTLERxProcessor::crc_init_reorder(uint32_t crc_init) {
int i;
uint32_t crc_init_tmp, crc_init_input, crc_init_input_tmp;
crc_init_input_tmp = crc_init;
crc_init_input = 0;
crc_init_input = crc_init_input_tmp & 0xFF;
crc_init_input_tmp = (crc_init_input_tmp >> 8);
crc_init_input = ((crc_init_input << 8) | (crc_init_input_tmp & 0xFF));
crc_init_input_tmp = (crc_init_input_tmp >> 8);
crc_init_input = ((crc_init_input << 8) | (crc_init_input_tmp & 0xFF));
crc_init_input = (crc_init_input << 1);
crc_init_tmp = 0;
for (i = 0; i < 24; i++) {
crc_init_input = (crc_init_input >> 1);
crc_init_tmp = ((crc_init_tmp << 1) | (crc_init_input & 0x01));
}
return (crc_init_tmp);
}
uint_fast32_t BTLERxProcessor::crc_update(uint_fast32_t crc, const void* data, size_t data_len) {
const unsigned char* d = (const unsigned char*)data;
unsigned int tbl_idx;
while (data_len--) {
tbl_idx = (crc ^ *d) & 0xff;
crc = (crc_table[tbl_idx] ^ (crc >> 8)) & 0xffffff;
d++;
}
return crc & 0xffffff;
}
uint_fast32_t BTLERxProcessor::crc24_byte(uint8_t* byte_in, int num_byte, uint32_t init_hex) {
uint_fast32_t crc = init_hex;
crc = crc_update(crc, byte_in, num_byte);
return (crc);
}
bool BTLERxProcessor::crc_check(uint8_t* tmp_byte, int body_len, uint32_t crc_init) {
int crc24_checksum;
crc24_checksum = crc24_byte(tmp_byte, body_len, crc_init); // 0x555555 --> 0xaaaaaa. maybe because byte order
checksumReceived = 0;
checksumReceived = ((checksumReceived << 8) | tmp_byte[body_len + 2]);
checksumReceived = ((checksumReceived << 8) | tmp_byte[body_len + 1]);
checksumReceived = ((checksumReceived << 8) | tmp_byte[body_len + 0]);
return (crc24_checksum != checksumReceived);
}
void BTLERxProcessor::scramble_byte(uint8_t* byte_in, int num_byte, const uint8_t* scramble_table_byte, uint8_t* byte_out) {
int i;
for (i = 0; i < num_byte; i++) {
byte_out[i] = byte_in[i] ^ scramble_table_byte[i];
}
}
int BTLERxProcessor::verify_payload_byte(int num_payload_byte, ADV_PDU_TYPE pdu_type) {
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
// Should at least have 6 bytes for the MAC Address.
// Also ensuring that there is at least 1 byte of data.
if (num_payload_byte <= 6) {
// printf("Error: Payload Too Short (only %d bytes)!\n", num_payload_byte);
return -1;
}
if (pdu_type == ADV_IND || pdu_type == ADV_NONCONN_IND || pdu_type == SCAN_RSP || pdu_type == ADV_SCAN_IND) {
return 0;
} else if (pdu_type == ADV_DIRECT_IND || pdu_type == SCAN_REQ) {
if (num_payload_byte != 12) {
// printf("Error: Payload length %d bytes. Need to be 12 for PDU Type %s!\n", num_payload_byte, ADV_PDU_TYPE_STR[pdu_type]);
return -1;
}
} else if (pdu_type == CONNECT_REQ) {
if (num_payload_byte != 34) {
// printf("Error: Payload length %d bytes. Need to be 34 for PDU Type %s!\n", num_payload_byte, ADV_PDU_TYPE_STR[pdu_type]);
return -1;
}
} else {
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
return -1;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
return 0;
}
void BTLERxProcessor::handleBeginState() {
int num_symbol_left = dst_buffer.count / SAMPLE_PER_SYMBOL; // One buffer sample consist of I and Q.
static uint8_t demod_buf_access[SAMPLE_PER_SYMBOL][LEN_DEMOD_BUF_ACCESS];
uint32_t uint32_tmp = DEFAULT_ACCESS_ADDR;
uint8_t accessAddrBits[LEN_DEMOD_BUF_ACCESS];
uint32_t accesssAddress = 0;
// Filling up addressBits with the access address we are looking to find.
for (int i = 0; i < 32; i++) {
accessAddrBits[i] = 0x01 & uint32_tmp;
uint32_tmp = (uint32_tmp >> 1);
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
const int demod_buf_len = LEN_DEMOD_BUF_ACCESS; // For AA
int demod_buf_offset = 0;
int hit_idx = (-1);
bool unequal_flag = false;
memset(demod_buf_access, 0, SAMPLE_PER_SYMBOL * demod_buf_len);
for (int i = 0; i < num_symbol_left * SAMPLE_PER_SYMBOL; i += SAMPLE_PER_SYMBOL) {
int sp = ((demod_buf_offset - demod_buf_len + 1) & (demod_buf_len - 1));
for (int j = 0; j < SAMPLE_PER_SYMBOL; j++) {
// Sample and compare with the adjacent next sample.
int I0 = dst_buffer.p[i + j].real();
int Q0 = dst_buffer.p[i + j].imag();
int I1 = dst_buffer.p[i + j + 1].real();
int Q1 = dst_buffer.p[i + j + 1].imag();
int phase_idx = j;
demod_buf_access[phase_idx][demod_buf_offset] = (I0 * Q1 - I1 * Q0) > 0 ? 1 : 0;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
int k = sp;
unequal_flag = false;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
accesssAddress = 0;
for (int p = 0; p < demod_buf_len; p++) {
if (demod_buf_access[phase_idx][k] != accessAddrBits[p]) {
unequal_flag = true;
hit_idx = (-1);
break;
}
accesssAddress = (accesssAddress & (~(1 << p))) | (demod_buf_access[phase_idx][k] << p);
k = ((k + 1) & (demod_buf_len - 1));
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
}
if (unequal_flag == false) {
hit_idx = (i + j - (demod_buf_len - 1) * SAMPLE_PER_SYMBOL);
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
break;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
}
if (unequal_flag == false) {
break;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
demod_buf_offset = ((demod_buf_offset + 1) & (demod_buf_len - 1));
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
if (hit_idx == -1) {
// Process more samples.
return;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
symbols_eaten += hit_idx;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
symbols_eaten += (8 * NUM_ACCESS_ADDR_BYTE * SAMPLE_PER_SYMBOL); // move to the beginning of PDU header
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
num_symbol_left = num_symbol_left - symbols_eaten;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
parseState = Parse_State_PDU_Header;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
void BTLERxProcessor::handlePDUHeaderState() {
int num_demod_byte = 2; // PDU header has 2 octets
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
symbols_eaten += 8 * num_demod_byte * SAMPLE_PER_SYMBOL;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
if (symbols_eaten > (int)dst_buffer.count) {
return;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
// Jump back down to the beginning of PDU header.
sample_idx = symbols_eaten - (8 * num_demod_byte * SAMPLE_PER_SYMBOL);
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
packet_index = 0;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
for (int i = 0; i < num_demod_byte; i++) {
rb_buf[packet_index] = 0;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
for (int j = 0; j < 8; j++) {
int I0 = dst_buffer.p[sample_idx].real();
int Q0 = dst_buffer.p[sample_idx].imag();
int I1 = dst_buffer.p[sample_idx + 1].real();
int Q1 = dst_buffer.p[sample_idx + 1].imag();
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
bit_decision = (I0 * Q1 - I1 * Q0) > 0 ? 1 : 0;
rb_buf[packet_index] = rb_buf[packet_index] | (bit_decision << j);
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
sample_idx += SAMPLE_PER_SYMBOL;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
packet_index++;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
scramble_byte(rb_buf, num_demod_byte, scramble_table[channel_number], rb_buf);
pdu_type = (ADV_PDU_TYPE)(rb_buf[0] & 0x0F);
// uint8_t tx_add = ((rb_buf[0] & 0x40) != 0);
// uint8_t rx_add = ((rb_buf[0] & 0x80) != 0);
payload_len = (rb_buf[1] & 0x3F);
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
// Not a valid Advertise Payload.
if ((payload_len < 6) || (payload_len > 37)) {
parseState = Parse_State_Begin;
return;
} else {
parseState = Parse_State_PDU_Payload;
}
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
void BTLERxProcessor::handlePDUPayloadState() {
int i;
int num_demod_byte = (payload_len + 3);
symbols_eaten += 8 * num_demod_byte * SAMPLE_PER_SYMBOL;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
if (symbols_eaten > (int)dst_buffer.count) {
return;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
}
for (i = 0; i < num_demod_byte; i++) {
rb_buf[packet_index] = 0;
for (int j = 0; j < 8; j++) {
int I0 = dst_buffer.p[sample_idx].real();
int Q0 = dst_buffer.p[sample_idx].imag();
int I1 = dst_buffer.p[sample_idx + 1].real();
int Q1 = dst_buffer.p[sample_idx + 1].imag();
bit_decision = (I0 * Q1 - I1 * Q0) > 0 ? 1 : 0;
rb_buf[packet_index] = rb_buf[packet_index] | (bit_decision << j);
sample_idx += SAMPLE_PER_SYMBOL;
}
packet_index++;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
scramble_byte(rb_buf + 2, num_demod_byte, scramble_table[channel_number] + 2, rb_buf + 2);
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
// Check CRC
bool crc_flag = crc_check(rb_buf, payload_len + 2, crc_init_internal);
// pkt_count++;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
// This should be the flag that determines if the data should be sent to the application layer.
bool sendPacket = false;
// Checking CRC and excluding Reserved PDU types.
if (pdu_type < RESERVED0 && !crc_flag) {
if (verify_payload_byte(payload_len, (ADV_PDU_TYPE)pdu_type) == 0) {
sendPacket = true;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
}
// TODO: Make this a packet builder function?
if (sendPacket) {
blePacketData.max_dB = max_dB;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
blePacketData.type = pdu_type;
blePacketData.size = payload_len;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
blePacketData.macAddress[0] = rb_buf[7];
blePacketData.macAddress[1] = rb_buf[6];
blePacketData.macAddress[2] = rb_buf[5];
blePacketData.macAddress[3] = rb_buf[4];
blePacketData.macAddress[4] = rb_buf[3];
blePacketData.macAddress[5] = rb_buf[2];
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
// Skip Header Byte and MAC Address
uint8_t startIndex = 8;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
for (i = 0; i < payload_len - 6; i++) {
blePacketData.data[i] = rb_buf[startIndex++];
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
blePacketData.dataLen = i;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
BLEPacketMessage data_message{&blePacketData};
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
shared_memory.application_queue.push(data_message);
}
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
parseState = Parse_State_Begin;
}
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
void BTLERxProcessor::execute(const buffer_c8_t& buffer) {
if (!configured) return;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
// Pulled this implementation from channel_stats_collector.c to time slice a specific packet's dB.
uint32_t max_squared = 0;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
void* src_p = buffer.p;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
while (src_p < &buffer.p[buffer.count]) {
const uint32_t sample = *__SIMD32(src_p)++;
const uint32_t mag_sq = __SMUAD(sample, sample);
if (mag_sq > max_squared) {
max_squared = mag_sq;
}
}
const float max_squared_f = max_squared;
max_dB = mag2_to_dbv_norm(max_squared_f * (1.0f / (32768.0f * 32768.0f)));
// 4Mhz 2048 samples
// Decimated by 4 to achieve 2048/4 = 512 samples at 1 sample per symbol.
decim_0.execute(buffer, dst_buffer);
feed_channel_stats(dst_buffer);
symbols_eaten = 0;
// Handle parsing based on parseState
if (parseState == Parse_State_Begin) {
handleBeginState();
}
if (parseState == Parse_State_PDU_Header) {
handlePDUHeaderState();
}
if (parseState == Parse_State_PDU_Payload) {
handlePDUPayloadState();
}
}
void BTLERxProcessor::on_message(const Message* const message) {
if (message->id == Message::ID::BTLERxConfigure)
configure(*reinterpret_cast<const BTLERxConfigureMessage*>(message));
}
void BTLERxProcessor::configure(const BTLERxConfigureMessage& message) {
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
channel_number = message.channel_number;
decim_0.configure(taps_BTLE_1M_PHY_decim_0.taps);
configured = true;
New and Improved BLE App. (#1524) * First BLE work * Adding new fsk proc WIP * Reverting ble stuff * Initial compile working * more work. * Adding waterfall for debug * more edits to debug * Work to get widgets to show. * cleanup before attempting diff fsk modulation method * Temporary debug to learn how decimation scales. * Tab view for console and spectrum. Spectrum still not working right. * Fixed spectrum offset. * Added audio sampling rate increments to freqman * Added overriding range for frequency field and working off deviation * BLE cleanup. Got PDU parsing. * Parsing CRC * forgot : * Removing AA again because cluttering UI * fix compile * attempt at throttling. * WIP changes. * Decimating by 4 to handle issue with overloading. * Attempt to parse MAC still needs work. * Small fixes. MAC still wrong. * Fixed invalid indexing on Symbols. * List view of BLE Mac Addresses * Added Channel Option and improved GUI header. * renaming to dB and fixing some warnings. * Advertisements only. * Initial cut of BLE Advertisement scan app. * Copyrights * formatting correctly in association to clang13 * Fixing warning and hiding fsk rx. * spacing * Removing some cmake install files that weren't suppose to be there. * missed some. * Added name to about. * Edits for PR review pt.1 * Refactor ORing with 0 doesn't make sense. * remove parenthesis * More PR Review changes. * Fix compiler error. * PR Review edits. * PR review changes. * Fixes. * Unneeded ; * Update ui_about_simple.cpp --------- Co-authored-by: jLynx <admin@jlynx.net>
2023-10-23 01:58:14 -04:00
crc_init_internal = crc_init_reorder(crc_initalVale);
}
int main() {
EventDispatcher event_dispatcher{std::make_unique<BTLERxProcessor>()};
event_dispatcher.run();
return 0;
}