2011-08-08 22:11:16 +00:00
|
|
|
#include <sysinit.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "basic/basic.h"
|
|
|
|
#include "basic/config.h"
|
|
|
|
|
|
|
|
#include "lcd/render.h"
|
|
|
|
#include "lcd/print.h"
|
|
|
|
|
|
|
|
#include "usetable.h"
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
void ram(void) {
|
2011-08-21 23:40:25 +00:00
|
|
|
int v,mv,c;
|
2011-08-08 22:11:16 +00:00
|
|
|
do{
|
|
|
|
lcdClear();
|
|
|
|
lcdPrintln("Battery status:");
|
2011-08-21 23:40:25 +00:00
|
|
|
c=gpioGetValue(RB_PWR_CHRG);
|
2011-08-08 22:11:16 +00:00
|
|
|
mv=GetVoltage();
|
|
|
|
v=mv/1000;
|
|
|
|
|
|
|
|
lcdNl();
|
2011-08-21 23:40:25 +00:00
|
|
|
if(!c){
|
|
|
|
lcdPrintln("CHARGING");
|
|
|
|
}else if (mv<3550){
|
2011-08-08 22:11:16 +00:00
|
|
|
lcdPrintln(" Charge NOW!");
|
|
|
|
}else if (mv<3650){
|
|
|
|
lcdPrintln(" Charge soon");
|
|
|
|
}else if (mv<4000){
|
|
|
|
lcdPrintln(" OK");
|
|
|
|
}else if(mv<4200){
|
|
|
|
lcdPrintln(" Good");
|
|
|
|
}else{
|
|
|
|
lcdPrintln(" Full");
|
|
|
|
};
|
|
|
|
|
|
|
|
lcdNl();
|
|
|
|
lcdPrint(" ");
|
|
|
|
lcdPrint(IntToStr(v,2,0));
|
|
|
|
lcdPrint(".");
|
|
|
|
lcdPrint(IntToStr(mv%1000,3,F_ZEROS));
|
|
|
|
lcdPrintln("V");
|
|
|
|
|
|
|
|
lcdNl();
|
2011-08-21 23:40:25 +00:00
|
|
|
if(c){
|
2011-08-08 22:11:16 +00:00
|
|
|
lcdPrintln("(not charging)");
|
|
|
|
};
|
|
|
|
lcdRefresh();
|
|
|
|
} while ((getInputWaitTimeout(242))==BTN_NONE);
|
|
|
|
}
|