simplify tones_ config key
This commit is contained in:
parent
815f79bc0b
commit
02df479896
|
|
@ -1,8 +1,8 @@
|
||||||
#nick=your nick, picked randomly on first run
|
#nick=your nick, picked randomly on first run
|
||||||
brightness=200
|
brightness=200
|
||||||
|
|
||||||
tones_msg=T300 O4 l8 D l4 A+
|
tones_msg=t300 d8 a+4
|
||||||
tones_sys=T300 O4 l8 A l4 D+
|
tones_sys=t300 a8 d+4
|
||||||
|
|
||||||
touch_threshold=300
|
touch_threshold=300
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -404,9 +404,9 @@ void handleCommand(const char* in) {
|
||||||
} else {
|
} else {
|
||||||
*sp = '\0';
|
*sp = '\0';
|
||||||
size_t klen = strlen(args);
|
size_t klen = strlen(args);
|
||||||
bool is_tones = klen > 6 && !strcmp(args + klen - 6, "_tones");
|
bool is_tones = klen > 6 && strncmp(args, "tones_", 6) == 0;
|
||||||
bool ok = is_tones ? settings_set_tones(args, sp + 1)
|
bool ok = is_tones ? settings_set_tones(args, sp + 1)
|
||||||
: settings_set_color(args, sp + 1);
|
: settings_set_color(args, sp + 1);
|
||||||
if (ok)
|
if (ok)
|
||||||
ui_push_message("", "Saved. Restart to apply.", false, true);
|
ui_push_message("", "Saved. Restart to apply.", false, true);
|
||||||
else if (is_tones)
|
else if (is_tones)
|
||||||
|
|
@ -657,7 +657,7 @@ static void go_to_sleep() {
|
||||||
snprintf(m, sizeof(m), "%s left the chat!", currentNick);
|
snprintf(m, sizeof(m), "%s left the chat!", currentNick);
|
||||||
// broadcastChatMessage("System", m); // same here, only show don't broadcasst
|
// broadcastChatMessage("System", m); // same here, only show don't broadcasst
|
||||||
ui_push_message("", m, false, true);
|
ui_push_message("", m, false, true);
|
||||||
|
|
||||||
delay(200); // let the packet fly
|
delay(200); // let the packet fly
|
||||||
|
|
||||||
// Hold the backlight OFF pin through deep sleep so the screen stays dark.
|
// Hold the backlight OFF pin through deep sleep so the screen stays dark.
|
||||||
|
|
|
||||||
9
src/meshberry/compat.h
Normal file
9
src/meshberry/compat.h
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// Replace the calls that MMLMusic makes to the
|
||||||
|
// AVR function strchr_P to strchr
|
||||||
|
#ifndef strchr_P
|
||||||
|
#define strchr_P strchr
|
||||||
|
#endif
|
||||||
|
|
@ -8,8 +8,8 @@ settings_t g_settings;
|
||||||
static const settings_t DEFAULTS = {
|
static const settings_t DEFAULTS = {
|
||||||
.nick = NICK_DEFAULT_PREFIX,
|
.nick = NICK_DEFAULT_PREFIX,
|
||||||
.brightness = 200,
|
.brightness = 200,
|
||||||
.tones_msg = "T140 G",
|
.tones_msg = "t300 d8 a+4",
|
||||||
.tones_sys = "T140 A",
|
.tones_sys = "t300 a8 d+4",
|
||||||
.touch_threshold = TOUCH_THRESHOLD,
|
.touch_threshold = TOUCH_THRESHOLD,
|
||||||
.color_bg = {.blue = 0x11, .green = 0x11, .red = 0x11},
|
.color_bg = {.blue = 0x11, .green = 0x11, .red = 0x11},
|
||||||
.color_header_bg = {.blue = 0x1e, .green = 0x1e, .red = 0x1e},
|
.color_header_bg = {.blue = 0x1e, .green = 0x1e, .red = 0x1e},
|
||||||
|
|
@ -178,7 +178,7 @@ bool settings_set_color(const char* key, const char* hex) {
|
||||||
|
|
||||||
|
|
||||||
bool settings_set_tones(const char* key, const char* tones) {
|
bool settings_set_tones(const char* key, const char* tones) {
|
||||||
if (strlen(key) <= 6 || strcmp(key + strlen(key) - 6, "_tones") != 0) {
|
if (strlen(key) <= 6 || strncmp(key, "tones_", 6) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!apply_kv(key, tones)) return false; // unknown key or bad tones
|
if (!apply_kv(key, tones)) return false; // unknown key or bad tones
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue