467 Commits

Author SHA1 Message Date
c36470da8a ad7172: Fix RefSource From implementation
Fixes #210.
2025-10-09 10:21:07 +08:00
b3f5b82fcd ad7172: Fix wrong voltage calculation
Fixes #209.
2025-10-08 18:01:08 +08:00
knacktick
38e92c4042 Rename ctrl_panel to settings_tree_view 2025-08-25 17:55:07 +08:00
8ccdf8a3b5 Control Panel: Better steps and units in paramtree
- Step r0 by 100 Ohms instead of 1 Ohm
- Step b by 10 K instead of 1 K
- Prefix temp_swing with +/-
2025-06-02 14:58:52 +08:00
dd30db95ba Control Panel: Use codenames for parameters
Without cosmetic changes, avoid embedding display text in the code.

For displayed string representations, use the `title` key, or for
`ListParameter`s, use the dictionary mapping method instead.
2025-04-28 10:27:58 +08:00
4fbe06cdd7 PyThermostat: Move examples into dedicated dir 2025-04-18 14:34:29 +08:00
08dee2731c PyThermostat: Parameterise PID autotuning utility
Allow figures like the target temperature to be given on the
command-line instead of hardcoding them.
2025-04-18 14:34:01 +08:00
815c3caad6 Control Panel: Parameter Tree limit fixes
The b-p equation parameter r0 & autotune test current should both be
non-negative.
2025-04-18 14:32:53 +08:00
362866be20 README: Improve GUI Usage section
- Proofread
- Add non-Nix way to run Control Panel
- Use absolute URLs to run Control Panel anywhere
2025-04-18 14:31:50 +08:00
14a07f35e6 Control Panel: Config -> Settings 2025-04-18 00:32:38 +08:00
b26a6a0cf0 pid: Refactor
* Remove useless update_ki method
* Tidy up PID update internals
2025-04-18 00:19:09 +08:00
dd9e5fe195 Control Panel: Nest readings into its own group
This should be more intuitive to first-time users, as there is explicit
indication to what the reading values are, corresponding to the plotted
values.
2025-03-31 17:55:36 +08:00
a5c40f706a Revert "Use inline-asm feature in cortex-m"
This reverts commit 9305d766d1aa52b8c2997cd38d75a24b2700acfd.
2025-03-31 13:08:18 +08:00
c8af8cb61f PyThermostat GUI: Fix max_v to only have unit "V"
Since most users do not need to limit load voltage with accuracy of less
than 1mV.
2025-03-26 22:19:45 +08:00
23ce99d6d8 Set max_v maximum: 4 V -> 4.3 V
Align with the MAX1968's hardware capabilities, as it can achieve a
maximum voltage of 4.3 V across output pins.
2025-03-26 22:17:17 +08:00
d594c93166 Rename GUI to Control Panel
Change the command name to thermostat_control_panel, and the Nix Flake
app name to simply control_panel.
2025-03-26 13:23:19 +08:00
e3abe9384a PyThermostat GUI: No crushing paramtree spinboxes
It might not be the case on some themes, but on the default Qt theme the
spinboxes are a bit too short for the containing numbers. See
https://github.com/pyqtgraph/pyqtgraph/issues/701.
2025-03-17 21:54:42 +08:00
33ef98c5a8 PyThermostat GUI: Fix broken thermistor settings
Corresponds to the s-h -> b-p change in
069d79180255e7e83358180f95692f0f5d93a9fb.
2025-03-17 21:47:07 +08:00
9305d766d1 Use inline-asm feature in cortex-m
Reduces function call overhead, since external assembly can be avoided.
2025-03-17 21:46:34 +08:00
1f406fad38 Update cortex-m to 0.7 2025-03-17 21:46:34 +08:00
e8b217d0fc flake: Update Nixpkgs to nixos-24.11 2025-03-10 10:21:09 +08:00
1bb7c02fa5 Switch all uom ::zero() calls to ConstZeros 2025-03-03 17:41:47 +08:00
1e50c8ce6a Update uom to 0.36 2025-03-03 17:41:40 +08:00
fa1a688924 PyThermostat: Relax dependency versions 2025-03-03 16:24:25 +08:00
8b9e68cf3c PyThermostat GUI: Switch to new postfilter rates 2025-03-03 16:17:10 +08:00
c61b89edc5 README: Introduce Thermostat GUI
Co-authored-by: topquark12 <aw@m-labs.hk>
2025-03-03 15:58:41 +08:00
ca52bb066a PyThermostat GUI: Set up icon
Co-authored-by: Egor Savkin <es@m-labs.hk>
2025-03-03 15:58:41 +08:00
b326a8ba74 PyThermostat GUI: Set up packaging
Co-authored-by: Egor Savkin <es@m-labs.hk>
2025-03-03 15:58:41 +08:00
eeff217c9b PyThermostat GUI: Implement Control Panel
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2025-03-03 15:58:41 +08:00
89ee0894d9 PyThermostat GUI: Thermostat/Plot settings menus
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2025-03-03 15:58:41 +08:00
5792eeb22b PyThermostat GUI: Implement plotting
Co-authored-by: linuswck <linuswck@m-labs.hk>
2025-03-03 15:58:41 +08:00
72423604f9 PyThermostat GUI: Incorporate autotuning
Co-authored-by: topquark12 <aw@m-labs.hk>
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2025-03-03 15:58:41 +08:00
72ab40c0ce PyThermostat GUI: Implement status bar
Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2025-03-03 15:58:36 +08:00
b916ffc2a2 PyThermostat: Create GUI to Thermostat
- Add connection menu

