Add command for setting TEC polarity direction #135

Merged
sb10q merged 2 commits from atse/thermostat:swap_command into master 2024-10-05 14:54:55 +08:00
Contributor

Adds new command pwm <0/1> polarity <normal/reversed>, which sets the direction of TEC polarity, with swapped status saved to flash and reported.

See #104. Decided to not go with the mode command after all since resistive heater mode can be emulated with current limits.

Adds new command `pwm <0/1> polarity <normal/reversed>`, which sets the direction of TEC polarity, with swapped status saved to flash and reported. See #104. Decided to not go with the mode command after all since resistive heater mode can be emulated with current limits.
atse added 3 commits 2024-09-23 18:08:35 +08:00
Effectively switches all values related to the directionality of current
through the TEC, including current maximums. The swapped status is
stored in the flash store.

To swap current directions, use the command "pwm <ch> polarity_swapped
<bool>", where <bool> is true when TEC current direction is reversed
from the front panel markings.

This is needed for IDC cable connections, since the IDC connector and
front panel connectors have flipped polarities.
Signed-off-by: Egor Savkin <es@m-labs.hk>
Owner

If I can configure the TEC Polarity via the command pwm <0/1> polarity_swapped <false/true>,
I would expect I can see the TEC polarity via the pwm cmd. But it's not.

If I can configure the TEC Polarity via the command `pwm <0/1> polarity_swapped <false/true>`, I would expect I can see the TEC polarity via the `pwm` cmd. But it's not.
Owner

There is inconsistency in cmd and report json.
Type pwm <0/1> polarity_swapped <false/true> to swap polarity.
But, the report json uses "current_swapped" to indicate such setting.

current_swapped is not a good name for such setting.

Also, there is missing README report cmd docs for this settings.

There is inconsistency in cmd and report json. Type `pwm <0/1> polarity_swapped <false/true>` to swap polarity. But, the report json uses "current_swapped" to indicate such setting. `current_swapped` is not a good name for such setting. Also, there is missing README `report` cmd docs for this settings.
Owner

state.polarity_swapped setting is not applied when settings are loaded from flash.

`state.polarity_swapped` setting is not applied when settings are loaded from flash.
atse force-pushed swap_command from 0940520ded to d8e590ee9f 2024-09-30 17:31:18 +08:00 Compare
atse force-pushed swap_command from d8e590ee9f to 6224486662 2024-09-30 17:36:56 +08:00 Compare
Author
Contributor

I've changed the command to be in the format pwm <0/1> polarity <normal/reversed>, with the pwm command returning the following:

[{"channel":0,"center":"vref","i_set":{"value":0e0,"max":2e0},"max_v":{"value":0e0,"max":4e0},"max_i_pos":{"value":0e0,"max":2e0},"max_i_neg":{"value":0e0,"max":2e0},"polarity":"normal"},{"channel":1,"center":"vref","i_set":{"value":0e0,"max":2e0},"max_v":{"value":0e0,"max":4e0},"max_i_pos":{"value":0e0,"max":2e0},"max_i_neg":{"value":0e0,"max":2e0},"polarity":"normal"}]

The README is also updated, noting where polarity reversing might be needed. The polarity setting saving/loading was also tested ok.

I've changed the command to be in the format `pwm <0/1> polarity <normal/reversed>`, with the `pwm` command returning the following: ```json [{"channel":0,"center":"vref","i_set":{"value":0e0,"max":2e0},"max_v":{"value":0e0,"max":4e0},"max_i_pos":{"value":0e0,"max":2e0},"max_i_neg":{"value":0e0,"max":2e0},"polarity":"normal"},{"channel":1,"center":"vref","i_set":{"value":0e0,"max":2e0},"max_v":{"value":0e0,"max":4e0},"max_i_pos":{"value":0e0,"max":2e0},"max_i_neg":{"value":0e0,"max":2e0},"polarity":"normal"}] ``` The README is also updated, noting where polarity reversing might be needed. The polarity setting saving/loading was also tested ok.
atse changed title from Add command for swapping TEC polarity to Add command for setting TEC polarity direction 2024-09-30 17:50:51 +08:00
Owner

But isn't it not a pwm functionality? pwm is just a way to reduce the average voltage by regulating high-freq square pulses (same as brightness regulation on OLED screens without DC-dimming).

API seems fine otherwise, just different category.

But isn't it not a pwm functionality? pwm is just a way to reduce the average voltage by regulating high-freq square pulses (same as brightness regulation on OLED screens without DC-dimming). API seems fine otherwise, just different category.
Owner

@esavkin In the case of thermostat the PWM system is able to output both positive and negative voltages.

@esavkin In the case of thermostat the PWM system is able to output both positive and negative voltages.
sb10q merged commit 6224486662 into master 2024-10-05 14:54:54 +08:00
atse deleted branch swap_command 2024-10-07 09:46:56 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/thermostat#135
No description provided.