Commit Graph

426 Commits

Author SHA1 Message Date
05ca3b59fe Exclusively use the Thermostat object as a medium
All calls to the Thermostat should be forwarded by the medium.
2024-08-16 18:01:58 +08:00
9d1074e605 Just catch asyncio.TimeoutError
Will just change to TimeoutError once we switch to Python 3.11 in the
flake.
2024-08-16 18:01:58 +08:00
62d0f510a3 Integrate WrappedClient into Thermostat model 2024-08-16 18:01:58 +08:00
27b326eaa9 Should not stop cancelling read if timeout'd 2024-08-16 18:01:58 +08:00
2ed1bfab5e Remove exception too general 2024-08-16 18:01:58 +08:00
d75f207808 Fix Autotuner state for forceful disconnect 2024-08-16 18:01:58 +08:00
3369ed2c77 Correct exception catching
asyncio.Task.result() is simply going to throw the exception in
asyncio.Task.exception(), there is no need to manually throw it.
2024-08-16 18:01:58 +08:00
9aaadfa6e6 ================Force connection fix starts here======== 2024-08-16 18:01:58 +08:00
3fc32c81f5 Make connection loss handling more elegant
Show an info box on connection lost informing the user that the
Thermostat was forcefully disconnected.
2024-08-16 18:01:58 +08:00
a7a847e2dd Formatting 2024-08-16 18:01:58 +08:00
89dd28b844 Use asserts to check for connectivity 2024-08-16 18:01:58 +08:00
f17f8de0b0 Add back the parent 2024-08-16 18:01:58 +08:00
279bd446c5 README: Proofread 2024-08-16 18:01:58 +08:00
0cb50d5aac Swap order arounda bit more 2024-08-16 18:01:58 +08:00
2f8814a93c Fix method call 2024-08-16 18:01:57 +08:00
3ba58ab4ae flake.nix: nixfmt-rfc-style 2024-08-16 18:01:57 +08:00
978d44f886 Use qtextras 2024-08-16 18:01:57 +08:00
288b94352b Expand PID Settings on PID engage 2024-08-16 18:01:57 +08:00
5574559ac6 ctrl_panel: Reformat SpinBox text always if valid
The parameter SpinBoxes previously would only update if the interpreted
value was changed, missing cases where the text would have changed but
the value stays the same, e.g. removing trailing decimal zeros.
2024-08-16 14:05:44 +08:00
e160a6f514 ctrl_panel: Move postfilter into its own group 2024-08-16 14:05:44 +08:00
ae9bd1a859 ctrl_panel: Use new locking mechanism from Kirdy 2024-08-16 14:05:44 +08:00
0f768f30e8 ctrl_panel: Fix editing fields with unit "°C"
A faulty regular expression within PyQtGraph causes any Parameter with a
suffix that doesn't begin with an alphanumeric character (as matched
with \w) to act abnormally. For instance, entering "100 °C" into the
input boxes gets interpreted as 10 °C.

Patch the FLOAT_REGEX in PyQtGraph to simply match for any character in
the suffix group.
2024-08-16 14:05:44 +08:00
07095d77c8 ctrl_panel: More appropriate steps and fixes 2024-08-16 14:05:44 +08:00
4a7d7abf3a ctrl_panel: Put plotted values into readings group
For more intuitiveness to first-time users
2024-08-16 14:05:44 +08:00
b9cf60f2df ctrl_panel: Fix max_v to only have unit "V"
As most users do not need to limit TEC voltage with accuracy of less
than 1mV.
2024-08-16 14:05:44 +08:00
3ffa939970 ctrl_panel: Bold "Control Method" text 2024-08-16 14:05:44 +08:00
87ba107ce5 ctrl_panel: Indicate active parameter of control
Instead of hiding the inactive control parameter, underline and bold the
active control parameter title, e.g. "Set Current" when control method
is constant current, and "Setpoint" when it is temperature PID.
2024-08-16 14:05:44 +08:00
319fb9cf9e ctrl_panel: Limits fixes
* PID Autotune test current should be positive