- Add basic GUI layout skeleton

Co-authored-by: linuswck <linuswck@m-labs.hk>
Co-authored-by: Egor Savkin <es@m-labs.hk>
2025-03-03 15:58:19 +08:00
7d2d86f62a PyThermostat: Fix syntax error in autotune script 2025-03-03 15:17:27 +08:00
32f96d96d9 Use uom ::zero() instead of ::new(0.0)
For consistency with other ::zero() calls.
2025-03-03 12:48:34 +08:00
02745cbc55 Define uom constants instead of using ::new
Improves coverage for quantity checking and saves a local variable.
2025-03-03 12:43:02 +08:00
0753058a4b PyThermostat: Simplify PIDAutotuneState enum names
Remove `STATE_` prefix to reduce verbosity in say,
PIDAutotuneState.STATE_RELAY_STEP_DOWN
2025-02-26 10:17:53 +08:00
24cc2671ba PyThermostat: Modify PIDAutotune for GUI usage
This adds:

- An extra ready PIDAutotuneState and corresponding state transitions
- A setter for autotune parameters, allowing change after construction
2025-02-26 10:17:53 +08:00
2944571601 PyThermostat: Refactor PIDAutotuneState
- Use auto() for PIDAutotuneState Enum
- Shorten if-conditional statements
2025-02-26 10:17:53 +08:00
3c80446fa1 ad7172: Correct postfilter rates and rejection
The AD7172-2 Rev. A datasheet is inconsistent on the 50/60 Hz postfilter
rates and rejection figures between the *ENHANCED 50 Hz AND 60 Hz
REJECTION FILTERS* and the *FILTER CONFIGURATION REGISTER 0* sections.
Use the former section's figures instead.

The latter section is wrong since the 21.25 SPS figure is incorrect, as
the output data rate = 1 / (settling time), and 1 / (40 ms) = 25 Hz.
This seems to have been corrected in the datasheets for the rest of the
AD717x family, which have the same filter.
2025-02-26 10:16:26 +08:00
b5e32a2d11 PyThermostat: Create asyncio client 2025-02-26 10:15:32 +08:00
266665f6a9 channels: Simplify polarity setting in set_i_* 2025-02-24 18:08:43 +08:00
f4758a091a channels: Refactor set_max_i_pos and set_max_i_neg
Don't use MAX_TEC_I_DUTY_TO_CURRENT_RATE, and lay down steps to convert
from maximums to duty cycles to avoid premature optimization. Closer to
what appears on the MAX1968 datasheet.
2025-02-24 18:08:43 +08:00
9196a306b6 channels: Refactor set_max_v
Set up CPU_ADC_VREF to simplify calculating v_maxv.
2025-02-24 18:08:39 +08:00
3243a58a90 channels: Return proper maximums for output limits
Fix the return value of output limit setting methods to be the actual
maximums.
2025-02-24 17:03:31 +08:00
b7b1b928fe README: Better document output_[min,max] of PID 2025-02-21 21:16:42 +08:00
d89f5b9b49 channels: Remove more redundant pubs 2025-02-21 12:17:59 +08:00
f4ae51b24b channels: -pub on adc and add postfilter interface 2025-02-21 12:17:59 +08:00
8a95eb9fb1 Update panic-halt to v1.0.0
Removes panic message strings embedded in the binary, since v1.0.0
finally removed the compiler optimisation fence for it (c.f. past buggy
compiler versions).
2025-02-17 17:02:07 +08:00