FS#12025 - Ohm's Law Calculator added to resistor.c plugin

Attached to Project: Rockbox
Opened by Leif Andersen (LeifAndersen) - Wednesday, 23 March 2011, 00:13 GMT
Task Type Patches
Category Plugins
Status Unconfirmed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


(Made using r29635)

This plugin adds an Ohm's Law calculator feature to the resistor.c plugin. It takes two inputs, of either (voltage, resistance, current, power), but not both of the same time, it will then calculate the other two values.
This task depends upon

Comment by Leif Andersen (LeifAndersen) - Wednesday, 23 March 2011, 00:13 GMT
Woops, I added the resistor file rather than the patch file, here is the actual patch.
Comment by Frank Gevaerts (fg) - Thursday, 24 March 2011, 11:00 GMT
I'll have a proper look at this during the weekend
Comment by Leif Andersen (LeifAndersen) - Friday, 25 March 2011, 00:54 GMT
Oh dear, I was looking at the file, and it appeared that I had three lines with tabs in there...I have fixed the problem and uploaded a new patch. I believe it can be applied with patch -p1 < 0001-Added-Ohm-s-Law-feature-to-resistor.c-plugin-patch

Anyway, thank you for being willing to take a look at it.
Comment by Frank Gevaerts (fg) - Monday, 28 March 2011, 17:01 GMT
There are still some tabs in there :) Those are easy to fix though, and therefore not a real problem.

The only thing that bothers me a bit is that you use floating point types. While this does work in plugins, it's not something we really like (most of our players don't have floating point hardware). It's not a real problem in this case, since you only do very few calculations, so floating point emulation won't be too slow. It would still be nice if this could be done using only fixed point arithmetic though.
Comment by Leif Andersen (LeifAndersen) - Monday, 28 March 2011, 17:36 GMT
Ugg...thanks, I'll pull the tabs out.

Anyway, I will re-write the operations to only used fixed point arithmetic. I originally didn't do it as it seemed like floating point worked fine, but it's not too hard to write