Commit Graph

169 Commits

Author SHA1 Message Date
72ca1f16a9 Move reset request to thermostat control menu
We don't get auto reconnect anymore
2024-10-07 17:48:24 +08:00
3aeef04330 Move pid autotuning request to CtrlPanel
And update autotune UI only on state change instead of every single
report update
2024-10-07 17:48:24 +08:00
4407e5c97a Move channelGraph stuff inside LiveDataPlotter 2024-10-07 17:48:24 +08:00
a82e163d58 Move plot_options_menu stuff into menu 2024-10-07 17:48:24 +08:00
0f117f8ee8 Move autotune ticking connect 2024-10-07 17:48:24 +08:00
377c2dec48 Get thermostat_ctrl_menu to subscribe to hwrev updates 2024-10-07 17:48:24 +08:00
b54cfacd92 Save/load info box content 2024-10-07 17:48:24 +08:00
7cf8d6ee70 Fix loading all channel settings would bring up 2 info boxes 2024-10-07 17:48:24 +08:00
ef86336b95 Add back asyncSlot to save_cfg_request 2024-10-07 17:48:24 +08:00
bc50b295bb hw_rev 2024-10-07 17:48:24 +08:00
4907678d53 fan_update: tec_qt to thermostat_ctrl_menu 2024-10-07 17:48:24 +08:00
9ede52de93 Fix updating status label for hwrev = None 2024-10-07 17:48:24 +08:00
66db9bcc57 Put some menu requests in menu itself 2024-10-07 17:48:24 +08:00
f29095a0da Broadcast ConnectionState changes from Thermostat 2024-10-07 17:48:24 +08:00
7e235c3fea Move sigActivatedHandle to CtrlPanel 2024-10-07 17:48:24 +08:00
e82e561d14 Get rid of timeout on readline 2024-10-07 17:48:24 +08:00
7ec7ae7329 Put send_command in CtrlPanel 2024-10-07 17:48:24 +08:00
9f0064a61c Extra bail removed 2024-10-07 17:48:24 +08:00
d8c7db3f66 return hwrev when start_session 2024-10-07 17:48:24 +08:00
254e391a09 state str 2024-10-07 17:48:24 +08:00
f6276cdd74 params update concurrently 2024-10-07 17:48:24 +08:00
b380d66750 Stuff non-UI changes in Thermostat model 2024-10-07 17:48:24 +08:00
56c3e30c6b Base Thermostat connectivity UI changes to state 2024-10-07 17:48:24 +08:00
5c6652cdcb Remove wait_for
OSError raised anyways
2024-10-07 17:48:24 +08:00
bfc3543972 Actually its OSError 2024-10-07 17:48:24 +08:00
eb9189247f {start,end}_session -> [dis]connect 2024-10-07 17:48:24 +08:00
05dd0afe03 Simplify on_connect_btn_clicked
Raise if OSError
2024-10-07 17:48:24 +08:00
af53926b01 Connecting task moved? 2024-10-07 17:48:24 +08:00
371ddcdc5b AsyncIO version Client -> AsyncioClient 2024-10-07 17:48:24 +08:00
f66d029915 Exclusively use the Thermostat object as a medium
All calls to the Thermostat should be forwarded by the medium.
2024-10-07 17:48:24 +08:00
cf39eee997 Integrate WrappedClient into Thermostat model 2024-10-07 17:48:24 +08:00
87ef1caf47 Should not stop cancelling read if timeout'd 2024-10-07 17:48:24 +08:00
9d271f97a2 Fix Autotuner state for forceful disconnect 2024-10-07 17:48:24 +08:00
6c09ce1be0 _ 2024-10-07 17:48:24 +08:00
8ab93591a3 Make connection loss handling more elegant
Show an info box on connection lost informing the user that the
Thermostat was forcefully disconnected.
2024-10-07 17:48:24 +08:00
c2952f881f Use new style super() 2024-10-07 17:48:24 +08:00
810237bccf Move command line host:port setting handling
To main
2024-10-07 17:48:24 +08:00
f9b1bf8c6c aioclient: Add missing readline for saving
Saving all channels returns multiple JSON objects, read the extra {}.
2024-10-07 17:48:24 +08:00
23aafeba08 import order rearrange 2024-10-07 17:48:24 +08:00
334c4dbdce This is bail 2024-10-07 17:48:24 +08:00
56b2ecfc9b thermostat: Properly register task
Also Thermostat.task -> Thermostat._update_params_task
2024-10-07 17:48:24 +08:00
de583c38c4 ip -> host 2024-10-07 17:48:24 +08:00
5f69cb55e7 Lazy evaluating for debug string command 2024-10-07 17:48:24 +08:00
4ccddf9f20 Add pytec runnables 2024-10-07 17:48:24 +08:00
585c33cabb Exactlier wording 2024-10-07 17:48:24 +08:00
7696a07b4a unused 2024-10-07 17:48:24 +08:00
2eb7eb40a2 encoding 2024-10-07 17:48:24 +08:00
206b825e88 Just catch asyncio.TimeoutError
Will just change to TimeoutError once we switch to Python 3.11 in the
flake.
2024-10-07 17:48:24 +08:00
4a038d04d1 Remove exception too general 2024-10-07 17:48:24 +08:00
8599c5be4e Use asserts to check for connectivity 2024-10-07 17:48:24 +08:00
99777d75ce Add back the parent 2024-10-07 17:48:24 +08:00
b6696c2b09 Fix method call 2024-10-07 17:48:24 +08:00
35a447e980 Swap order arounda bit more 2024-10-07 17:48:24 +08:00
f19809c852 Formatting 2024-10-07 17:48:24 +08:00
c9aa0eaab8 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-10-07 16:13:56 +08:00
ed6cee4394 ctrl_panel: Move postfilter into its own group 2024-10-07 16:13:56 +08:00
e1bd960900 ctrl_panel: Use new locking mechanism from Kirdy 2024-10-07 16:13:56 +08:00
aed0c484dd 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-10-07 16:13:56 +08:00
3fe343435d ctrl_panel: More appropriate steps and fixes 2024-10-07 16:13:56 +08:00
eddfc40e07 ctrl_panel: Put plotted values into readings group
For more intuitiveness to first-time users
2024-10-07 16:13:56 +08:00
3ae89760ab 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-10-07 16:13:56 +08:00
2f9b95f04b ctrl_panel: Bold "Control Method" text 2024-10-07 16:13:56 +08:00
9926c00494 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-10-07 16:13:54 +08:00
fde1e6b3e4 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-10-07 16:03:00 +08:00
873f16a675 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-10-07 16:03:00 +08:00
85c8c23f2c ctrl_panel: PID Auto Tune -> PID Autotune 2024-10-07 16:02:58 +08:00
ac10859f70 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-10-07 16:02:04 +08:00
4bda62ab41 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-10-07 16:01:50 +08:00
6df37e31aa 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-10-07 16:01:41 +08:00
2df4c03c2d 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-10-07 16:01:31 +08:00
2b9bc020ce ctrl_panel: Improve postfilter description 2024-10-07 16:01:31 +08:00
dafde57e23 ctrl_panel: Add and improve tooltips and titles
For users' better understanding of what the parameters do
2024-10-07 16:01:29 +08:00
6a38f9b5a6 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-10-07 16:01:21 +08:00
9af4ffd125 ctrl_panel: Config -> Settings 2024-10-07 16:01:13 +08:00
55a7583867 Format JSON 2024-10-07 16:01:11 +08:00
41abad7aa3 send_command: Remove "activater"
Interpret commands anomalies directly in send_command instead
2024-08-14 16:07:15 +08:00
5c8d9c7cce send_command: Simplify "pid_autotune" parameters 2024-08-14 16:07:15 +08:00
278898fad2 send_command: Switch to thermostat:set_param
Use a `dict` to map values to thermostat parameters, which correspond to
the `set_param` parameters in the pytec client. New tag
"thermostat:set_param" used in JSON.
2024-08-14 16:07:14 +08:00
dd83daa5d9 send_command: Remove indirect path to parameter
The child at inner_param's childpath to the root parameter... is just
inner_param itself.
2024-08-14 16:06:31 +08:00
d57cc9ef2a send_command: Alias data as new_value 2024-08-14 16:06:24 +08:00
be77a6f205 send_command: Use in syntax 2024-08-14 16:06:17 +08:00
d244ba392a Fix typos 2024-07-19 15:34:31 +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
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
a16d2e9a9e Follow CapWords convention for class names
Re: PEP8
2024-07-10 15:45:03 +08:00
bc4ac43e0b Put comments in right place 2024-07-10 13:07:31 +08:00
9acff86547 Restructure GUI Code, Improve and Fix Bugs
- Bugs fix:
1. Params Tree user input will not get overwritten
    by incoming report thermostat_data_model.
