Commit Graph

279 Commits

Author SHA1 Message Date
linuswck 51b82e0447 cmd_handler: Add cmd to get temp adc polling interval 2024-10-10 13:41:15 +08:00
linuswck 31e108a4b5 thermostat: settings obj now contains the exact filter type and val 2024-10-10 13:39:37 +08:00
linuswck 253f4410ee sys_timer: Add fn to retrieve ts in us resolution 2024-10-10 13:31:20 +08:00
linuswck bd72c382b0 thermostat: Fix incorrect Dac Calibration Algo
- Thermostat Firmware repo PR #133
2024-10-08 15:57:18 +08:00
linuswck a512614de5 net: add option not to open sock when it is polled
- fix a bug, which mcu can get stuck in State::HardReset indefinitely
2024-09-11 17:54:23 +08:00
linuswck 76f7875e3a gui: await for hard rst and dfu action 2024-09-11 17:54:23 +08:00
linuswck 0d64d62fb0 gui: Add pd_mon config form
- force user to follow a sequence of steps for safely configuring pd_mon
2024-09-11 17:54:18 +08:00
linuswck 0aeffdbf7b ld_pwr_exc_protector: disable irq after pwr off
-setting 0V threshold during power off might trigger IRQ
2024-09-11 17:05:38 +08:00
linuswck 89a1270c02 driver: send cmd err msg to a pyqt sig 2024-09-11 17:05:38 +08:00
linuswck c2e78e6f17 driver: Support ApplyPdParams cmd
- Include handling mechanism for "InvalidSettings"b response msg
2024-09-11 17:05:38 +08:00
linuswck 86e6d3764e laser: check pd_mon params & pwr limit before set
- Design to prevent Issue #47 on hardware kirdy repo from happening
- responsitivity, i_dark & transconductance determine the pwr limit range
- when "ApplyPdParams" and "SetLdPwrLimit" are called, pwr limit range
    is checked before applying new parameter
- Send out a "InvalidSettings" response with error message if settings
    cannot be applied
- Add settable power range to settings json object
2024-09-11 17:05:34 +08:00
linuswck 1111967a7b gui: add arg for saving log to a file 2024-09-04 17:21:13 +08:00
linuswck 1896e2534b main: Add PrepareForDfu state 2024-09-04 16:12:06 +08:00
linuswck 6d4b1b0574 driver: end_session if ConnClose & Dfu is recv-ed 2024-09-04 16:10:42 +08:00
linuswck 0b5fda2cd9 net: close oldest sock if available socks run out
- By default, smoltcp by default reset any new connections
    if there is no available socket
