diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-16 19:25:06 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-16 19:53:49 +0200 |
commit | 40910f9bac151bfd4ffbf06f1e80fdc7660dd827 (patch) | |
tree | 305014f99d7b7c1e29c746a824eccba68b0946cf | |
parent | ce44a6a5f6b3da64334d5447041846f61f01b51b (diff) |
fix plot-friendly output
-rw-r--r-- | vote/vote.ino | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/vote/vote.ino b/vote/vote.ino index e695806..6cfca11 100644 --- a/vote/vote.ino +++ b/vote/vote.ino @@ -42,21 +42,6 @@ struct Vote { int measure; }; -bool push(String id, unsigned long timestamp, int measure); -void printStack(); -bool qualifyVote(Vote vote, unsigned long currentTime); - -int _attitude; -int _pin; -bool _boolState; -byte _count; -unsigned long _time; - -// Array to store ID strings -String idStack[STACK_SIZE]; -unsigned long timeStack[STACK_SIZE]; -int measureStack[STACK_SIZE]; - // Index of the top element in the stack, -1 means stack is empty int top = -1; @@ -74,6 +59,15 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { && advertisedDevice.getFrameType() == BLE_EDDYSTONE_TLM_FRAME ) { BLEEddystoneTLM EddystoneTLM(&advertisedDevice); + + // misuse error-only log level for plot-friendly output +#if ARDUHAL_LOG_LEVEL == ARDUHAL_LOG_LEVEL_ERROR + String id_mangled = advertisedDevice.getName(); + id_mangled.replace(' ', '_'); + id_mangled.replace(':', '='); + Serial.println(id_mangled + ":" + EddystoneTLM.getTemp()); +#endif + push( advertisedDevice.getName(), millis(), @@ -102,15 +96,6 @@ bool push(String id, unsigned long timestamp, int measure) { return true; } -/// Function to print stack contents -void printStack() { - for (int i = top; i >= 0; i--) { - Serial.print("ID: "); Serial.print(idStack[i]); - Serial.print(", Time: "); Serial.print(timeStack[i]); - Serial.print(", measure: "); Serial.println(measureStack[i]); - } -} - bool qualifyVote(Vote vote, unsigned long currentTime) { // If the measure is 42 (YES), check timestamp validity @@ -154,11 +139,5 @@ void loop() { BLEScanResults *foundDevices = pBLEScan->start(scanTime, false); pBLEScan->clearResults(); - // misuse error-only log level for plot-friendly output -#if ARDUHAL_LOG_LEVEL == ARDUHAL_LOG_LEVEL_ERROR - Serial.printf("pin:%d boolState:%d time:%d count:%d\n", - _pin, _boolState, _time, _count); -#endif - delay(500); } |