Commit Graph

408 Commits

Author SHA1 Message Date
atse 4e44de7880 Fix bugs, grammar, text, and refactor into class 2024-10-21 18:26:30 +08:00
atse 63e10c1c45 Change title 2024-10-21 18:26:30 +08:00
atse e5a8f8b1f8 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-10-21 18:26:30 +08:00
atse ed2f5a690f Remove unused 'as' clause 2024-10-21 18:26:30 +08:00
atse 5e9a4d8095 Update docs 2024-10-21 18:26:30 +08:00
atse b39e7dc015 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-10-21 18:26:28 +08:00
Egor Savkin d8ec1b4ea3 Try move from Qthreads to qasync
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-21 17:53:19 +08:00
Egor Savkin 2e1e55651d Create client watcher, that would poll Thermostat for config
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-21 17:50:04 +08:00
Egor Savkin 32b1c76520 Create basic GUI, that would connect and control thermostat's fan
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-10-21 17:50:04 +08:00
topquark12 088ec9ac4e add autotune 2024-10-21 17:50:04 +08:00
atse 9848c65de5 Fix command parser failing test due to changes 2024-10-21 15:51:21 +08:00
atse 069d791802 Rename all Steinhart-Hart references to B-param
The Steinhart-Hart equation was changed in code long ago to the
B-parameter equation. Rename references to it and the interface
accordingly. The `s-h` command is now `b-p`.

The reason the name "B-Parameter" equation was chosen over
"Beta-Parameter" was due to its easier searchability.
2024-10-21 15:44:46 +08:00
atse bd9ae997ae PwmLimits: Use uom quantities for fields not f64s 2024-10-21 11:13:19 +08:00
atse 45eb55d36d steinhart_hart: Beta Parameter uom dimensions
The Beta Parameter is not dimensionless, and has unit kelvin.
Incorporate that into the type system.
2024-10-21 11:12:47 +08:00
atse eddf05cae7 channels: get_i -> get_i_set 2024-10-21 11:12:16 +08:00
atse f68ae12c8d TCP command: Rename `pwm` to `output`
Current limit pins are driven by PWM inputs to the MAX1968 driver, but
this is an implementation detail, and should not be exposed in the form
of the command interface. Rename "pwm" to "output" in all instances.

See M-Labs/thermostat#62 (comment).
2024-10-21 10:09:24 +08:00
atse 101a68fcfc README: Update instruction on finding Rust version 2024-10-16 11:16:23 +08:00
atse 9d1adbc7f7 README: Fixes to grammar and instructions 2024-10-16 11:15:57 +08:00
atse 47fa9f757e README: Document interval key in reports 2024-10-16 11:15:28 +08:00
atse d1df6b8e3a README: Add updated info on new hardware revision 2024-10-16 11:15:10 +08:00
atse 0ffd784e91 README: Improve description of report command 2024-10-16 11:14:40 +08:00
atse d8ec083dbc Apply clippy suggestions 2024-10-14 13:25:49 +08:00
atse 1962135e79 Apply cargo fmt 2024-10-14 13:25:49 +08:00
atse fcb5cf1d4e Add command parser test for polarity command 2024-10-14 12:46:13 +08:00
atse d517087e10 README: Purge all traces of report mode 2024-10-14 10:08:08 +08:00
atse 798b400aa5 Show and save set value for PWM limits
Show in PwmSummary the set value, before all PWM duty calculations
instead of the machine value after the calculations. Also save the set
value into the flash store instead of the machine value.
2024-10-07 10:41:31 +08:00
atse 93dc39e943 README: Document PWM value clamping 2024-10-07 10:41:31 +08:00
atse 5c3b759d0c PwmSummary: Don't show max PWM values
Putting the maximum in PwmSummary has little use - the maximum never
changes throughout the runtime of the firmware and can be replaced by
documentation elsewhere.
2024-10-07 10:41:31 +08:00
atse 6224486662 Show polarity in pwm command 2024-09-30 17:36:50 +08:00
atse 32bd49b258 Add a command to reverse the output polarity
Effectively flips all values related to the directionality of current
through the TEC, including current maximums. The reversed status is
stored in the flash store and will be loaded on reset once saved.

