From 83f00ab200355b684b0ebb1ca67bfc377ba9ff58 Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Wed, 20 May 2026 22:51:41 +0200 Subject: [PATCH] =?UTF-8?q?refactor=20-=20src/Mesh.cpp=09Reverted=20#ifdef?= =?UTF-8?q?=20ZEPHCORE=5FCOMPANION=20block=20=E2=86=92=20back=20to=20vanil?= =?UTF-8?q?la=20self=5Fid.copyHashTo=20-=20helpers/ContactInfo.h=09Removed?= =?UTF-8?q?=20OUT=5FPATH=5FSENT=20-=20helpers/ui-joystick/joystick=5Fdefs.?= =?UTF-8?q?h=09Added=20OUT=5FPATH=5FSENT=20here=20(with=20comment=20clarif?= =?UTF-8?q?ying=20it's=20UI-only)=20-=20helpers/ui-joystick/joystick=5Fui?= =?UTF-8?q?=5Ftask.h=09Removed=20dead=20=5Fnext=5Fbatt=5Frefresh=20field?= =?UTF-8?q?=20-=20helpers/ui-joystick/joystick=5Fui=5Ftask.cpp=09Removed?= =?UTF-8?q?=20=5Fnext=5Fbatt=5Frefresh(0)=20from=20ctor=20init=20list=20-?= =?UTF-8?q?=20helpers/ui-joystick/joystick=5Fscreens.h=09MsgEntry::origin[?= =?UTF-8?q?80]=E2=86=92[32];=20MAX=5FUNREAD=5FMSGS=2032=E2=86=9216=20-=20K?= =?UTF-8?q?config=09DOOM=20help=20text=20now=20lists=20both=20UI=20activat?= =?UTF-8?q?ion=20paths=20-=20ARCHITECTURE.md=09Same=20correction=20in=20?= =?UTF-8?q?=C2=A78.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zephcore/ARCHITECTURE.md | 2 +- zephcore/Kconfig | 5 +++-- zephcore/helpers/ContactInfo.h | 1 - zephcore/helpers/ui-joystick/joystick_defs.h | 6 ++++++ zephcore/helpers/ui-joystick/joystick_screens.h | 4 ++-- zephcore/helpers/ui-joystick/joystick_ui_task.cpp | 2 +- zephcore/helpers/ui-joystick/joystick_ui_task.h | 1 - zephcore/src/Mesh.cpp | 11 +---------- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/zephcore/ARCHITECTURE.md b/zephcore/ARCHITECTURE.md index 21c842e..3d40a53 100644 --- a/zephcore/ARCHITECTURE.md +++ b/zephcore/ARCHITECTURE.md @@ -502,7 +502,7 @@ Non-blocking RTTTL parser on dedicated work queue. Predefined melodies for start ### 8.5 Doom Easter Egg -Wolf3D-style raycaster on OLED: textured walls, 2 enemy types, shooting, HUD. Bypasses CFB, writes directly to display. ~1.7KB RAM, ~5KB flash. Enabled via `CONFIG_ZEPHCORE_EASTER_EGG_DOOM`. Triple-press ENTER on Messages page to activate. +Wolf3D-style raycaster on OLED: textured walls, 2 enemy types, shooting, HUD. Bypasses CFB, writes directly to display. ~1.7KB RAM, ~5KB flash. Enabled via `CONFIG_ZEPHCORE_EASTER_EGG_DOOM`. Button UI: triple-press ENTER on Messages page. Joystick UI: Tools menu → "Doom". --- diff --git a/zephcore/Kconfig b/zephcore/Kconfig index a31d357..c1ced08 100644 --- a/zephcore/Kconfig +++ b/zephcore/Kconfig @@ -600,8 +600,9 @@ config ZEPHCORE_EASTER_EGG_DOOM depends on ZEPHCORE_UI_DISPLAY && ZEPHCORE_UI_BUTTONS help Hidden easter egg: Wolf3D-style raycaster on the OLED. - Activate with double-click + single-click joystick center - on the first page. Double-click to exit. + Button UI: triple-press ENTER on the Messages page. + Joystick UI: open the Tools menu and select "Doom". + Press BACK/ESC to exit. Adds ~5KB flash and ~1.7KB RAM when enabled. config ZEPHCORE_UI_JOYSTICK diff --git a/zephcore/helpers/ContactInfo.h b/zephcore/helpers/ContactInfo.h index 4ff707a..73d8745 100644 --- a/zephcore/helpers/ContactInfo.h +++ b/zephcore/helpers/ContactInfo.h @@ -9,7 +9,6 @@ #include #define OUT_PATH_UNKNOWN 0xFF -#define OUT_PATH_SENT 0xFE /* local-only marker */ struct ContactInfo { mesh::Identity id; diff --git a/zephcore/helpers/ui-joystick/joystick_defs.h b/zephcore/helpers/ui-joystick/joystick_defs.h index 59b7b5f..b7a2bea 100644 --- a/zephcore/helpers/ui-joystick/joystick_defs.h +++ b/zephcore/helpers/ui-joystick/joystick_defs.h @@ -47,3 +47,9 @@ /* List view constants */ #define UI_RECENT_LIST_SIZE 4 /* max items visible in a scrollable list */ + +/* UI display marker: this MsgEntry/preview slot represents a message + * WE SENT (vs received). Used only inside the joystick UI's stored-message + * structs — never assigned to ContactInfo::out_path_len, never serialized, + * never sent over the air. */ +#define OUT_PATH_SENT 0xFE diff --git a/zephcore/helpers/ui-joystick/joystick_screens.h b/zephcore/helpers/ui-joystick/joystick_screens.h index 8188db3..2c726c3 100644 --- a/zephcore/helpers/ui-joystick/joystick_screens.h +++ b/zephcore/helpers/ui-joystick/joystick_screens.h @@ -376,12 +376,12 @@ class UnreadScreen : public UIScreen { struct MsgEntry { uint32_t timestamp; - char origin[80]; + char origin[32]; char msg[240]; bool read; }; - static const int MAX_UNREAD_MSGS = 32; + static const int MAX_UNREAD_MSGS = 16; MsgEntry _entries[MAX_UNREAD_MSGS]; int _entry_count; int _visible_unread_count; diff --git a/zephcore/helpers/ui-joystick/joystick_ui_task.cpp b/zephcore/helpers/ui-joystick/joystick_ui_task.cpp index 5a2416c..f7cbd0a 100644 --- a/zephcore/helpers/ui-joystick/joystick_ui_task.cpp +++ b/zephcore/helpers/ui-joystick/joystick_ui_task.cpp @@ -175,7 +175,7 @@ JoystickUITask::JoystickUITask() #endif _repeater_admin(nullptr), _curr(nullptr), _next_refresh(0), _auto_off(0), _screen_off_ms(AUTO_OFF_MILLIS), - _next_batt_refresh(0), _cached_batt_mv(0), _battery_display_mode(0), + _cached_batt_mv(0), _battery_display_mode(0), _brightness(100), _wake_on_msg(true), _ble_connected(false), _ble_enabled(true), _msgcount(0), _noise_floor(-120), _pkt_recv(0), _pkt_sent(0), _pkt_errors(0), _alert_expiry(0), diff --git a/zephcore/helpers/ui-joystick/joystick_ui_task.h b/zephcore/helpers/ui-joystick/joystick_ui_task.h index 271cff5..4d23ac4 100644 --- a/zephcore/helpers/ui-joystick/joystick_ui_task.h +++ b/zephcore/helpers/ui-joystick/joystick_ui_task.h @@ -230,7 +230,6 @@ private: uint32_t _next_refresh; uint32_t _auto_off; uint32_t _screen_off_ms; - uint32_t _next_batt_refresh; /* State */ uint16_t _cached_batt_mv; diff --git a/zephcore/src/Mesh.cpp b/zephcore/src/Mesh.cpp index 2334b62..2fda297 100644 --- a/zephcore/src/Mesh.cpp +++ b/zephcore/src/Mesh.cpp @@ -92,16 +92,7 @@ DispatcherAction Mesh::routeRecvPacket(Packet *packet) if (packet->isRouteFlood() && !packet->isMarkedDoNotRetransmit() && (n + 1)*packet->getPathHashSize() <= MAX_PATH_SIZE && allowPacketForward(packet)) { // append this node's hash to 'path' -#ifdef ZEPHCORE_COMPANION - uint8_t prefix[4] = {}; - /* Avoid confusions while using offgrid mode with real repeaters and force 01 (MOBILE node) */ - prefix[0] = 0x01; - memcpy(&packet->path[n * packet->getPathHashSize()], - prefix, - packet->getPathHashSize()); -#else - self_id.copyHashTo(&packet->path[n * packet->getPathHashSize()], packet->getPathHashSize()); -#endif + self_id.copyHashTo(&packet->path[n * packet->getPathHashSize()], packet->getPathHashSize()); packet->setPathHashCount(n + 1); uint32_t h = ContentionTracker::computePacketHash32(packet); _contention.trackRetransmit(h, (uint32_t)_ms->getMillis());