aboutsummaryrefslogtreecommitdiff
path: root/vote/vote.ino
diff options
context:
space:
mode:
Diffstat (limited to 'vote/vote.ino')
-rw-r--r--vote/vote.ino39
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);
}