2011-08-04 14:34:56 +00:00
|
|
|
#include <sysinit.h>
|
|
|
|
|
|
|
|
#include "basic/basic.h"
|
|
|
|
#include "basic/config.h"
|
|
|
|
|
|
|
|
#include "lcd/print.h"
|
|
|
|
#include "usetable.h"
|
|
|
|
|
2011-08-04 19:38:48 +00:00
|
|
|
static void screen_intro();
|
|
|
|
static void set_privacy(int level);
|
2011-08-04 14:34:56 +00:00
|
|
|
static void privacy0();
|
|
|
|
static void privacy1();
|
|
|
|
static void privacy2();
|
2011-08-04 19:38:48 +00:00
|
|
|
static bool screen_overview();
|
2011-08-04 14:34:56 +00:00
|
|
|
static const char levels[][12] = {"0-trackable","1-mesh only","2-RF OFF"};
|
2011-08-04 19:38:48 +00:00
|
|
|
bool privacy_set;
|
2011-08-04 14:34:56 +00:00
|
|
|
static const struct MENU submenu_privacy={ "Privacy?", {
|
|
|
|
{ levels[0], &privacy0},
|
|
|
|
{ levels[1], &privacy1},
|
|
|
|
{ levels[2], &privacy2},
|
|
|
|
{NULL,NULL}
|
|
|
|
}};
|
|
|
|
|
2011-08-04 19:38:48 +00:00
|
|
|
|
|
|
|
|
2011-08-04 14:34:56 +00:00
|
|
|
void ram(void){
|
2011-08-04 19:38:48 +00:00
|
|
|
bool again = true;
|
2011-08-04 19:46:28 +00:00
|
|
|
menuflags|=(MENU_JUSTONCE|MENU_BIG);
|
2011-08-04 19:38:48 +00:00
|
|
|
screen_intro();
|
|
|
|
while (again) {
|
|
|
|
privacy_set = false;
|
|
|
|
while (!privacy_set) {
|
|
|
|
handleMenu(&submenu_privacy);
|
|
|
|
}
|
2011-08-04 23:44:34 +00:00
|
|
|
input("Nickname?", GLOBAL(nickname), 32, 127, MAXNICK-1);
|
2011-08-04 19:38:48 +00:00
|
|
|
getInputWaitRelease();
|
|
|
|
again = screen_overview();
|
|
|
|
}
|
2011-08-04 19:46:28 +00:00
|
|
|
menuflags&= (~(MENU_JUSTONCE|MENU_BIG));
|
2011-08-04 19:38:48 +00:00
|
|
|
writeFile("nick.cfg",GLOBAL(nickname),strlen(GLOBAL(nickname)));
|
|
|
|
saveConfig();
|
2011-08-04 14:34:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void privacy0() {
|
|
|
|
set_privacy(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void privacy1() {
|
|
|
|
set_privacy(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void privacy2() {
|
|
|
|
set_privacy(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_privacy(int level) {
|
2011-08-04 19:38:48 +00:00
|
|
|
GLOBAL(privacy) = level;
|
|
|
|
privacy_set = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void screen_intro() {
|
2011-08-04 14:34:56 +00:00
|
|
|
lcdClear();
|
2011-08-04 23:44:34 +00:00
|
|
|
lcdPrintln("");
|
|
|
|
lcdPrintln(" r0ket");
|
|
|
|
lcdPrintln("");
|
|
|
|
lcdPrintln("launch config");
|
|
|
|
lcdPrintln("");
|
|
|
|
lcdPrintln("press any key");
|
|
|
|
lcdPrintln("to continue");
|
2011-08-04 14:34:56 +00:00
|
|
|
lcdRefresh();
|
2011-08-04 19:38:48 +00:00
|
|
|
getInputWait();
|
|
|
|
getInputWaitRelease();
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool screen_overview() {
|
|
|
|
char key = 0;
|
|
|
|
while (key != BTN_ENTER) {
|
|
|
|
lcdClear();
|
|
|
|
lcdPrintln("Privacy:");
|
|
|
|
lcdPrintln(levels[GLOBAL(privacy)]);
|
|
|
|
lcdPrintln("");
|
|
|
|
lcdPrintln("Nickname:");
|
|
|
|
lcdPrintln(GLOBAL(nickname));
|
|
|
|
lcdPrintln("");
|
|
|
|
lcdPrintln("LEFT: cancel");
|
|
|
|
lcdPrintln("ENTER: OK");
|
|
|
|
lcdRefresh();
|
|
|
|
key = getInputWait();
|
|
|
|
if (key == BTN_LEFT) {
|
|
|
|
//getInputWaitRelease();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2011-08-04 14:34:56 +00:00
|
|
|
}
|
|
|
|
|