If it made it into the main trunk, would everyone download Fryskytelemetry files with standard MultiWii downloads? If so, I can understand why people may not want it in the main distribution. If there were a separate branch or repository for just FrSky telemetry, that would be great.
I worked out most of the bugs in the latest post and even added a fuel bar functionality. For those interested, I'll share....
using vpb's post on Thu Nov 14, 2013 7:49 am, I changed "VBAT" to "analog.vbat" in order for the sketch to compile correctly. This is due to VBAT being part of a "typedef struct" definition in types.h named "analog".
Since it seems like A1 and A2 cannot be overridden, I want to get some sort of use of my fuel bar on my FLD-02 to indicate my battery pack capacity. The fuel bar only accepts values of 0, 25, 50, 75, and 100, so we need a little if, else if, else routine to indicate the battery capacity. Changing the send_Fuel_Level routine worked really nicely:
Code: Select all
// Fuel level
void send_Fuel_level(void)
{
uint16_t Datas_Fuel_level;
Datas_Fuel_level = int((analog.vbat-136)*(100/32));
if (Datas_Fuel_level > 75) {
Datas_Fuel_level = 100; }
else if ((Datas_Fuel_level <= 75) && (Datas_Fuel_level > 50)) {
Datas_Fuel_level = 75; }
else if ((Datas_Fuel_level <= 50) && (Datas_Fuel_level > 25)) {
Datas_Fuel_level = 50; }
else if ((Datas_Fuel_level <= 25) && (Datas_Fuel_level > 0)) {
Datas_Fuel_level = 25; }
else {Datas_Fuel_level = 0;}
sendDataHead(ID_Fuel_level);
write_FrSky16(Datas_Fuel_level);
}
136 signifies 13.6 volts as empty. Knowing 4s is 16.8 at full charge, 168 - 136 = 32. We want that difference of 32 to scale over 100, so the formula becomes
Datas_Fuel_level = int((analog.vbat-136)*(100/32))
I'm not a programmer, but I figured if Datas_Fuel_level is an integer type, I better do the int() operation on that formula to be safe.
Took this up today and it worked great! The fuel bar finally gives me an indication of my electric "fuel".
Thanks to everyone that made this happen. It is really nice to have this data coming back natively from the FC.
The # Satellites and DFH on the 1st screen is an awesome mod.
**Disclaimer - I'm using a ReadyToFlyQuads Ez3 FC which is a Mega 2560. I'm not sure how many processor cycles this fuel bar mod takes, so I have no idea if this could adversely affect less powerful FCs.