* max_v should be 4 V not 5 V

* r0 should not be negative
2024-08-16 14:05:44 +08:00
f7c266539b ctrl_panel: Code cleanup
* Remove unnecessary duplication of `THERMOSTAT_PARAMETERS`

* i -> ch

* Separate ParameterTree and Parameter initiation

* Remove extra "channel" option to root parameters, as the "value"
option is already the channel number
2024-08-16 14:05:44 +08:00
df9715b3ef ctrl_panel: PID Auto Tune -> PID Autotune 2024-08-16 14:05:44 +08:00
82279f15da ctrl_panel: Stop crushing spinboxes
It might not be the case on some themes, but on the default Qt theme the
spinbox are a bit too short for the containing numbers. See
https://github.com/pyqtgraph/pyqtgraph/issues/701.
2024-08-16 14:05:44 +08:00
fff42bfa4c ctrl_panel: Pin down units for editable fields
User input always has the same order of magnitude, so allowing multiple
siPrefixes would be unwanted complexity. Don't allow them to be changed.

The Parameter option "noUnitEditing" is added to do so by the following
measures:

1. Don't validate for changed siPrefix (if pinned) and suffix, which
avoids their removal.

2. Avoid getting the cursor embedded within the unit.
2024-08-16 14:05:44 +08:00
d3b93b1263 ctrl_panel: Remove need for "mA" hack
Remove all instances of mA scaling scattered all around the code and
specify it in the parameter tree with a single source of truth.

Done by adding the option "pinSiPrefix" for all Parameters of type `int`
or `float`, and using it for current Parameters with unit "mA".
2024-08-16 14:05:44 +08:00
4309f9044c ctrl_panel: Appropriate units for measured current
Allow the readonly display of current to vary its SI prefix in the unit,
since as a display entry it won't have the unit adjustment problem.
2024-08-13 12:38:32 +08:00
81418d0a55 ctrl_panel: Improve postfilter description 2024-08-13 12:38:32 +08:00
7fb933faa2 ctrl_panel: Add and improve tooltips and titles
For users' better understanding of what the parameters do
2024-08-13 12:38:29 +08:00
437c9cec34 ctrl_panel: Refer to Parameters by concise names
For displayed string representations, use the `title` key, or for
`ListParameter`s, use the dictionary mapping method instead.
2024-07-19 15:49:19 +08:00
7829ce6adf ctrl_panel: Config -> Settings 2024-07-19 15:49:16 +08:00
0f14212622 Format JSON 2024-07-19 15:48:57 +08:00
b768d61e39 Merge pull request 'GUI: Text changes' (#3) from gui_dev-str_changes into gui_dev
Reviewed-on: linuswck/thermostat#3
2024-07-19 15:36:01 +08:00
d244ba392a Fix typos 2024-07-19 15:34:31 +08:00
93d6df5e92 Merge pull request 'GUI: Some repo organisation' (#1) from gui_dev-repo_org into gui_dev
Reviewed-on: linuswck/thermostat#1
2024-07-12 10:34:23 +08:00
44bea87f03 Thermostat.disconnect -> Thermostat.end_session
QObject already has a disconnect method, avoid overriding it.
2024-07-10 15:56:43 +08:00
e6f62e9e19 flake: sha256 -> hash 2024-07-10 15:56:43 +08:00
271fe449ba Remove duplicated show call
MainWindow.show() already called in coro_main
2024-07-10 15:56:43 +08:00
70db0a39eb Remove duplicated antialias config option
Already set in live_plot_view.py
2024-07-10 15:56:43 +08:00
26c7382b1e Move GUI components and examples into folder
For better organisation
2024-07-10 15:56:43 +08:00
c415d9de8a Use MANIFEST.in
Allows for more accurate control over included files in pytec package
2024-07-10 15:56:43 +08:00
7069111e21 Expose frontend scripts exclusively in pytec 2024-07-10 15:56:43 +08:00
1707728c3c thermostat_data_model.py -> thermostat.py 2024-07-10 15:56:34 +08:00