w.i.p. Terminal Themes added, improved terminal color picker, new compression in front-end
This commit is contained in:
+10
-6
@@ -44,12 +44,16 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token
|
||||
else if (streq(token, "btn5")) {
|
||||
httpdSend(connData, termconf->btn5, -1);
|
||||
}
|
||||
else if (streq(token, "default_bg")) {
|
||||
sprintf(buff, "%d", termconf->default_bg);
|
||||
httpdSend(connData, buff, -1);
|
||||
}
|
||||
else if (streq(token, "default_fg")) {
|
||||
sprintf(buff, "%d", termconf->default_fg);
|
||||
// else if (streq(token, "default_bg")) {
|
||||
// sprintf(buff, "%d", termconf->default_bg);
|
||||
// httpdSend(connData, buff, -1);
|
||||
// }
|
||||
// else if (streq(token, "default_fg")) {
|
||||
// sprintf(buff, "%d", termconf->default_fg);
|
||||
// httpdSend(connData, buff, -1);
|
||||
// }
|
||||
else if (streq(token, "theme")) {
|
||||
sprintf(buff, "%d", termconf->theme);
|
||||
httpdSend(connData, buff, -1);
|
||||
}
|
||||
else if (streq(token, "screenData")) {
|
||||
|
||||
@@ -82,6 +82,17 @@ cgiTermCfgSetParams(HttpdConnData *connData)
|
||||
}
|
||||
}
|
||||
|
||||
if (GET_ARG("theme")) {
|
||||
dbg("Screen color theme: %s", buff);
|
||||
int theme = atoi(buff);
|
||||
if (theme >= 0 && theme <= 5) { // ALWAYS ADJUST WHEN ADDING NEW THEME!
|
||||
termconf->theme = (u8) theme;
|
||||
} else {
|
||||
warn("Bad theme num: %s", buff);
|
||||
redir_url += sprintf(redir_url, "theme,");
|
||||
}
|
||||
}
|
||||
|
||||
if (GET_ARG("term_title")) {
|
||||
dbg("Terminal title default text: \"%s\"", buff);
|
||||
strncpy_safe(termconf->title, buff, 64); // ATTN those must match the values in
|
||||
@@ -148,6 +159,9 @@ tplTermCfg(HttpdConnData *connData, char *token, void **arg)
|
||||
else if (streq(token, "term_height")) {
|
||||
sprintf(buff, "%d", termconf->height);
|
||||
}
|
||||
else if (streq(token, "theme")) {
|
||||
sprintf(buff, "%d", termconf->theme);
|
||||
}
|
||||
else if (streq(token, "default_bg")) {
|
||||
sprintf(buff, "%d", termconf->default_bg);
|
||||
}
|
||||
|
||||
+8
-3
@@ -105,7 +105,15 @@ persist_load(void)
|
||||
}
|
||||
|
||||
if (hard_reset) {
|
||||
// Zero all out
|
||||
memset(&persist, 0, sizeof(PersistBlock));
|
||||
|
||||
persist_load_hard_default();
|
||||
|
||||
// write them also as defaults
|
||||
memcpy(&persist.defaults, &persist.current, sizeof(AppConfigBundle));
|
||||
persist_store();
|
||||
|
||||
// this also stores them to flash and applies to modules
|
||||
} else {
|
||||
apply_live_settings();
|
||||
@@ -141,9 +149,6 @@ persist_load_hard_default(void)
|
||||
restore_live_settings_to_hard_defaults();
|
||||
persist_store();
|
||||
|
||||
// // Store current -> default
|
||||
// memcpy(&persist.defaults, &persist.current, sizeof(AppConfigBundle));
|
||||
|
||||
info("[Persist] Settings restored to hard defaults.");
|
||||
|
||||
apply_live_settings(); // apply
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
// Changing this could be used to force-erase the config area
|
||||
// after a firmware upgrade
|
||||
#define CHECKSUM_SALT 1
|
||||
#define CHECKSUM_SALT 2
|
||||
|
||||
#define APPCONF_SIZE 2048
|
||||
|
||||
|
||||
+19
-1
@@ -671,7 +671,25 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
|
||||
ss->lastFg = 0;
|
||||
ss->lastChar = '\0';
|
||||
|
||||
bufprint("{\n \"w\": %d, \"h\": %d,\n \"x\": %d, \"y\": %d,\n \"cv\": %d,\n \"screen\": \"", W, H, cursor.x, cursor.y, cursor.visible);
|
||||
// TODO implement the new more efficient encoder!
|
||||
|
||||
bufprint(
|
||||
"{"
|
||||
"\"w\":%d,"
|
||||
"\"h\":%d,"
|
||||
"\"x\":%d,"
|
||||
"\"y\":%d,"
|
||||
"\"fg\":%d,"
|
||||
"\"bg\":%d,"
|
||||
"\"cv\":%d,"
|
||||
"\"screen\":\"",
|
||||
W,
|
||||
H,
|
||||
cursor.x,
|
||||
cursor.y,
|
||||
cursor.fg,
|
||||
cursor.bg,
|
||||
cursor.visible);
|
||||
}
|
||||
|
||||
int i = ss->index;
|
||||
|
||||
@@ -52,6 +52,7 @@ typedef struct {
|
||||
char btn3[TERM_BTN_LEN];
|
||||
char btn4[TERM_BTN_LEN];
|
||||
char btn5[TERM_BTN_LEN];
|
||||
u8 theme;
|
||||
|
||||
u8 _filler[
|
||||
TERMCONF_SIZE
|
||||
@@ -59,6 +60,7 @@ typedef struct {
|
||||
- 4
|
||||
- 1
|
||||
- 1
|
||||
- 1
|
||||
- TERM_TITLE_LEN
|
||||
- TERM_BTN_LEN * 5
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user