2. PID Autotune Sampling Period is now set according to Thermostat sampling interval
3. PID Autotune won't get stuck in Fail State
4. Various types disconnection related Bugs
5. Number of Samples stored in the plot cannot be set
6. Limit the max settable output current to be 2000mA

- Improvement:
1. Params Tree settings can be changed with external json
2. Use a Tab system to show a single channel of config instead of two
3. Expose PID Autotune lookback params
4. Icon is changed to Artiq logo

- Restructure:
1. Restructure the code to follow Model-View-Delegate Design Pattern
2024-06-06 17:34:15 +08:00
8753f4a0fc Finish GUI 2024-05-08 14:49:03 +08:00
9a83d6850d Remove unused as clause 2024-05-08 14:49:03 +08:00
772863f4b2 Add paramtree view, without updates
Signed-off-by: Egor Savkin <es@m-labs.hk>

Fix signal blocker argument -atse
2024-05-08 14:49:03 +08:00
44ef2c04e3 Fix bugs, grammar, text, and refactor into class 2024-05-08 14:49:03 +08:00
623011fabb Change title 2024-05-08 14:49:03 +08:00
400f3a98e8 Stop polling drift
Just waiting for the update_s doesn't take into account the time to
execute update_params, and causes time drift.
2024-05-08 14:49:03 +08:00
7dd5d15047 Remove unused 'as' clause 2024-05-08 14:49:03 +08:00
65e1f4a146 Finish moving over to qasync
Also:

* Add aioclient

The old client is synchronous and blocking, and the only way to achieve
true asynchronous IO is to create a new client that interfaces with
asyncio.

* Finish Nix Flake description and make the GUI available for `nix run`
2024-05-08 14:49:03 +08:00