Merge branch 'master' of github.com:r0ket/r0ket

This commit is contained in:
iggy 2011-08-05 01:25:59 +02:00
commit 050fe57a50
6 changed files with 25 additions and 3 deletions

View File

@ -28,6 +28,9 @@ void main_default(void) {
case BTN_UP: // Reset config
f_unlink("r0ket.cfg");
break;
case BTN_RIGHT:
GLOBAL(develmode)=1;
break;
case BTN_DOWN:
usbMSCInit();
while(1)
@ -83,6 +86,15 @@ void tick_default(void) {
EVERY(50,0){
if(GLOBAL(chargeled)){
IOCON_PIO1_11 = 0x0;
gpioSetDir(RB_LED3, gpioDirection_Output);
if(GetChrgStat())
gpioSetValue (RB_LED3, 1);
else
gpioSetValue (RB_LED3, 0);
};
if(GetVoltage()<3600){
IOCON_PIO1_11 = 0x0;
gpioSetDir(RB_LED3, gpioDirection_Output);

View File

@ -123,7 +123,7 @@ char *meshmsgs(void){
extern MPKT meshbuffer[MESHBUFSIZE];
//# MENU Messages
//# MENU messages
void m_choose(){
char list[99];
int i=0;

View File

@ -136,6 +136,7 @@ void delayms(uint32_t ms);
// voltage.c
void VoltageCheck(void);
uint32_t GetVoltage(void);
uint8_t GetChrgStat(void);
// night.c
void LightCheck(void);

View File

@ -28,6 +28,7 @@ struct CDESC the_config[]= {
{"flamemaxw", 255, 1, 255, 1, CFG_TYPE_FLAME},
{"flameminw", 0x8f, 1, 255, 1, CFG_TYPE_FLAME},
{"l0nick", 0, 0, 1 , 0, 0},
{"chargeled", 1, 0, 1 , 0, 0},
{ NULL, 0, 0, 0 , 0, 0},
};

View File

@ -42,6 +42,7 @@ extern char nickl0[];
#define GLOBALflamemaxw (the_config[14].value)
#define GLOBALflameminw (the_config[15].value)
#define GLOBALl0nick (the_config[16].value)
#define GLOBALchargeled (the_config[17].value)
#define GLOBALnickname (nickname)
#define GLOBALnickfont (nickfont)
#define GLOBALnickl0 (nickl0)

View File

@ -3,10 +3,13 @@
#include "basic/basic.h"
#include "funk/nrf24l01p.h"
uint32_t results=5000;
static uint32_t results=5000;
static uint8_t chrg=1;
void VoltageCheck(void){
chrg=gpioGetValue(RB_PWR_CHRG);
results = adcRead(1);
results *= 10560;
results /= 1024;
@ -24,3 +27,7 @@ void VoltageCheck(void){
uint32_t GetVoltage(void){
return results;
};
uint8_t GetChrgStat(void){
return !chrg;
};