2024-09-04 15:46:43 +08:00
linuswck b763350a8b net: disable IRQ when data is being enqueued
- This prevents broken json to be sent out due to IRQ
2024-09-04 15:46:43 +08:00
linuswck 838592c812 gui: Display hw_rev when connected 2024-09-04 15:46:43 +08:00
linuswck e632cbbfdd driver: use readuntil to get response msg
- The driver may recv partial ctrl msg, which causes a json decode error
2024-09-04 15:46:43 +08:00
linuswck 27bf573010 driver: retrieve hw_rev after conn is established 2024-09-04 15:45:27 +08:00
linuswck c267c30b89 driver: add get_hw_rev() fn 2024-09-04 15:39:27 +08:00
linuswck c5826876a6 firmware: Add cmd to get hw_rev 2024-09-04 15:39:27 +08:00
linuswck 6782cda790 Update pid autotuner code 2024-09-04 15:39:27 +08:00
linuswck 2fe2ef531b Update example code 2024-09-04 15:39:27 +08:00
linuswck f2ad06ecae gui: patch the GUI code 2024-09-04 15:39:27 +08:00
linuswck 5166bb7ba8 driver: rm thread use & make it asyncio callable
- make all cmds asyncio callable
- control specific cmds can be enqueued to the handler synchronously
2024-09-04 15:39:21 +08:00
linuswck 9c611fc861 main: poll iface for dfu & hard rst ctrl msgs 2024-09-03 12:15:03 +08:00
linuswck 51913f2e2f net: fix incorrect poll_iface() calls
- poll_iface might be called by interrupt while poll_iface was being called in main loop
- Disable interrupt when poll_iface is being processed
- Only use IfacePollTimer to poll_iface
2024-08-27 18:49:43 +08:00
linuswck c86d67b15c firmware: do not display smoltcp log 2024-08-27 18:49:43 +08:00
linuswck 3d2294a90c driver: fix incorrect recv_response behavior 2024-08-27 18:49:13 +08:00
linuswck 3ba8b99084 Use degree celsius as temperature base unit
- Breaking: Erase settings before flashing
- except beta in Steinhart-Hart equation
- to keep the temperature value set consistent with the value returned
- f32 floating point calculation is inaccurate
2024-08-07 17:36:12 +08:00
linuswck af73ac8127 gui: Add text for LD & Thermostat status 2024-08-07 12:48:12 +08:00
linuswck c214e4182d temp_mon: fix limits not effective at stable temp
- previously, temp is stable, temp limits are not checked
2024-08-07 12:12:07 +08:00
linuswck fb69ae3306 main: Don't change temp ctrl mode at otp 2024-08-07 11:26:47 +08:00
linuswck 8c8ed12522 gui: Disable param tree compact height
- The displayed number was clipped by the pyqtgraph spinbox
2024-08-06 13:01:57 +08:00
linuswck 572e2dbc5d gui: update for the new driver code
- Default to use active report mode
- Connection will be retried upon abnormal disconnection
- Remove poll every _s and apply btn
2024-08-06 13:01:57 +08:00
linuswck 82c46e04d0 Update PID Autotune Code for Driver Code 2024-08-06 13:01:57 +08:00
linuswck 28f8c3c497 Update Example Code for Driver Code 2024-08-06 13:01:57 +08:00
linuswck 47bf166ecb driver: kirdy driver rewrite
- Start a new thread to handle connections and schedule FIFO task execution
- Make all the cmd accessible without using async
- Connections automatically retry upon disconnection
- Add support for PyQt6 Signal
2024-08-06 13:01:54 +08:00
linuswck 1dcac25574 gui: Use a custom regex to handle the suffix with temperature characters 2024-07-31 11:35:04 +08:00
linuswck 3f9a4bf140 ld: Block pwr on request if alarm is asserted
- Align the alarm and pwr up behavior with thermostat temp_mon
2024-07-26 14:29:46 +08:00
linuswck 201148fb21 main: allow loading flash without device settings
- Fix bugs: ld & thermostat settings cannot be loaded if device settings
    are not present. But, device settings can be left not configured.
2024-07-26 11:10:32 +08:00
linuswck a90031dd6c ld_pwr_exc_protector: clear irq bit at pwr up 2024-07-26 11:10:32 +08:00
linuswck 7b52072617 ld: cfg hardware when pd_mon params changes 2024-07-26 11:10:32 +08:00
linuswck c241d34434 gui: fix default units and mv to params' titles
- siPrefix(eg. m, u, k) is no longer editable and fixed
- the displayed unit is relocated to ctrl panel params' titles
2024-07-26 11:10:28 +08:00
linuswck 20c3d42dd7 rm ld soft current limit 2024-07-25 15:53:00 +08:00
linuswck aae89256c3 gui: fix ctrl_panel value getting overwritten bug 2024-07-24 12:19:26 +08:00
linuswck 3344e7ab19 rm debug comments 2024-07-23 10:39:33 +08:00
linuswck a76b8de994 thermostat: Save the user config-ed value directly
- the firmware recorded the actual value set with quantization errors or
    other errors
- this caused confusion for the user when they read back the settings
2024-07-22 17:37:25 +08:00
linuswck 3410a271fd thermostat: rst pid_state at pwr_up 2024-07-22 10:54:01 +08:00
linuswck 8f38acd0f2 thermostat: do not rst tec_i_out to 0 at pwr down 2024-07-22 10:52:32 +08:00