The command is "pwm <ch> polarity <normal/reversed>", where the "normal"
polarity is indicated by the front panel markings.

This is needed for IDC cable connections to the Sinara 5432 DAC
"Zotino", since the TEC pins of the 10-pin connector on the Thermostat
and Zotino have opposite polarities.
2024-09-30 17:36:47 +08:00
linuswck ad54842c43 Fix wrong current limit duty cycle calculation
- prev commit assumed setting 3.3V -> 3A current limit which is wrong
- Please refer to the MAX1968 datasheet for the duty cycle
calculation equation
2024-09-25 17:20:29 +08:00
atse b336c4f993 Remove report mode
As the report mode command breaks the send-receive architecture model of
the command interface, and is deemed an anti-feature, making clients
difficult to write, remove it from the firmware entirely.
2024-09-25 17:19:34 +08:00
linuswck 680193b34b Fix incorrect dac calibration algo
- Fix abnormally long calibration time
2024-09-20 21:21:14 +08:00
atse ae4bea0c8a gitignore: Ignore .bin files and __pycache__ 2024-09-19 10:08:58 +08:00
atse 1f2de942e4 flake: Add rlwrap to devShell 2024-09-19 10:06:45 +08:00
atse 1041d3ecbb Improve the VREF calibration routine
* Fix wrong calibration of VREF on startup. Caused new v2.2.2 boards to
wrongly calibrate the zero-point to ~2.2 V instead of 1.5 V.

* Fix bootloop on some boards.

* Adjust watchdog interval accordingly.
2024-09-16 18:14:47 +08:00
atse c6040899dd ItecPin -> ITecPin 2024-08-12 13:02:22 +08:00
atse 9d89104f50 README: Fix command to make firmware BIN (#115)
Co-authored-by: atse <atse@m-labs.hk>
Co-committed-by: atse <atse@m-labs.hk>
2024-08-07 18:22:48 +08:00
atse 136c7a0b52 Calculate current_abs_max_tec_i from all channels
Instead of picking channels 0 and 1. Helps to generalise for more than 2
channels.
2024-08-07 16:14:28 +08:00
atse 5000cae1b1 Grammar fixes 2024-08-07 16:09:30 +08:00
atse 78ec77509f flake: Install LLVM in devShell too
So that developers can use `llvm-objcopy` in their devShells as well.
2024-08-07 16:06:19 +08:00
atse 52aa3890c1 Update nix repos 2024-08-06 13:38:58 +08:00
atse 1ae6a6fdd4 flake: More concise devShell
No need for C compiler in development shell + use "packages" to
explicitly refer to devShell packages
2024-08-06 11:14:25 +08:00
atse 7333d2cea5 flake: Don't use deprecated flake output schemas 2024-08-06 11:09:51 +08:00
atse 44e9130010 Use oxalica's rust-overlay
Follow ARTIQ, and in this project lets us include the version number
directly in flake.nix instead of linking to the toml file of a specific
release date, as we use stable Rust.

Also, from nixpkgs manual:
    both oxalica's overlay and fenix better integrate with nix and cache
    optimizations. Because of this and ergonomics, either of those
    community projects should be preferred to the Mozilla's Rust overlay
    (nixpkgs-mozilla).
2024-06-27 12:42:00 +08:00
linuswck 5b0c6f7018 Save i_set into ChannelConfig 2024-05-18 10:50:54 +08:00
linuswck 1007982b48 clamp TEC settings to a valid & design specs range
- Not respecting the design specs can cause hardware to get stuck in unrecoverable state
2024-05-10 15:17:46 +08:00
linuswck 925601f4f5 rm pid setpoint change kick 2024-05-10 10:29:08 +08:00
linuswck 8c1cb3117c README: Add notes on `i_tec` & `tec_i`readouts 2024-05-02 17:48:47 +08:00
linuswck 1fcfe41a63 Add averaging filter on the pin_adc readings
- Adapted from Kirdy Firmware
- Can reduce the i_tec readings noise dispersion
2024-05-02 16:49:55 +08:00