Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@knro
Copy link
Contributor

@knro knro commented Oct 20, 2025

Migrate all drivers using power or dew controller under the unified INDI::Power interface. This is a major refactor and all migrated drivers need to be tested.

@knro knro requested a review from jpaana October 20, 2025 08:50
@knro
Copy link
Contributor Author

knro commented Oct 20, 2025

@hcomet @chrysikos @chemistorge @iTerrans Please check

@knro knro self-assigned this Oct 20, 2025
@knro knro added this to the 2.1.7 milestone Oct 20, 2025
@hcomet
Copy link
Contributor

hcomet commented Oct 20, 2025

I quickly looked at the CheapoDC and MyDCP4ESP32 drivers. Generally the basics seem fine but both will need some work. The new Dew and Power tabs do not seem to work properly but the Main Control tab is mostly working.

Comments without fully understanding the new Power template and tabs.

MyDCP4ESP32

  • only has Dew controller outputs so probably should only have a Dew tab and no Power tab. It may have up to 4 independent channels.
  • power boost (Set a channel to 100% for a short period of time) not working.
  • Output 3 may be auto, manual or slaved to another channel. (I currently don't have device to check this)

CheapoDC

  • is a little different. Two outputs are always Dew outputs tied to a single channel. Up to four additional outputs may be individually configured in software as either being tied to the single Dew channel or as independent manual PWM channels or as a "power-like" channel with either 0% or 100% power.
  • The automated control output can also be set to manual control. This doesn't seem to be working. UPDATED: I figured this out and manual control does work. Trying to work out how the 'Auto Dew Control', 'Channels' and 'Duty Cycles' sections are supposed to work.

@knro
Copy link
Contributor Author

knro commented Oct 21, 2025

Thank you, so for MyDCPCESP32, the number of available dew channels is only know after getActiveChannels is called? so the initProperties should be delayed until then?

I'm going to need more help to configure this using INDI::Power. Right now, it's a simple Power/Dew/Variable channels division and control for each.

@hcomet
Copy link
Contributor

hcomet commented Oct 21, 2025

For MyDCP4ESP32, the number of available channels which support automated dew control is determined by getActiveChannels. It checks to see if a channel has a temperature probe attached. For Channels 1, 2 and 4 they need a probe to be active. For channel 3 it only needs a probe for automated dew control. Channel 3 can be set to manual or be attached to another active channel even it it has no probe attached. getActiveChannels will tell you which channels to show in the Dew tab next to Auto Dew Control.

I can look at the changes required for MyDCPESP32 and CheapoDC to move to using INDI:Power. Should I fork from knro/indi:power_refactor?

Is there anything that indicates the intent of how the new Tabs should work? ie: Auto Dew Control enables/disables auto for a channel. In CheapoDC this would move the channel from auto to manual. In MyDHCP4ESP32 only Channel 3 has manual so it would disable the other channels if unchecked? Should it also zeror the output of a channel when set to manual?

It seems that the Channels line may also enable/disable a channel? The Duty Cycles section should show current channel output whether auto or manual? If auto, then changes to output should be rejected?

Both the controllers will reject commands that do not fit the current settings for channels so the next readSettings will set everything back to what the controller has.

One more question, I see that you added all the controller settings to saveConfigItems. In past I had only included INDI specific items in saveConfigItems as well as anything that the controller did not maintain in its own config. Is there a preference for how this should be done?

@knro
Copy link
Contributor Author

knro commented Oct 21, 2025

I add INDI::Power interface documentation that might help clarify some of these points. You can download the PR (just add a .diff at the end and use wget to download then patch) or alternatively, fork my fork.

You'll have three tabs: Power (12v), Dew (all dew properties including Autodew) and Variable (for variable output).

@hcomet
Copy link
Contributor

hcomet commented Oct 23, 2025

I submitted a PR against your fork for MyDCP4ESP32.

I'll start on CheapoDC now. CheapoDC has one automated channel that may drive 2 to 6 outputs. The first 2 are always dew outputs but the last 4 are configurable and my be tied to the 1 automated channel or be independent manual PWM Dew channels or each be independent 12V power outputs. This is determined at runtime by querying the device configuration.

Can the call to INDI::PowerInterface::initProperties be placed in the driver updateProperties after a connection is established?

Also, is there a recommended way to change the labels for the channels in the driver code. For instance, a device may have outputs 0 & 1 as Auto Dew, outputs 2 & 3 as Manual Dew and outputs 4 & 5 as 12V power. I'd like to be able to change the labels. In particular having the 12V power show as Channel 1 & 2 when they are Outputs 4 & 5 will be confusing.

@knro
Copy link
Contributor Author

knro commented Oct 23, 2025

You can call PI::initProperties in handshake for example after you establish connection to the device. It just must be done before updateProperties is called by the frameworks after Connect returns true, and that only returns true after Handshake is successful.

All the labels are configurable and after the call to PI::initProperties, you could (optionally) set your own default labels if you want to:

PI::PowerChannelLabels[0]->setLabel("Output 3")

For example. However, the user can change the label for Power, Dew, and Variable channels to reflect what is actually connected.

@knro knro merged commit 1364160 into indilib:master Oct 27, 2025
10 of 11 checks passed
@knro
Copy link
Contributor Author

knro commented Oct 27, 2025

@hcomet Please submit a PR now to master directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants