Skip to content

Commit

Permalink
Bugfix/vtrx timewindow adjustment (#48)
Browse files Browse the repository at this point in the history
* lengthen MAX_HISTORY_SECONDS to 1 week

* time window note
  • Loading branch information
mslaffin authored Jan 18, 2025
1 parent ac7d715 commit ea206e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions subsystem/vtrx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Parser expects semicolon-separated string containing at least three fields:
3. switch states in binary format
4. Optional additional error messages

### Data Retention and Time Window
The subsystem maintains a rolling buffer of pressure readings with the following characteristics:
- Max history: 168 hours (1 week)
- Data points are automatically trimmed beyond this window

### GUI Elements
- Real-time pressure plotting with configurable time window
Expand Down
11 changes: 9 additions & 2 deletions subsystem/vtrx/vtrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, parent, serial_port='COM7', baud_rate=9600, logger=None):
self.logger = logger
self.data_queue = queue.Queue()

self.MAX_HISTORY_SECONDS = 36000 # 10 hours
self.MAX_HISTORY_SECONDS = 7 * 24 * 60 * 60 # 7 days in seconds
self.full_history_x = [] # Complete timestamp history
self.full_history_y = [] # Complete pressure history
self.x_data = [] # Display window data
Expand Down Expand Up @@ -349,7 +349,14 @@ def setup_gui(self):
("30 min", 1800),
("1 hour", 3600),
("5 hour", 18000),
("10 hour", 36000)
("10 hour", 36000),
("1 day", 86400),
("2 days", 172800),
("3 days", 259200),
("4 days", 345600),
("5 days", 432000),
("6 days", 518400),
("Max", self.MAX_HISTORY_SECONDS)
]

self.time_window_var = tk.StringVar(value="5 min")
Expand Down

0 comments on commit ea206e6

Please sign in to comment.