jackbrown1993 / Jacuzzi-RS485

Python Module for Jacuzzi Hot Tubs
Apache License 2.0
8 stars 2 forks source link

Support float celsius values #38 #40

Closed jackbrown1993 closed 1 year ago

jackbrown1993 commented 1 year ago

@dhmsjs do you know how we can allow curseUI to accept a float value in the input for set temp? It currently doesn't allow x.5 for example at the moment. Jacuzzi's set to use celsius allows values increasing in 0.5 steps

dhmsjs commented 1 year ago

There are several dialog classes set up already -- EditDialog is the base class and then TextDialog, EnumDialog and ListDialog inherit from that. I suspect it would mostly just need a small change to support decimal point character entry. Not sure without looking deeper whether it would be best to modify the TextDialog class or create a FloatDialog instead.

dhmsjs commented 1 year ago

Looks like TextDialog supports all ASCII characters, so that isn't the problem. What is the actual error that occurs?

jackbrown1993 commented 1 year ago

Looks like TextDialog supports all ASCII characters, so that isn't the problem. What is the actual error that occurs?

It doesn't seem to allow me to input '.' nor does it allow backspace if you make a mistake.

dhmsjs commented 1 year ago

I've added a FloatDialog class to cursesui.py to handle editing floating point values. To use it you would replace a current instance of EditDialog with FloatDialog for those variables that take float values. Works with demoprocess.py at least.

jackbrown1993 commented 1 year ago

I've added a FloatDialog class to cursesui.py to handle editing floating point values. To use it you would replace a current instance of EditDialog with FloatDialog for those variables that take float values. Works with demoprocess.py at least.

Thanks @dhmsjs, do you want to submit a pull request on this repo or shall I copy code?

dhmsjs commented 1 year ago

From my perspective you can just copy over the code but you are clearly more familiar with using github than I am so if you prefer the pull request just let me know me why.

jackbrown1993 commented 1 year ago

@dhmsjs thanks will copy it across, not an issue as a small amount od code. For larger changes, its good to open a pull request to the repository you want to contribute towards so you can check that there are no conflicts in the code and it also shows you as the contributor.