DarkFlows
DarkFlows
It was an extreme hack to keep them with in a 8 bit formula, however the casting of floats is required for accuracy. I suggest you move the variables to...
uint16_t batteryAdcToVoltage(uint16_t src) // in perfect world vbatscale should be 33 for 3.3v { // vbatmincellvoltage is calculated by ((HIGH_RESISTOR+LOW_RESISTOR)/LOW_RESISTOR) stored as \* 2 return ((uint16_t)((float)src \* (float)((float)(batteryConfig->vbatscale/3)/0xFFF) \* (float)(batteryConfig->vbatmincellvoltage/2)));...
I think we are essentially saying the same thing, I don't even know what the state of the current code is, and i used 33 instead of 3.3 because it...
Honestly its too late to even think about the math, and its been a long time since I have looked at this. if the results are the same as my...
Holy shit man, i have been doing C coding for 25 years seriously it comments like that, the chase people away from helping with these projects like the plague. Who...
Casting is never a bad thing, over-casting is a lot better then under-casting. You are telling the compiler exactly how you expect it to work, and it will optimize any...
@martinbudden i work with a lot of new coders, and teaching them to write out exactly what they are thinking, always has the best results. When working with 8bit values,...
resistors are only accurate to 5% usually, so hard coding anything is ridiculous, especially since your using to resistors in a circuit which makes the calculations completely in accurate. I...
@martinbudden these "discussions" like with @ledvinap are exactly what I don't need in my day, and either do others, discussing endlessly over how to do a simple line of code...
@martinbudden cleanflight is falling behind because of the process involved. There is a happy medium between doing things properly, and discuss things to death. I have no doubt @ledvinap is...