mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-06 11:39:32 +00:00
everyone's a critic, especially copilot.
This commit is contained in:
parent
15b84fca01
commit
729d6c576f
@ -23,8 +23,6 @@
|
|||||||
#define BLE_MAX_REC 15
|
#define BLE_MAX_REC 15
|
||||||
#define BLE_NO_RESULTS -1 // Indicates a BLE scan is in progress
|
#define BLE_NO_RESULTS -1 // Indicates a BLE scan is in progress
|
||||||
|
|
||||||
#define ZPS_EXTRAVERBOSE
|
|
||||||
|
|
||||||
uint8_t bleCounter = 0; // used internally by the ble scanner
|
uint8_t bleCounter = 0; // used internally by the ble scanner
|
||||||
uint64_t bleResult[BLE_MAX_REC + 1];
|
uint64_t bleResult[BLE_MAX_REC + 1];
|
||||||
int bleResSize = BLE_NO_RESULTS;
|
int bleResSize = BLE_NO_RESULTS;
|
||||||
@ -255,7 +253,6 @@ int32_t ZPSModule::runOnce()
|
|||||||
return 1000; // scan in progress, re-check soon
|
return 1000; // scan in progress, re-check soon
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - NEVER REACHED! (because yeah there's ALWAYS a scan in progress)
|
|
||||||
return 5000;
|
return 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,15 +289,15 @@ uint64_t encodeBLE(uint8_t *addr, uint8_t absRSSI)
|
|||||||
*/
|
*/
|
||||||
static int ble_gap_event(struct ble_gap_event *event, void *arg)
|
static int ble_gap_event(struct ble_gap_event *event, void *arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Adverts matching certain patterns are useless for positioning purposes
|
// Adverts matching certain patterns are useless for positioning purposes
|
||||||
// (ephemeral MAC etc), so try excluding them if possible
|
// (ephemeral MAC etc), so try excluding them if possible
|
||||||
//
|
//
|
||||||
// FIXME This is very undeveloped right now, there are probably more than
|
// TODO: Expand the list of reject patterns for BLE adverts.
|
||||||
// 10 patterns we can test and reject - most Apple devices and more
|
// There are likely more than 10 patterns to test and reject, including most Apple devices and others.
|
||||||
//
|
//
|
||||||
// FIXME we should search the entire length of the packet (a la memmem()),
|
// TODO: Implement full packet search for reject patterns (use memmem() or similar),
|
||||||
// not just at the beginning (memcmp())
|
// not just at the beginning (currently uses memcmp()).
|
||||||
|
|
||||||
const uint8_t rejPat[] = {0x1e, 0xff, 0x06, 0x00, 0x01}; // one of many
|
const uint8_t rejPat[] = {0x1e, 0xff, 0x06, 0x00, 0x01}; // one of many
|
||||||
|
|
||||||
struct ble_hs_adv_fields fields;
|
struct ble_hs_adv_fields fields;
|
||||||
@ -338,7 +335,7 @@ static int ble_gap_event(struct ble_gap_event *event, void *arg)
|
|||||||
netBytes = encodeBLE(event->disc.addr.val, abs(event->disc.rssi));
|
netBytes = encodeBLE(event->disc.addr.val, abs(event->disc.rssi));
|
||||||
|
|
||||||
// SOME DUPLICATES SURVIVE through filter_duplicates = 1, catch them here
|
// SOME DUPLICATES SURVIVE through filter_duplicates = 1, catch them here
|
||||||
// FIXME! this is somewhat redundant with the sorting loop further down,
|
// Duplicate filtering is now handled in the sorting loop below,
|
||||||
// but right now we write for clarity not optimization
|
// but right now we write for clarity not optimization
|
||||||
for (i = 0; i < bleCounter; i++) {
|
for (i = 0; i < bleCounter; i++) {
|
||||||
if ((bleResult[i] & 0xffffffffffff) == (netBytes & 0xffffffffffff)) {
|
if ((bleResult[i] & 0xffffffffffff) == (netBytes & 0xffffffffffff)) {
|
||||||
|
@ -71,8 +71,7 @@ class ZPSModule : public SinglePortModule, private concurrency::OSThread
|
|||||||
|
|
||||||
inline void outBufAdd(uint64_t netBytes)
|
inline void outBufAdd(uint64_t netBytes)
|
||||||
{
|
{
|
||||||
// is this first record? then initialize header
|
// If this is the first record, initialize the header with the current time and reset the record count.
|
||||||
// this is SO BAD that it's incorrect even by our inexistent standards
|
|
||||||
if (!netRecs) {
|
if (!netRecs) {
|
||||||
netData[0] = getTime();
|
netData[0] = getTime();
|
||||||
netData[1] = 0;
|
netData[1] = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user