diff --git a/data/config.txt b/data/config.txt index 0c08b4a..dc4680a 100644 --- a/data/config.txt +++ b/data/config.txt @@ -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 diff --git a/src/meshberry/chat.cpp b/src/meshberry/chat.cpp index 6fa072d..5f44bd2 100644 --- a/src/meshberry/chat.cpp +++ b/src/meshberry/chat.cpp @@ -404,9 +404,9 @@ 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); + : settings_set_color(args, sp + 1); if (ok) ui_push_message("", "Saved. Restart to apply.", false, true); else if (is_tones) @@ -657,7 +657,7 @@ static void go_to_sleep() { snprintf(m, sizeof(m), "%s left the chat!", currentNick); // broadcastChatMessage("System", m); // same here, only show don't broadcasst ui_push_message("", m, false, true); - + delay(200); // let the packet fly // Hold the backlight OFF pin through deep sleep so the screen stays dark. diff --git a/src/meshberry/compat.h b/src/meshberry/compat.h new file mode 100644 index 0000000..555cf31 --- /dev/null +++ b/src/meshberry/compat.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +// Replace the calls that MMLMusic makes to the +// AVR function strchr_P to strchr +#ifndef strchr_P +#define strchr_P strchr +#endif \ No newline at end of file diff --git a/src/meshberry/settings.cpp b/src/meshberry/settings.cpp index 3226410..6cc8593 100644 --- a/src/meshberry/settings.cpp +++ b/src/meshberry/settings.cpp @@ -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