I was doing a complete testing in order to make a tutorial around the VBAT and BUZZER on MultiWii and i found an issue.
When the triggers are set for the different Levels, the "Critical" don't seems to do anything.
What i found so far (and i'm not a programmer). In the Alarms.cpp there is that block of code:
Code: Select all
#if defined(VBAT)
if (vbatMin < conf.vbatlevel_crit) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_VBAT_CRIT;
else if ( (analog.vbat > conf.vbatlevel_warn1) || (NO_VBAT > analog.vbat)) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_OFF;
else if (analog.vbat > conf.vbatlevel_warn2) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_VBAT_INFO;
else if (analog.vbat > conf.vbatlevel_crit) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_VBAT_WARN;
//else alarmArray[6] = 4;
#endif
Seems like the vbatMin is never achieved there and if i changed it for this, i start to get the "Critical" beeps:
Code: Select all
#if defined(VBAT)
if (analog.vbat < conf.vbatlevel_crit) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_VBAT_CRIT;
else if ( (analog.vbat > conf.vbatlevel_warn1) || (NO_VBAT > analog.vbat)) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_OFF;
else if (analog.vbat > conf.vbatlevel_warn2) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_VBAT_INFO;
else if (analog.vbat > conf.vbatlevel_crit) alarmArray[ALRM_FAC_VBAT] = ALRM_LVL_VBAT_WARN;
#endif
Does my change make sense ? Is there a reason why it use the "vbatMin" instead ?
Am i the only one with this problem (lol) ?
Also, that's a choice but the three fast beeps with a 2 second of wait seems not enough for me so i changed this like of code too:
Code: Select all
else if ( IS_ALARM_SET(ALRM_FAC_VBAT , ALRM_LVL_VBAT_CRIT) ) patternDecode(resource,500,0,0,50,50); //vbat critical
Note: Here is my Blog tutorial
http://www.robotshop.com/blog/en/lynxmotion-quadrino-nano-battery-monitoring-alarms-16207
Eric Nantel - DiaLFonZo