From f370754d178f99c85975615a09eaaaa7a3b48a60 Mon Sep 17 00:00:00 2001 From: Halcy0nic Date: Tue, 9 Jan 2024 18:04:36 -0700 Subject: [PATCH] Feat: Parsing decoded values for survey mode --- app.py | 20 +++++----- static/css/styles.css | 21 +++++++++-- templates/survey.html | 73 ++++++++++++++++++++++++++++-------- templates/tracking.html | 83 ++++++++++++++++++++--------------------- 4 files changed, 126 insertions(+), 71 deletions(-) diff --git a/app.py b/app.py index 0bbd8e1..7a54506 100644 --- a/app.py +++ b/app.py @@ -22,13 +22,6 @@ global_dataframe = pd.DataFrame(columns=['Device Name', 'Frequency', 'Signal Str frequency = lambda port: {'port1': 433, 'port2': 868,'port3': 915}.get(port, None) surveydata = {} - -import re -import time - -import re -import time - def read_serial_data(port, ser, buffer): global surveydata rssi_pattern = r"RSSI: (-?\d+)" @@ -53,8 +46,16 @@ def read_serial_data(port, ser, buffer): # Update dictionary only if both RSSI and Decoded Value are found if rssi is not None and decoded_value is not None: - key = f'Raw LoRa Device {frequency(port)} MHz' - surveydata[key] = [frequency(port), rssi, decoded_value] + freq = frequency(port) + key = f'Raw LoRa Device {freq} MHz' + + # Initialize the list for the frequency if not already done + if key not in surveydata: + surveydata[key] = [] + + # Append the new values to the list for this frequency + surveydata[key].append([freq, rssi, decoded_value]) + # Reset rssi and decoded_value for next packet rssi = None decoded_value = None @@ -77,6 +78,7 @@ def read_serial_data(port, ser, buffer): + def connect_serial(port,frequency): global ser1 global ser2 diff --git a/static/css/styles.css b/static/css/styles.css index 41da4c6..d01bdbc 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -11066,10 +11066,25 @@ section.resume-section .resume-section-content { /* Styling for the table */ .scrollable-table { - max-height: 300px; - overflow-y: auto; - display: block; + width: 100%; + overflow-y: auto; /* Enable vertical scrolling */ + max-height: 500px; /* Adjust the height as needed */ } +#data-table { + width: 100%; + font-size: 1.1em; + border-collapse: collapse; /* Optional: for border styling */ +} +#data-table thead th { + position: sticky; + top: 0; + background-color: #fff; /* Or any other background color */ +} +#data-table th, #data-table td { + padding: 10px; + border: 1px solid #ddd; /* Optional: for border styling */ +} + table { width: 100%; border-collapse: collapse; diff --git a/templates/survey.html b/templates/survey.html index 9fdf426..84ddffb 100644 --- a/templates/survey.html +++ b/templates/survey.html @@ -56,16 +56,17 @@ Device Name Frequency Signal Strength - Recovered Plaintext + Decoded Values - + diff --git a/templates/tracking.html b/templates/tracking.html index ecf0e5c..ed48ffe 100644 --- a/templates/tracking.html +++ b/templates/tracking.html @@ -71,9 +71,7 @@
- -
-
+