After struggling for awhile, I finally got Arducopter 3.2.1 to compile. I made a few minor changes to the code and recompiled using the special Arducopter version of Arduino. I used MISSION PLANNER to ‘load custom firmware’ and it loaded fine, then late in the VERIFY cycle, it said that in location 253xxx, it found a “0”, but was looking for 62.
I tried it again. Same issue. I tried a different controller board. Same issue. I loaded the ‘official’ version of 3.2.1 and it worked perfectly.
What could be wrong? is it looking for a checksum? Is the code over-writing the bootloader?
Please help me!
Your firmware is probably too big to fit in flash. Disable some of the optional components. Using make will create smaller binaries
I ‘remmed’ out some unused features and got it to compile. My modified firmware works great, too.
I made two changes, both in the AP_BatMonitor.cpp section.
I added a “smoother” for the current measurement
_current_amps = (_current_amps * 0.8f) +
(((_curr_pin_analog_source->voltage_average() - _curr_amp_offset) * _curr_amp_per_volt) * 0.2f);
Which takes out most of the huge variations in sequential current readings, but still gives me correct values.
And I also added a corrector for battery voltage roughly based on the battery ESR (which is usually around 12-15 milliohms in my case).
_voltage = (_volt_pin_analog_source->voltage_average() * _volt_multiplier) + (_current_amps * 0.015f);
Now, I get the true cell voltage of the battery (as opposed to the terminal voltage), and a much better indicator of how much life it has left.
Now I need to figure out a good way to add the battery ESR figure as a variable, so that I can configure it at run time using Mission Planner.