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
|
||||
brightness=200
|
||||
|
||||
tones_msg=T300 O4 l8 D l4 A+
|
||||
tones_sys=T300 O4 l8 A l4 D+
|
||||
tones_msg=t300 d8 a+4
|
||||
tones_sys=t300 a8 d+4
|
||||
|
||||
touch_threshold=300
|
||||
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ void handleCommand(const char* in) {
|
|||
} else {
|
||||
*sp = '\0';
|
||||
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)
|
||||
: settings_set_color(args, sp + 1);
|
||||
if (ok)
|
||||
|
|
|
|||
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 = {
|
||||
.nick = NICK_DEFAULT_PREFIX,
|
||||
.brightness = 200,
|
||||
.tones_msg = "T140 G",
|
||||
.tones_sys = "T140 A",
|
||||
.tones_msg = "t300 d8 a+4",
|
||||
.tones_sys = "t300 a8 d+4",
|
||||
.touch_threshold = TOUCH_THRESHOLD,
|
||||
.color_bg = {.blue = 0x11, .green = 0x11, .red = 0x11},
|
||||
.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) {
|
||||
if (strlen(key) <= 6 || strcmp(key + strlen(key) - 6, "_tones") != 0) {
|
||||
if (strlen(key) <= 6 || strncmp(key, "tones_", 6) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (!apply_kv(key, tones)) return false; // unknown key or bad tones
|
||||
|
|
|
|||
Loading…
Reference in a new issue