2011-07-24 00:47:07 +00:00
|
|
|
#include <sysinit.h>
|
|
|
|
|
|
|
|
#include "basic/basic.h"
|
2011-08-01 12:32:22 +00:00
|
|
|
#include "basic/config.h"
|
2011-07-24 00:47:07 +00:00
|
|
|
|
|
|
|
#include "lcd/lcd.h"
|
|
|
|
#include "lcd/print.h"
|
|
|
|
#include "lcd/allfonts.h"
|
|
|
|
|
|
|
|
#include "filesystem/ff.h"
|
|
|
|
#include "filesystem/select.h"
|
|
|
|
#include "funk/nrf24l01p.h"
|
|
|
|
#include "usb/usbmsc.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2011-07-24 13:44:35 +00:00
|
|
|
void show_ticks(void) {
|
|
|
|
int dx=0;
|
|
|
|
int dy=8;
|
|
|
|
lcdClear();
|
|
|
|
dx=DoString(0,dy,"Ticks:");
|
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
DoInt(0,dy+8,_timectr);
|
|
|
|
lcdDisplay();
|
|
|
|
};
|
|
|
|
dy+=16;
|
|
|
|
dx=DoString(0,dy,"Done.");
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-07-31 20:13:06 +00:00
|
|
|
void chrg_stat(void) {
|
|
|
|
int stat;
|
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
lcdClear();
|
|
|
|
lcdPrintln("Chrg_stat:");
|
|
|
|
stat=gpioGetValue(RB_PWR_CHRG);
|
|
|
|
lcdPrint(IntToStr(stat,3,0));
|
|
|
|
lcdNl();
|
|
|
|
lcdRefresh();
|
|
|
|
};
|
|
|
|
lcdPrintln("Done.");
|
|
|
|
};
|
2011-07-24 00:47:07 +00:00
|
|
|
void adc_light(void) {
|
|
|
|
int dx=0;
|
|
|
|
int dy=8;
|
|
|
|
dx=DoString(0,dy,"Light:");
|
2011-07-26 23:15:52 +00:00
|
|
|
DoString(0,dy+16,"Night:");
|
2011-07-24 00:47:07 +00:00
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
DoInt(dx,dy,GetLight());
|
2011-07-26 23:15:52 +00:00
|
|
|
DoInt(dx,dy+16,isNight());
|
2011-07-31 20:13:06 +00:00
|
|
|
DoInt(dx,dy+8,GLOBAL(daytrig));
|
2011-07-24 00:47:07 +00:00
|
|
|
lcdDisplay();
|
|
|
|
};
|
|
|
|
dy+=8;
|
|
|
|
dx=DoString(0,dy,"Done.");
|
|
|
|
};
|
|
|
|
|
2011-07-31 16:20:55 +00:00
|
|
|
void uptime(void) {
|
|
|
|
int t;
|
|
|
|
int h;
|
|
|
|
char flag;
|
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
lcdClear();
|
|
|
|
lcdPrintln("Uptime:");
|
|
|
|
t=getTimer()/(1000/SYSTICKSPEED);
|
|
|
|
h=t/60/60;
|
|
|
|
flag=F_ZEROS;
|
|
|
|
if(h>0){
|
|
|
|
lcdPrint(IntToStr(h,2,flag));
|
|
|
|
lcdPrint("h");
|
|
|
|
flag|=F_LONG;
|
|
|
|
};
|
|
|
|
h=t/60%60;
|
|
|
|
if(h>0){
|
|
|
|
lcdPrint(IntToStr(h,2,flag));
|
|
|
|
lcdPrint("m");
|
|
|
|
flag|=F_LONG;
|
|
|
|
};
|
|
|
|
h=t%60;
|
|
|
|
if(h>0){
|
|
|
|
lcdPrint(IntToStr(h,2,flag));
|
|
|
|
lcdPrint("s");
|
|
|
|
};
|
|
|
|
lcdNl();
|
|
|
|
lcdRefresh();
|
|
|
|
delayms_queue(200);
|
|
|
|
};
|
|
|
|
lcdPrintln("done.");
|
|
|
|
};
|
|
|
|
|
2011-07-24 00:47:07 +00:00
|
|
|
void gotoISP(void) {
|
|
|
|
DoString(0,0,"Enter ISP!");
|
|
|
|
lcdDisplay();
|
|
|
|
ISPandReset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcd_mirror(void) {
|
|
|
|
lcdToggleFlag(LCD_MIRRORX);
|
|
|
|
};
|
|
|
|
|
|
|
|
void lcd_invert(void) {
|
|
|
|
lcdToggleFlag(LCD_INVERTED);
|
|
|
|
};
|
|
|
|
|
|
|
|
void adc_check(void) {
|
|
|
|
int dx=0;
|
|
|
|
int dy=8;
|
|
|
|
// Print Voltage
|
|
|
|
dx=DoString(0,dy,"Voltage:");
|
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
DoInt(dx,dy,GetVoltage());
|
|
|
|
lcdDisplay();
|
|
|
|
};
|
|
|
|
dy+=8;
|
|
|
|
dx=DoString(0,dy,"Done.");
|
|
|
|
};
|
|
|
|
|
|
|
|
void msc_menu(void){
|
|
|
|
DoString(0,8,"MSC Enabled.");
|
|
|
|
lcdDisplay();
|
|
|
|
usbMSCInit();
|
2011-07-26 22:58:48 +00:00
|
|
|
getInputWaitRelease();
|
|
|
|
getInputWait();
|
2011-07-24 00:47:07 +00:00
|
|
|
DoString(0,16,"MSC Disabled.");
|
|
|
|
usbMSCOff();
|
|
|
|
};
|
|
|
|
|