No joy in first attempt:
I added analog_input.py
to klipper/klippy/extras
and put in the information as specified in your Config_reference.md
and got the error above.
Trying it again, I modified it to include a label in the [analog_input ...]
statement and the failure went away.
I suggest that you add that to your documentation.
Now, I don’t see any value for this in Mainsail:
I copied in your version of Mainsail into the host and I do not see the “VIN” analog_input
value on the dashboard (see above).
Here is the system’s: klippy (2).log (94.5 KB)
Now, you’ve made changes to the editor in Mainsail - when I tried to edit printer.cfg
I get the screen:
With no way to edit the file - I edited it using SSH (and I could have done it using Notepad++) but I was expecting to be still able to use the Mainsail editor.
Finally, you’re going to need to rethink how you do your maths.
I didn’t take a deep look at how you calculate the values for display but it’s more awkward/difficult and, I think, quite prone to rounding errors.
For my circuit, I have the following two points I use for calculations: the ADC Value of 0.151V indicates 2V input to the system and an ADC Value of 3.049V indicates that there is a 70V input.
For three decimal places of accuracy, this works out to an Offset
of -0.066 and a Scale
of 25.529
Plugging these values into your formula, the displayed values will be 2.17V and 76.15V ==> Each having a higher error than I would think is appropriate: 8.5% and 8.8%, respectively.
Could I suggest that your calculation take a slope and Y intercept in the standard format:
Y = mX + b
The calculations are more straightforward and rounding errors in the offset won’t be multiplied by the scale (which also has rounding errors).
Sorry for the poor first results.
I definitely think you have something here but there are a few bugs to straighten out.