1boot improved
This commit is contained in:
parent
b844a2b1a1
commit
8f002a719b
|
@ -6,13 +6,14 @@
|
||||||
#include "lcd/print.h"
|
#include "lcd/print.h"
|
||||||
#include "usetable.h"
|
#include "usetable.h"
|
||||||
|
|
||||||
static void set_privacy();
|
static void screen_intro();
|
||||||
|
static void set_privacy(int level);
|
||||||
static void privacy0();
|
static void privacy0();
|
||||||
static void privacy1();
|
static void privacy1();
|
||||||
static void privacy2();
|
static void privacy2();
|
||||||
|
static bool screen_overview();
|
||||||
static const char levels[][12] = {"0-trackable","1-mesh only","2-RF OFF"};
|
static const char levels[][12] = {"0-trackable","1-mesh only","2-RF OFF"};
|
||||||
|
bool privacy_set;
|
||||||
static const struct MENU submenu_privacy={ "Privacy?", {
|
static const struct MENU submenu_privacy={ "Privacy?", {
|
||||||
{ levels[0], &privacy0},
|
{ levels[0], &privacy0},
|
||||||
{ levels[1], &privacy1},
|
{ levels[1], &privacy1},
|
||||||
|
@ -20,11 +21,24 @@ static const struct MENU submenu_privacy={ "Privacy?", {
|
||||||
{NULL,NULL}
|
{NULL,NULL}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ram(void){
|
void ram(void){
|
||||||
// check privacy
|
bool again = true;
|
||||||
menuflags|=MENU_JUSTONCE;
|
menuflags|=MENU_JUSTONCE;
|
||||||
handleMenu(&submenu_privacy);
|
screen_intro();
|
||||||
|
while (again) {
|
||||||
|
privacy_set = false;
|
||||||
|
while (!privacy_set) {
|
||||||
|
handleMenu(&submenu_privacy);
|
||||||
|
}
|
||||||
|
input("Nickname:", GLOBAL(nickname), 32, 127, MAXNICK-1);
|
||||||
|
getInputWaitRelease();
|
||||||
|
again = screen_overview();
|
||||||
|
}
|
||||||
menuflags&= (~MENU_JUSTONCE);
|
menuflags&= (~MENU_JUSTONCE);
|
||||||
|
writeFile("nick.cfg",GLOBAL(nickname),strlen(GLOBAL(nickname)));
|
||||||
|
saveConfig();
|
||||||
};
|
};
|
||||||
|
|
||||||
static void privacy0() {
|
static void privacy0() {
|
||||||
|
@ -40,11 +54,39 @@ static void privacy2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_privacy(int level) {
|
static void set_privacy(int level) {
|
||||||
lcdClear();
|
|
||||||
lcdPrintln("Privacy:");
|
|
||||||
lcdPrintln(levels[level]);
|
|
||||||
lcdRefresh();
|
|
||||||
getInput();
|
|
||||||
GLOBAL(privacy) = level;
|
GLOBAL(privacy) = level;
|
||||||
|
privacy_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void screen_intro() {
|
||||||
|
lcdClear();
|
||||||
|
lcdPrintln("Welcome to");
|
||||||
|
lcdPrintln("r0ket");
|
||||||
|
lcdRefresh();
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue