mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 15:16:40 +00:00
feat(sim): host-page buzzer mute hook + randomized repeater names
sim_buzzer_toggle_quiet()/sim_buzzer_get_quiet() (UITask.cpp) call the
literal UITask::toggleBuzzer() the real on-device Settings > Buzzer mute
toggle already calls -- persists into NodePrefs.buzzer_quiet, clears
buzzer_auto, saves prefs, shows the real "Buzzer: ON/OFF" alert. Not a
re-implementation, not a host-side Web Audio mute layered on top.
Every simple_repeater instance advertised the literal ADVERT_NAME
("repeater") -- across meshcore-solo-site's cross-visitor relay bridge
every hop in every path/relay list was an indistinguishable wall of
"repeater"s. A SIM_PLATFORM/__EMSCRIPTEN__-only default now picks a
random "<adjective> <geographic feature>" pair from
sim_instance_entropy() (real crypto.getRandomValues()-sourced entropy,
already used for RNG seeding) at first boot -- matches the real,
common ham-radio convention of naming a repeater after the hill it
sits on. Persists normally across reboots via the existing prefs
load/save path, same as a real operator-set name would.
sim_repeater_get_name() added alongside the existing
sim_repeater_get_relay_count() for host-page/test access to the
result.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iubftDmKNWmkNnhJRz8UH
This commit is contained in:
@@ -2191,6 +2191,22 @@ extern "C" EMSCRIPTEN_KEEPALIVE int sim_buzzer_freq_hz() {
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE int sim_buzzer_get_volume() {
|
||||
return g_sim_ui_task_for_js ? (int)g_sim_ui_task_for_js->buzzerVolume() : 0;
|
||||
}
|
||||
|
||||
// Write side: a host page's own mute control (a button next to the d-pad,
|
||||
// say) calling this fires UITask::toggleBuzzer() -- the literal function
|
||||
// the real on-device Settings > Buzzer mute toggle calls, not a
|
||||
// re-implementation of it. That single call already does everything the
|
||||
// real toggle does: buzzer.quiet(), writes NodePrefs.buzzer_quiet, clears
|
||||
// buzzer_auto (manual mute always wins over auto-mute-on-BT-connect,
|
||||
// same as pressing it on the device would), the_mesh.savePrefs(), and
|
||||
// the real on-screen "Buzzer: ON/OFF" alert -- so muting from the host
|
||||
// page's button is visibly the same event as muting from the keypad.
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE void sim_buzzer_toggle_quiet() {
|
||||
if (g_sim_ui_task_for_js) g_sim_ui_task_for_js->toggleBuzzer();
|
||||
}
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE int sim_buzzer_get_quiet() {
|
||||
return (g_sim_ui_task_for_js && g_sim_ui_task_for_js->isBuzzerQuiet()) ? 1 : 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user