Add Zira spoken button confirmations and opt-in G726 speech tests
This commit is contained in:
1 parent
f0199b3111
commit
c917158167
33 files changed
+11977
-30
No files matched your search
@@ -295,6 +295,13 @@ jobs:
|
||||
|
||||
- name: Verify Companion Bluetooth settings and WebConfig
|
||||
run: |
|
||||
python3 -B test/test_gps_voice_buttons.py -v
|
||||
python3 -B test/test_gps_voice_generator.py -v
|
||||
python3 -B test/test_button_voice_actions.py -v
|
||||
python3 -B test/test_button_voice_generator.py -v
|
||||
python3 -B test/test_button_voice_preview.py -v
|
||||
python3 -B test/test_g726_voice.py -v
|
||||
python3 -B test/test_g726_voice_generator.py -v
|
||||
python3 -B test/test_nimble_companion.py
|
||||
python3 -B test/test_bluetooth_pairing_ui.py
|
||||
python3 -B test/test_companion_pairing_display.py
|
||||
|
||||
@@ -47,6 +47,68 @@ a busy radio rollback remains pending for recovery instead of reporting success.
|
||||
| LoRa self-update | No | No |
|
||||
| Optional self-update | WiFi on existing dual-app layouts; USB on single-app layouts | Bluetooth DFU with a compatible bootloader; USB always supported |
|
||||
|
||||
### Screenless nRF52 spoken button confirmations
|
||||
|
||||
Full Companion builds for T1000-E, RAK WisMesh Tag, MeshTracker X1,
|
||||
Muziworks R1 Neo and ThinkNode M3 use prerecorded spoken confirmations for
|
||||
their shared single-button controls. Other roles, legacy USB/BLE-only builds,
|
||||
screened boards and all Wio profiles retain their existing audio behavior.
|
||||
Set `MESH_GPS_VOICE=0` at build time to retain tones on an eligible Full build.
|
||||
|
||||
| User-button gesture | Action / spoken confirmation |
|
||||
| --- | --- |
|
||||
| One press | Acknowledge an active notification: "Notification cleared"; otherwise "Ready" |
|
||||
| Two presses | "Advert queued" or "Advert failed" |
|
||||
| Three presses | "Sound on" or "Sound off" after the preference is saved |
|
||||
| Four presses | "GPS on" or "GPS off" when the GPS setting is available |
|
||||
| Hold more than three seconds | "Shutting down"; shutdown remains nonblocking while audio drains |
|
||||
| Hold during the first eight seconds of UI startup | "USB setup" for terminal/rescue mode |
|
||||
|
||||
MeshTracker X1's three-press gesture instead cycles "Sound and vibration",
|
||||
"Sound only", "Vibration only", and "Silent". The new setting must save before
|
||||
either live alert output changes. A failed save restores both preferences and
|
||||
announces "Action failed". An explicit mute or alert-mode change permits one
|
||||
courtesy confirmation without unmuting ordinary notifications. The four
|
||||
additional mode clips are compiled only for `HAS_DRV2605` builds.
|
||||
Notification timers cannot cancel control speech, and the committed alert
|
||||
mode remains authoritative for vibration even if a notification-mask save fails.
|
||||
|
||||
Power-on and wake wiring remain board-specific. Speech is nonblocking and uses
|
||||
the existing nRF52 PWM player; each buzzer still needs a physical listening
|
||||
test for intelligibility. All spoken button, alert-mode and GPS recordings use
|
||||
Microsoft Zira Desktop with the selected compressed Companion voice profile.
|
||||
R1 Neo's buzzer pin aliases its optional QSPI clock, so voice is
|
||||
not default-enabled when `QSPIFLASH` is selected. ThinkNode M4 is deliberately
|
||||
excluded: its former
|
||||
buzzer definitions incorrectly claimed I2C SDA and a battery-status LED, not
|
||||
verified audio hardware. Its Companion recipes no longer drive those pins as
|
||||
a buzzer.
|
||||
|
||||
The optional ESP32 RC32-without-display recipe is not part of this nRF52
|
||||
extension: its fitted audio hardware needs verification and its `ui-new`
|
||||
controls require an ESP32 playback backend, not the nRF52 PWM player.
|
||||
|
||||
#### Experimental G.726 speech
|
||||
|
||||
Ordinary builds still use the approved Zira IMA recordings. G.726 is a hardware
|
||||
test option only: set both `MESH_BUTTON_AUDIO_HIL=1` and
|
||||
`MESH_GPS_VOICE_G726_BITRATE=16` or `24`. Invalid bitrates or a missing test gate
|
||||
are rejected. The generated catalog selects exactly one bitrate, retains the
|
||||
original sample counts, and omits the X1-only mode prompts on other boards.
|
||||
|
||||
The decoder needs 52 bytes of state, no heap or full-clip buffer, and about
|
||||
1.2 KiB of Cortex-M4 code/tables. Its packing, resets and PWM lifecycle are
|
||||
checked against independently pinned FFmpeg output. At 24 kbps the audio
|
||||
payload is 25% smaller; at 16 kbps it is 50% smaller with more waveform error.
|
||||
Neither software comparisons nor successful builds qualify physical buzzer
|
||||
intelligibility or the refill deadline under Bluetooth/radio load.
|
||||
|
||||
`scripts/generate_g726_voice.py` regenerates both experimental catalogs from
|
||||
the approved mono 8 kHz Zira WAVs using FFmpeg's MSB-first `g726` encoder.
|
||||
Production IMA headers cannot be selected as its output. The decoder's Sun
|
||||
provenance, attributed FFmpeg MIX interpolation and LGPL license are retained
|
||||
in `src/helpers/ui/g726`; no claim of independent ITU conformance is made.
|
||||
|
||||
### nRF52 Bluetooth reconnect qualification
|
||||
|
||||
Full Companions persist the paired client's notification subscriptions (CCCDs)
|
||||
|
||||
@@ -117,6 +117,9 @@ public:
|
||||
// override these hooks. The default keeps setup-screen routing compatible
|
||||
// with older UIs that handle pairing only from their regular loop.
|
||||
virtual void servicePairingState() {}
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
virtual bool handleButtonAudioTest(const char*, char*, size_t) { return false; }
|
||||
#endif
|
||||
virtual bool isPairingPromptActive() const { return false; }
|
||||
virtual void loop() = 0;
|
||||
};
|
||||
@@ -3194,13 +3194,12 @@ bool MyMesh::handleLocalControlCommand(const char* command, char* reply,
|
||||
return true;
|
||||
}
|
||||
const bool enabled = strcmp(gps_value, "on") == 0;
|
||||
if (!sensors.setSettingValue("gps", enabled ? "1" : "0")) {
|
||||
if (sensors.getSettingByKey("gps") == nullptr) {
|
||||
snprintf(reply, reply_size, "Error: GPS unavailable");
|
||||
} else {
|
||||
if (savePreference(_prefs.gps_enabled, static_cast<uint8_t>(enabled))) {
|
||||
if (setGpsEnabled(enabled)) {
|
||||
snprintf(reply, reply_size, "OK - GPS %s (saved)", enabled ? "on" : "off");
|
||||
} else {
|
||||
applyGpsPrefs();
|
||||
snprintf(reply, reply_size, "Error: GPS could not be saved");
|
||||
}
|
||||
}
|
||||
@@ -7242,6 +7241,15 @@ bool MyMesh::saveAdvertName(const char* name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
bool MyMesh::setGpsEnabled(bool enabled) {
|
||||
if (!sensors.setSettingValue("gps", enabled ? "1" : "0")) return false;
|
||||
if (savePreference(_prefs.gps_enabled, static_cast<uint8_t>(enabled))) return true;
|
||||
applyGpsPrefs();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool MyMesh::saveAdvertLocation(double latitude, double longitude) {
|
||||
const double previous_lat = sensors.node_lat, previous_lon = sensors.node_lon;
|
||||
sensors.node_lat = latitude;
|
||||
@@ -9291,6 +9299,10 @@ static bool isCompanionRadioPrefsCommand(const char* command) {
|
||||
// Called only for directly attached USB/BLE/TCP/browser clients. Commands
|
||||
// received over LoRa use handleCommand() with a nonzero sender timestamp.
|
||||
bool MyMesh::handleDirectCommand(const char* command, char* reply, size_t reply_size) {
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
// Present only in an explicitly instrumented physical-test build.
|
||||
if (_ui && _ui->handleButtonAudioTest(command, reply, reply_size)) return true;
|
||||
#endif
|
||||
#if defined(MESH_SOAK_DIAGNOSTICS)
|
||||
if (mesh::hil::handleSoakCommand(command, reply, reply_size)) return true;
|
||||
#endif
|
||||
|
||||
@@ -427,6 +427,7 @@ public:
|
||||
#endif
|
||||
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
bool setGpsEnabled(bool enabled);
|
||||
void applyGpsPrefs() {
|
||||
sensors.setSettingValue("gps", _prefs.gps_enabled ? "1" : "0");
|
||||
char interval_str[12]; // Max: 24 hours = 86400 seconds (5 digits + null)
|
||||
|
||||
@@ -69,6 +69,17 @@ void Button::update() {
|
||||
}
|
||||
|
||||
bool Button::readButton() {
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
if (_hil_active) {
|
||||
const uint32_t now = millis();
|
||||
if (static_cast<int32_t>(now - _hil_at) >= 0) {
|
||||
_hil_down = !_hil_down;
|
||||
if (!_hil_down && --_hil_remaining == 0) _hil_active = false;
|
||||
_hil_at = now + (_hil_down ? _hil_hold_ms : 120);
|
||||
}
|
||||
return _hil_down;
|
||||
}
|
||||
#endif
|
||||
if (_isAnalog) {
|
||||
return (analogRead(_pin) < _analogThreshold);
|
||||
} else {
|
||||
@@ -76,6 +87,18 @@ bool Button::readButton() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
bool Button::injectPresses(uint8_t clicks, uint32_t hold_ms) {
|
||||
if (_hil_active || _state != IDLE || clicks < 1 || clicks > 4) return false;
|
||||
_hil_active = true;
|
||||
_hil_down = false;
|
||||
_hil_remaining = clicks;
|
||||
_hil_hold_ms = hold_ms;
|
||||
_hil_at = millis() + 50;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Button::handleStateChange() {
|
||||
uint32_t now = millis();
|
||||
|
||||
@@ -128,4 +151,4 @@ void Button::triggerEvent(EventType event) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,8 +40,17 @@ public:
|
||||
// State getters
|
||||
bool isPressed() const { return _currentState; }
|
||||
EventType getLastEvent() const { return _lastEvent; }
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
bool injectPresses(uint8_t clicks, uint32_t hold_ms = 120);
|
||||
bool injecting() const { return _hil_active; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
bool _hil_active = false, _hil_down = false;
|
||||
uint8_t _hil_remaining = 0;
|
||||
uint32_t _hil_at = 0, _hil_hold_ms = 120;
|
||||
#endif
|
||||
enum State {
|
||||
IDLE,
|
||||
PRESSED,
|
||||
@@ -77,4 +86,4 @@ private:
|
||||
bool readButton();
|
||||
void handleStateChange();
|
||||
void triggerEvent(EventType event);
|
||||
};
|
||||
};
|
||||
@@ -212,6 +212,9 @@ bool UITask::shouldPlayMessageTone() const {
|
||||
}
|
||||
|
||||
void UITask::notify(UIEventType t) {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
#endif
|
||||
#if defined(PIN_BUZZER)
|
||||
if (_notification_outputs & mesh::notify::Sound) switch(t){
|
||||
case UIEventType::contactMessage:
|
||||
@@ -588,6 +591,23 @@ void UITask::userLedHandler() {
|
||||
hardware-agnostic pre-shutdown activity should be done here
|
||||
*/
|
||||
void UITask::shutdown(bool restart){
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
if (!prepareForShutdown()) {
|
||||
buzzer.speakButton(ButtonVoicePrompt::ActionFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep the main loop running while the tone and spoken confirmation drain,
|
||||
// so USB, Bluetooth and radio service are not held inside this callback.
|
||||
_shutdown_restart = restart;
|
||||
_shutdown_started_at = millis();
|
||||
_shutdown_pending = true;
|
||||
if (!buzzer.speakButton(restart ? ButtonVoicePrompt::Restarting
|
||||
: ButtonVoicePrompt::ShuttingDown)) {
|
||||
buzzer.shutdown();
|
||||
}
|
||||
#else
|
||||
if (!prepareForShutdown()) return;
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
@@ -609,8 +629,33 @@ void UITask::shutdown(bool restart){
|
||||
// Power off board including radio, display, GPS and components
|
||||
_board->powerOff();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
void UITask::servicePendingShutdown() {
|
||||
if (!_shutdown_pending) return;
|
||||
if (buzzer.isPlaying()
|
||||
&& static_cast<uint32_t>(millis() - _shutdown_started_at) < 5000UL) {
|
||||
return;
|
||||
}
|
||||
|
||||
buzzer.stop();
|
||||
_shutdown_pending = false;
|
||||
// New radio/host work can arrive during the announcement. Flush it too
|
||||
// before entering the board's irreversible shutdown state.
|
||||
if (!prepareForShutdown()) {
|
||||
buzzer.speakButton(ButtonVoicePrompt::ActionFailed);
|
||||
return;
|
||||
}
|
||||
if (_shutdown_restart) {
|
||||
_board->reboot();
|
||||
} else {
|
||||
_board->powerOff();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool UITask::isPairingScreenActive() const {
|
||||
return mesh::ui::isBluetoothPairingPromptActive(
|
||||
isBluetoothEnabled(), hasBluetoothConnection(),
|
||||
@@ -682,6 +727,9 @@ void UITask::loop() {
|
||||
#ifdef PIN_BUZZER
|
||||
if (buzzer.isPlaying()) buzzer.loop();
|
||||
#endif
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
servicePendingShutdown();
|
||||
#endif
|
||||
|
||||
if (_display != NULL && _display->isOn()) {
|
||||
if (!isPairingScreenActive() && !_alert[0] && !(_origin[0] && _msg[0])
|
||||
@@ -704,7 +752,13 @@ void UITask::loop() {
|
||||
}
|
||||
|
||||
void UITask::handleButtonAnyPress() {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
_button_notification_cleared = the_mesh.notificationButton()
|
||||
|| _button_notification_cleared;
|
||||
#else
|
||||
the_mesh.notificationButton();
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("UITask: any press triggered");
|
||||
// called on any button press before other events, to wake up the display quickly
|
||||
// do not refresh the display here, as it may block the button handler
|
||||
@@ -716,6 +770,15 @@ void UITask::handleButtonAnyPress() {
|
||||
}
|
||||
|
||||
void UITask::handleButtonShortPress() {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
const bool notification_cleared = _button_notification_cleared;
|
||||
_button_notification_cleared = false;
|
||||
if (_display == NULL) {
|
||||
buzzer.speakButton(notification_cleared
|
||||
? ButtonVoicePrompt::NotificationCleared : ButtonVoicePrompt::Ready);
|
||||
}
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("UITask: short press triggered");
|
||||
if (_display != NULL) {
|
||||
// Only clear message preview if display was already on before button press
|
||||
@@ -743,14 +806,32 @@ void UITask::handleButtonShortPress() {
|
||||
}
|
||||
|
||||
void UITask::handleButtonDoublePress() {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
_button_notification_cleared = false;
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("UITask: double press triggered, sending advert");
|
||||
// ADVERT
|
||||
#ifdef PIN_BUZZER
|
||||
notify(UIEventType::ack);
|
||||
#endif
|
||||
if (the_mesh.advert()) {
|
||||
#if !(defined(PIN_BUZZER) && MESH_GPS_VOICE)
|
||||
#ifdef PIN_BUZZER
|
||||
notify(UIEventType::ack);
|
||||
#endif
|
||||
#endif
|
||||
const bool queued = the_mesh.advert();
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (!buzzer.speakButton(queued ? ButtonVoicePrompt::AdvertQueued
|
||||
: ButtonVoicePrompt::AdvertFailed)) {
|
||||
notify(UIEventType::ack);
|
||||
}
|
||||
#endif
|
||||
if (queued) {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
MESH_DEBUG_PRINTLN("Advert queued!");
|
||||
sprintf(_alert, "Advert queued!");
|
||||
#else
|
||||
MESH_DEBUG_PRINTLN("Advert sent!");
|
||||
sprintf(_alert, "Advert sent!");
|
||||
#endif
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("Advert failed!");
|
||||
sprintf(_alert, "Advert failed..");
|
||||
@@ -759,19 +840,44 @@ void UITask::handleButtonDoublePress() {
|
||||
}
|
||||
|
||||
void UITask::handleButtonTriplePress() {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
_button_notification_cleared = false;
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("UITask: triple press triggered");
|
||||
#if defined(PIN_BUZZER) && defined(HAS_DRV2605)
|
||||
// cycle alert modes: Buzz+Vibe -> Buzz only -> Vibe only -> Silent
|
||||
#if MESH_GPS_VOICE
|
||||
const uint8_t previous_sound = _node_prefs->buzzer_quiet;
|
||||
const uint8_t previous_vibration = _node_prefs->vibe_quiet;
|
||||
#endif
|
||||
int mode = (_node_prefs->buzzer_quiet ? 2 : 0) | (_node_prefs->vibe_quiet ? 1 : 0);
|
||||
mode = (mode + 1) & 3;
|
||||
_node_prefs->buzzer_quiet = (mode & 2) ? 1 : 0;
|
||||
_node_prefs->vibe_quiet = (mode & 1) ? 1 : 0;
|
||||
#if MESH_GPS_VOICE
|
||||
// Announce only committed settings. A failed write must not change either
|
||||
// live alert output, including the notification engine's mute masks.
|
||||
if (!the_mesh.savePrefs()) {
|
||||
_node_prefs->buzzer_quiet = previous_sound;
|
||||
_node_prefs->vibe_quiet = previous_vibration;
|
||||
sprintf(_alert, "Alerts: Save failed");
|
||||
buzzer.speakButton(ButtonVoicePrompt::ActionFailed, true);
|
||||
_need_refresh = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
buzzer.quiet(_node_prefs->buzzer_quiet);
|
||||
vibration.quiet(_node_prefs->vibe_quiet);
|
||||
#if MESH_GPS_VOICE
|
||||
if (_node_prefs->vibe_quiet) vibration.stop();
|
||||
#endif
|
||||
the_mesh.setNotificationOutputMute(mesh::notify::Sound, _node_prefs->buzzer_quiet);
|
||||
the_mesh.setNotificationOutputMute(mesh::notify::Vibration, _node_prefs->vibe_quiet);
|
||||
// audible/tactile confirmation of the new mode (no screen on some boards)
|
||||
#if !MESH_GPS_VOICE
|
||||
if (!_node_prefs->buzzer_quiet) notify(UIEventType::ack);
|
||||
#endif
|
||||
if (!_node_prefs->vibe_quiet) vibration.trigger(true);
|
||||
switch (mode) {
|
||||
case 0: sprintf(_alert, "Alerts: Buzz+Vibe"); break;
|
||||
@@ -779,9 +885,42 @@ void UITask::handleButtonTriplePress() {
|
||||
case 2: sprintf(_alert, "Alerts: Vibe only"); break;
|
||||
default: sprintf(_alert, "Alerts: Silent"); break;
|
||||
}
|
||||
#if MESH_GPS_VOICE
|
||||
static const ButtonVoicePrompt mode_prompts[] = {
|
||||
ButtonVoicePrompt::AlertsSoundVibration,
|
||||
ButtonVoicePrompt::AlertsSoundOnly,
|
||||
ButtonVoicePrompt::AlertsVibrationOnly,
|
||||
ButtonVoicePrompt::AlertsSilent,
|
||||
};
|
||||
// One courtesy announcement is allowed for vibration-only/silent modes,
|
||||
// without unmuting ordinary notifications or changing the saved mode.
|
||||
buzzer.speakButton(mode_prompts[mode], true);
|
||||
#else
|
||||
the_mesh.savePrefs();
|
||||
#endif
|
||||
_need_refresh = true;
|
||||
#elif defined(PIN_BUZZER)
|
||||
#if MESH_GPS_VOICE
|
||||
const bool previous_quiet = buzzer.isQuiet();
|
||||
const uint8_t previous_preference = _node_prefs->buzzer_quiet;
|
||||
const bool quiet = !previous_quiet;
|
||||
_node_prefs->buzzer_quiet = quiet;
|
||||
if (the_mesh.savePrefs()) {
|
||||
buzzer.quiet(quiet);
|
||||
the_mesh.setNotificationOutputMute(mesh::notify::Sound, quiet);
|
||||
sprintf(_alert, quiet ? "Buzzer: OFF" : "Buzzer: ON");
|
||||
// A user-requested mute gets one final confirmation without changing
|
||||
// the stored quiet state or allowing ordinary notifications through.
|
||||
buzzer.speakButton(quiet ? ButtonVoicePrompt::SoundOff
|
||||
: ButtonVoicePrompt::SoundOn, true);
|
||||
} else {
|
||||
_node_prefs->buzzer_quiet = previous_preference;
|
||||
buzzer.quiet(previous_quiet);
|
||||
sprintf(_alert, "Buzzer: Save failed");
|
||||
buzzer.speakButton(ButtonVoicePrompt::ActionFailed, true);
|
||||
}
|
||||
_need_refresh = true;
|
||||
#else
|
||||
if (buzzer.isQuiet()) {
|
||||
buzzer.quiet(false);
|
||||
notify(UIEventType::ack);
|
||||
@@ -795,40 +934,148 @@ void UITask::handleButtonTriplePress() {
|
||||
the_mesh.savePrefs();
|
||||
_need_refresh = true;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void UITask::handleButtonQuadruplePress() {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
_button_notification_cleared = false;
|
||||
bool gps_changed = false;
|
||||
sprintf(_alert, "GPS: Unavailable");
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("UITask: quad press triggered");
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
if (_sensors != NULL) {
|
||||
// toggle GPS onn/off
|
||||
int num = _sensors->getNumSettings();
|
||||
for (int i = 0; i < num; i++) {
|
||||
if (strcmp(_sensors->getSettingName(i), "gps") == 0) {
|
||||
if (strcmp(_sensors->getSettingValue(i), "1") == 0) {
|
||||
_sensors->setSettingValue("gps", "0");
|
||||
notify(UIEventType::ack);
|
||||
sprintf(_alert, "GPS: Disabled");
|
||||
} else {
|
||||
_sensors->setSettingValue("gps", "1");
|
||||
notify(UIEventType::ack);
|
||||
sprintf(_alert, "GPS: Enabled");
|
||||
}
|
||||
break;
|
||||
const char* gps = _sensors->getSettingByKey("gps");
|
||||
if (gps != nullptr) {
|
||||
const bool enabled = gps[0] != '1';
|
||||
if (the_mesh.setGpsEnabled(enabled)) {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
gps_changed = true;
|
||||
#endif
|
||||
#ifdef PIN_BUZZER
|
||||
if (!buzzer.speakGps(enabled)) notify(UIEventType::ack);
|
||||
#else
|
||||
notify(UIEventType::ack);
|
||||
#endif
|
||||
sprintf(_alert, enabled ? "GPS: Enabled" : "GPS: Disabled");
|
||||
} else {
|
||||
sprintf(_alert, "GPS: Save failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (!gps_changed) buzzer.speakButton(ButtonVoicePrompt::ActionFailed);
|
||||
#endif
|
||||
_need_refresh = true;
|
||||
}
|
||||
|
||||
void UITask::handleButtonLongPress() {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
_button_notification_cleared = false;
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("UITask: long press triggered");
|
||||
if (millis() - ui_started_at < 8000) { // long press in first 8 seconds since startup -> CLI/rescue
|
||||
the_mesh.enterCLIRescue();
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
// enterCLIRescue is supported independently of the framed USB interface.
|
||||
buzzer.speakButton(ButtonVoicePrompt::UsbSetup);
|
||||
#endif
|
||||
} else {
|
||||
shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
bool UITask::handleButtonAudioTest(const char* command, char* reply, size_t size) {
|
||||
if (strncmp(command, "hil voice play ", 15) == 0) {
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
if (_shutdown_pending) {
|
||||
snprintf(reply, size, "Error: shutdown pending; preview refused");
|
||||
return true;
|
||||
}
|
||||
struct Preview {
|
||||
const char* name;
|
||||
ButtonVoicePrompt prompt;
|
||||
};
|
||||
static const Preview previews[] = {
|
||||
{"ready", ButtonVoicePrompt::Ready},
|
||||
{"notificationCleared", ButtonVoicePrompt::NotificationCleared},
|
||||
{"advertQueued", ButtonVoicePrompt::AdvertQueued},
|
||||
{"advertFailed", ButtonVoicePrompt::AdvertFailed},
|
||||
{"soundOn", ButtonVoicePrompt::SoundOn},
|
||||
{"soundOff", ButtonVoicePrompt::SoundOff},
|
||||
{"gpsOn", ButtonVoicePrompt::GpsOn},
|
||||
{"gpsOff", ButtonVoicePrompt::GpsOff},
|
||||
{"actionFailed", ButtonVoicePrompt::ActionFailed},
|
||||
{"usbSetup", ButtonVoicePrompt::UsbSetup},
|
||||
{"shuttingDown", ButtonVoicePrompt::ShuttingDown},
|
||||
{"restarting", ButtonVoicePrompt::Restarting},
|
||||
#ifdef HAS_DRV2605
|
||||
{"alertsSoundVibration", ButtonVoicePrompt::AlertsSoundVibration},
|
||||
{"alertsSoundOnly", ButtonVoicePrompt::AlertsSoundOnly},
|
||||
{"alertsVibrationOnly", ButtonVoicePrompt::AlertsVibrationOnly},
|
||||
{"alertsSilent", ButtonVoicePrompt::AlertsSilent},
|
||||
#endif
|
||||
};
|
||||
const char* name = command + 15;
|
||||
for (const auto& preview : previews) {
|
||||
if (strcmp(name, preview.name) != 0) continue;
|
||||
// This laboratory path only previews audio. It never invokes the
|
||||
// button action or changes its saved sound/GPS/shutdown preference.
|
||||
if (buzzer.speakButton(preview.prompt, true)) {
|
||||
snprintf(reply, size, "OK - preview only: %s", name);
|
||||
} else {
|
||||
snprintf(reply, size, "Error: voice preview unavailable");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
snprintf(reply, size, "Error: unknown voice preview name");
|
||||
#else
|
||||
snprintf(reply, size, "Error: voice preview unsupported");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
if (strncmp(command, "hil voice gain ", 15) == 0) {
|
||||
#ifdef PIN_BUZZER
|
||||
const char* value = command + 15;
|
||||
if (value[0] >= '1' && value[0] <= '8' && value[1] == 0
|
||||
&& buzzer.voiceGain(value[0] - '0')) {
|
||||
snprintf(reply, size, "OK - speech gain %c", value[0]);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
snprintf(reply, size, "Error: voice busy/unavailable or use gain 1..8");
|
||||
return true;
|
||||
}
|
||||
if (strcmp(command, "hil voice status") == 0) {
|
||||
#ifdef PIN_BUZZER
|
||||
buzzer.voiceStatus(reply, size);
|
||||
#else
|
||||
snprintf(reply, size, "voice unsupported");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
if (strncmp(command, "hil button ", 11) != 0) return false;
|
||||
const char* action = command + 11;
|
||||
uint8_t clicks = 0;
|
||||
uint32_t hold_ms = 120;
|
||||
if (action[0] >= '1' && action[0] <= '4' && action[1] == 0) clicks = action[0] - '0';
|
||||
else if (strcmp(action, "hold") == 0) { clicks = 1; hold_ms = 3500; }
|
||||
#ifdef PIN_USER_BTN
|
||||
if (clicks != 0 && _userButton && _userButton->injectPresses(clicks, hold_ms)) {
|
||||
snprintf(reply, size, "OK - injected %u press(es), hold %lu ms", clicks, (unsigned long)hold_ms);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
snprintf(reply, size, "Error: button busy or use hil button 1|2|3|4|hold");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t UITask::notificationCapabilities() const {
|
||||
uint8_t bits = 0;
|
||||
@@ -845,7 +1092,13 @@ uint8_t UITask::notificationCapabilities() const {
|
||||
}
|
||||
void UITask::notificationMelody(const char* text) {
|
||||
#ifdef PIN_BUZZER
|
||||
if (text) buzzer.playNotification(text); else buzzer.stop();
|
||||
#if MESH_GPS_VOICE
|
||||
if (_shutdown_pending) return;
|
||||
// The physical sound preference is authoritative even if the separate
|
||||
// programmable-notification settings file could not be saved.
|
||||
if (text && buzzer.isQuiet()) return;
|
||||
#endif
|
||||
if (text) buzzer.playNotification(text); else buzzer.stopNotification();
|
||||
#endif
|
||||
}
|
||||
void UITask::notificationScreen(int8_t mode) {
|
||||
@@ -855,6 +1108,14 @@ void UITask::notificationScreen(int8_t mode) {
|
||||
}
|
||||
void UITask::notificationVibration(bool on) {
|
||||
#ifdef HAS_DRV2605
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
// The saved physical alert mode stays authoritative even if the separate
|
||||
// notification-mask write fails. Off callbacks must still stop the driver.
|
||||
if (on && _node_prefs && _node_prefs->vibe_quiet) {
|
||||
vibration.stop();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
vibration.pulse(on);
|
||||
#elif defined(PIN_VIBRATION)
|
||||
vibration.stop();
|
||||
|
||||
@@ -44,6 +44,14 @@ class UITask : public AbstractUITask {
|
||||
int _msgcount;
|
||||
bool _need_refresh = true;
|
||||
bool _displayWasOn = false; // Track display state before button press
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
// ANY_PRESS runs once per click: keep the first acknowledged notification
|
||||
// until the eventual single/multi-click handler consumes the sequence.
|
||||
bool _button_notification_cleared = false;
|
||||
bool _shutdown_pending = false;
|
||||
bool _shutdown_restart = false;
|
||||
uint32_t _shutdown_started_at = 0;
|
||||
#endif
|
||||
unsigned long _pairing_screen_until;
|
||||
unsigned long ui_started_at;
|
||||
uint32_t _radio_profile_page_started_at = 0;
|
||||
@@ -69,6 +77,9 @@ class UITask : public AbstractUITask {
|
||||
void handleButtonTriplePress();
|
||||
void handleButtonQuadruplePress();
|
||||
void handleButtonLongPress();
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
void servicePendingShutdown();
|
||||
#endif
|
||||
bool shouldPlayMessageTone() const;
|
||||
bool isPairingScreenActive() const;
|
||||
void resetRadioProfileDisplayPage();
|
||||
@@ -112,6 +123,9 @@ public:
|
||||
void notificationMelody(const char* text) override;
|
||||
void notificationScreen(int8_t mode) override;
|
||||
void loop() override;
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
bool handleButtonAudioTest(const char* command, char* reply, size_t size) override;
|
||||
#endif
|
||||
|
||||
void shutdown(bool restart = false);
|
||||
};
|
||||
@@ -0,0 +1,84 @@
|
||||
# Reproduce the selected Zira / compressed button recordings for supported
|
||||
# Full Companions; playback gain is configured by the firmware.
|
||||
# GPS direction phrases are generated separately by generate_gps_voice.ps1.
|
||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||
param(
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$OutputDirectory = 'out/gps-voice/button-zira',
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$OutputHeader = 'src/helpers/ui/ButtonVoiceData.h',
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Voice = 'Microsoft Zira Desktop',
|
||||
# Reuse original, already selected clips while adding a new catalog entry.
|
||||
[switch]$OnlyMissing
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
# Diagnostic voices must name a deliberate header target; the default stays
|
||||
# the selected Zira / rate -1 / compressed / peak-0.12 profile.
|
||||
if (-not $PSBoundParameters.ContainsKey('OutputHeader') -and
|
||||
$Voice -ne 'Microsoft Zira Desktop') {
|
||||
throw 'Voice variants require an explicit -OutputHeader (use an out/gps-voice path for tests).'
|
||||
}
|
||||
$buttonDirectory = [IO.Path]::GetFullPath($OutputDirectory)
|
||||
$buttonHeader = [IO.Path]::GetFullPath($OutputHeader)
|
||||
if ([IO.Path]::GetExtension($buttonHeader) -ine '.h') {
|
||||
throw '-OutputHeader must name a .h file.'
|
||||
}
|
||||
if (Test-Path -LiteralPath $buttonDirectory -PathType Leaf) {
|
||||
throw '-OutputDirectory names an existing file.'
|
||||
}
|
||||
if (Test-Path -LiteralPath $buttonHeader -PathType Container) {
|
||||
throw '-OutputHeader names an existing directory.'
|
||||
}
|
||||
$buttonEncoder = Join-Path $PSScriptRoot 'generate_button_voice.py'
|
||||
if (-not (Test-Path -LiteralPath $buttonEncoder -PathType Leaf)) {
|
||||
throw "Voice encoder not found: $buttonEncoder"
|
||||
}
|
||||
if (-not $PSCmdlet.ShouldProcess($buttonHeader, "Synthesize and encode $Voice button confirmations")) {
|
||||
return
|
||||
}
|
||||
|
||||
$buttonPhrases = [ordered]@{
|
||||
ready = 'Ready'
|
||||
notificationCleared = 'Notification cleared'
|
||||
advertQueued = 'Advert queued'
|
||||
advertFailed = 'Advert failed'
|
||||
soundOn = 'Sound on'
|
||||
soundOff = 'Sound off'
|
||||
actionFailed = 'Action failed'
|
||||
usbSetup = 'USB setup'
|
||||
shuttingDown = 'Shutting down'
|
||||
restarting = 'Restarting'
|
||||
alertsSoundVibration = 'Sound and vibration'
|
||||
alertsSoundOnly = 'Sound only'
|
||||
alertsVibrationOnly = 'Vibration only'
|
||||
alertsSilent = 'Silent'
|
||||
}
|
||||
$buttonFilter = 'highpass=f=350,lowpass=f=3400,silenceremove=start_periods=1:start_threshold=-45dB,areverse,silenceremove=start_periods=1:start_threshold=-45dB,areverse,acompressor=threshold=0.08:ratio=6:attack=5:release=70:makeup=4:knee=4:detection=rms,volume=1.4,aresample=8000,alimiter=limit=0.12:level=disabled,apad=pad_dur=0.05'
|
||||
Add-Type -AssemblyName System.Speech
|
||||
$buttonVoice = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
||||
try {
|
||||
$buttonVoices = @($buttonVoice.GetInstalledVoices() | Where-Object Enabled | ForEach-Object { $_.VoiceInfo.Name })
|
||||
if ($buttonVoices -notcontains $Voice) {
|
||||
throw "Voice '$Voice' is unavailable. Installed voices: $($buttonVoices -join ', ')"
|
||||
}
|
||||
Get-Command ffmpeg, python -ErrorAction Stop | Out-Null
|
||||
$buttonVoice.SelectVoice($Voice)
|
||||
$buttonVoice.Rate = -1
|
||||
New-Item -ItemType Directory -Force -Path $buttonDirectory | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path ([IO.Path]::GetDirectoryName($buttonHeader)) | Out-Null
|
||||
foreach ($buttonName in $buttonPhrases.Keys) {
|
||||
$buttonRaw = Join-Path $buttonDirectory "$buttonName-raw.wav"
|
||||
$buttonPcm = Join-Path $buttonDirectory "$buttonName.wav"
|
||||
if ($OnlyMissing -and (Test-Path -LiteralPath $buttonPcm -PathType Leaf)) {
|
||||
continue
|
||||
}
|
||||
$buttonVoice.SetOutputToWaveFile($buttonRaw)
|
||||
$buttonVoice.Speak($buttonPhrases[$buttonName])
|
||||
$buttonVoice.SetOutputToNull()
|
||||
& ffmpeg -hide_banner -loglevel error -y -i $buttonRaw -af $buttonFilter -ar 8000 -ac 1 -c:a pcm_s16le $buttonPcm
|
||||
if ($LASTEXITCODE -ne 0) { throw "Voice conversion failed: $buttonName" }
|
||||
}
|
||||
} finally { $buttonVoice.Dispose() }
|
||||
& python $buttonEncoder --directory $buttonDirectory --output $buttonHeader --voice $Voice
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Button voice encoding failed' }
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Encode the fixed button-confirmation WAV catalog as independent IMA clips."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from generate_gps_voice import encode, read
|
||||
|
||||
PHRASES = (
|
||||
('ready', 'Ready'),
|
||||
('notificationCleared', 'Notification cleared'),
|
||||
('advertQueued', 'Advert queued'),
|
||||
('advertFailed', 'Advert failed'),
|
||||
('soundOn', 'Sound on'),
|
||||
('soundOff', 'Sound off'),
|
||||
('actionFailed', 'Action failed'),
|
||||
('usbSetup', 'USB setup'),
|
||||
('shuttingDown', 'Shutting down'),
|
||||
('restarting', 'Restarting'),
|
||||
('alertsSoundVibration', 'Sound and vibration'),
|
||||
('alertsSoundOnly', 'Sound only'),
|
||||
('alertsVibrationOnly', 'Vibration only'),
|
||||
('alertsSilent', 'Silent'),
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--directory', type=Path, required=True)
|
||||
parser.add_argument('--output', type=Path, required=True)
|
||||
parser.add_argument('--voice', help='Speech voice used to synthesize the source WAVs')
|
||||
args = parser.parse_args()
|
||||
if args.voice is not None and (not args.voice.strip() or '\n' in args.voice or '\r' in args.voice):
|
||||
parser.error('--voice must be a nonempty single-line label')
|
||||
lines = [
|
||||
'// Generated by scripts/generate_button_voice.py. 8 kHz IMA ADPCM.',
|
||||
'// Fixed spoken confirmations; no runtime speech engine.',
|
||||
'#pragma once', '#include <helpers/ui/GpsVoice.h>',
|
||||
'namespace mesh { namespace audio {',
|
||||
]
|
||||
if args.voice is not None:
|
||||
lines.insert(2, f'// Voice: {args.voice}')
|
||||
total = 0
|
||||
for name, phrase in PHRASES:
|
||||
samples = read(args.directory / (name + '.wav'))
|
||||
# Shutdown drains audio nonblockingly for at most five seconds.
|
||||
if not samples or len(samples) > 32000:
|
||||
raise ValueError(f'{phrase}: expected a nonempty clip under four seconds')
|
||||
encoded = encode(samples)
|
||||
total += len(encoded)
|
||||
if name == 'alertsSoundVibration':
|
||||
# Only buzzer+vibration devices need the additional mode catalog.
|
||||
lines.append('#ifdef HAS_DRV2605')
|
||||
lines.extend([f'// "{phrase}"', f'static const uint8_t {name}Data[] = {{'])
|
||||
for offset in range(0, len(encoded), 20):
|
||||
lines.append(' ' + ','.join(f'0x{b:02x}' for b in encoded[offset:offset + 20]) + ',')
|
||||
lines.extend(['};', f'static constexpr VoiceClip {name}Clip = {{',
|
||||
f' {name}Data, sizeof({name}Data), {len(samples)}, 8000', '};'])
|
||||
print(f'{phrase}: {len(samples) / 8000:.3f}s, {len(encoded)} bytes')
|
||||
lines.append('#endif // HAS_DRV2605')
|
||||
lines.append('}} // namespace mesh::audio')
|
||||
args.output.write_text('\n'.join(lines) + '\n', encoding='utf-8')
|
||||
print(f'Button confirmations: {total} audio bytes')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate an opt-in G.726 speech catalog; never overwrite the IMA catalog.
|
||||
|
||||
Requires FFmpeg with the g726 encoder. Source WAVs must be the approved mono
|
||||
8 kHz/16-bit Zira recordings. Both bitrates are stored in the source header,
|
||||
but the preprocessor selects exactly one for each hardware test build.
|
||||
"""
|
||||
import argparse
|
||||
import struct
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from generate_button_voice import PHRASES
|
||||
from generate_gps_voice import read
|
||||
|
||||
|
||||
def encode(samples, bitrate, ffmpeg="ffmpeg"):
|
||||
if bitrate not in (16, 24):
|
||||
raise ValueError("G.726 bitrate must be 16 or 24 kbps")
|
||||
pcm = struct.pack("<" + "h" * len(samples), *samples)
|
||||
result = subprocess.run([
|
||||
ffmpeg, "-hide_banner", "-loglevel", "error", "-f", "s16le",
|
||||
"-ar", "8000", "-ac", "1", "-i", "pipe:0", "-c:a", "g726",
|
||||
"-b:a", str(bitrate * 1000), "-f", "g726", "pipe:1",
|
||||
], input=pcm, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
|
||||
expected = (len(samples) * (bitrate // 8) + 7) // 8
|
||||
if len(result.stdout) != expected:
|
||||
raise ValueError(f"G.726-{bitrate}: expected {expected} bytes, got {len(result.stdout)}")
|
||||
return result.stdout
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--directory", type=Path, required=True, help="Button WAV catalog")
|
||||
parser.add_argument("--on", type=Path, required=True, help="GPS-on WAV")
|
||||
parser.add_argument("--off", type=Path, required=True, help="GPS-off WAV")
|
||||
parser.add_argument("--output", type=Path, required=True)
|
||||
parser.add_argument("--ffmpeg", default="ffmpeg")
|
||||
parser.add_argument("--voice", required=True, help="Voice used to synthesize source WAVs")
|
||||
args = parser.parse_args()
|
||||
if not args.voice.strip() or "\n" in args.voice or "\r" in args.voice:
|
||||
parser.error("--voice must be a nonempty single-line label")
|
||||
if args.output.name.casefold() in ("buttonvoicedata.h", "gpsvoicedata.h"):
|
||||
parser.error("G.726 experiments must not overwrite production IMA headers")
|
||||
catalog = [(name, phrase, args.directory / (name + ".wav")) for name, phrase in PHRASES]
|
||||
catalog += [("gpsOn", "GPS on", args.on), ("gpsOff", "GPS off", args.off)]
|
||||
samples = [(name, phrase, read(path)) for name, phrase, path in catalog]
|
||||
for name, _, pcm in samples:
|
||||
if not pcm or len(pcm) > 32000:
|
||||
raise ValueError(f"{name}: expected a nonempty clip under four seconds")
|
||||
lines = [
|
||||
"// Generated by scripts/generate_g726_voice.py. EXPERIMENT ONLY.",
|
||||
f"// Voice: {args.voice}. 8 kHz mono, MSB-first raw G.726, fresh state per clip.",
|
||||
"// Original sample counts exclude the unused bits in the final byte.",
|
||||
"#pragma once", "#include <helpers/ui/GpsVoice.h>",
|
||||
"#if !defined(MESH_GPS_VOICE_G726_BITRATE)",
|
||||
'#error "G.726 catalog requires an explicitly selected experimental bitrate"',
|
||||
"#endif", "namespace mesh { namespace audio {",
|
||||
]
|
||||
for bitrate in (16, 24):
|
||||
lines.append(f"#if MESH_GPS_VOICE_G726_BITRATE == {bitrate}")
|
||||
total = 0
|
||||
for name, phrase, pcm in samples:
|
||||
mode = name.startswith("alerts")
|
||||
if mode:
|
||||
lines.append("#ifdef HAS_DRV2605")
|
||||
data = encode(pcm, bitrate, args.ffmpeg)
|
||||
total += len(data)
|
||||
lines += [f'// "{phrase}"', f"static const uint8_t {name}Data[] = {{"]
|
||||
for offset in range(0, len(data), 20):
|
||||
lines.append(" " + ",".join(f"0x{b:02x}" for b in data[offset:offset + 20]) + ",")
|
||||
lines += ["};", f"static constexpr VoiceClip {name}Clip = {{",
|
||||
f" {name}Data, sizeof({name}Data), {len(pcm)}, 8000, VoiceCodec::G726{bitrate}", "};"]
|
||||
if mode:
|
||||
lines.append("#endif // HAS_DRV2605")
|
||||
lines.append(f"#endif // {bitrate} kbps")
|
||||
print(f"G.726-{bitrate}: {total} bytes across all 16 clips")
|
||||
lines.append("}} // namespace mesh::audio")
|
||||
args.output.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,91 @@
|
||||
# Generate the two fixed phrases with Windows' local speech synthesizer.
|
||||
# Requires ffmpeg and Python; outputs WAV previews plus the checked-in header.
|
||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||
param(
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$OutputDirectory = 'out/gps-voice',
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$OutputHeader = 'src/helpers/ui/GpsVoiceData.h',
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Voice = 'Microsoft Zira Desktop',
|
||||
[ValidateRange(-10, 10)]
|
||||
[int]$Rate = -1,
|
||||
[switch]$Compress = $true,
|
||||
[ValidateRange(0.0625, 1.0)]
|
||||
[double]$PeakLimit = 0.12
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Require a deliberate header target for acoustic experiments. A normal run
|
||||
# regenerates the selected Zira / rate -1 / compressed / gain-8 profile.
|
||||
# Speech is prerecorded and shared by supported boards; no runtime TTS is needed.
|
||||
# Original Zira: -Voice 'Microsoft Zira Desktop' -Compress:$false -PeakLimit 0.8
|
||||
# with an explicit -OutputHeader.
|
||||
if (-not $PSBoundParameters.ContainsKey('OutputHeader') -and
|
||||
($Voice -ne 'Microsoft Zira Desktop' -or $Rate -ne -1 -or
|
||||
-not $Compress -or $PeakLimit -ne 0.12)) {
|
||||
throw 'Voice variants require an explicit -OutputHeader (use an out/gps-voice path for tests).'
|
||||
}
|
||||
$gpsDirectory = [IO.Path]::GetFullPath($OutputDirectory)
|
||||
$gpsHeader = [IO.Path]::GetFullPath($OutputHeader)
|
||||
if ([IO.Path]::GetExtension($gpsHeader) -ine '.h') {
|
||||
throw '-OutputHeader must name a .h file.'
|
||||
}
|
||||
if (Test-Path -LiteralPath $gpsDirectory -PathType Leaf) {
|
||||
throw '-OutputDirectory names an existing file.'
|
||||
}
|
||||
if (Test-Path -LiteralPath $gpsHeader -PathType Container) {
|
||||
throw '-OutputHeader names an existing directory.'
|
||||
}
|
||||
$gpsEncoder = Join-Path $PSScriptRoot 'generate_gps_voice.py'
|
||||
if (-not (Test-Path -LiteralPath $gpsEncoder -PathType Leaf)) {
|
||||
throw "Voice encoder not found: $gpsEncoder"
|
||||
}
|
||||
|
||||
$gpsFilter = 'highpass=f=350,lowpass=f=3400,silenceremove=start_periods=1:start_threshold=-45dB,areverse,silenceremove=start_periods=1:start_threshold=-45dB,areverse'
|
||||
if ($Compress) {
|
||||
# Raise quieter consonants without simply clipping the louder vowels.
|
||||
$gpsFilter += ',acompressor=threshold=0.08:ratio=6:attack=5:release=70:makeup=4:knee=4:detection=rms'
|
||||
}
|
||||
$gpsFilter += ',volume=1.4'
|
||||
if ($Compress -or $PeakLimit -ne 0.8) {
|
||||
# Limit after resampling so the experimental PCM peak has real headroom.
|
||||
$gpsFilter += ',aresample=8000'
|
||||
}
|
||||
$gpsPeak = $PeakLimit.ToString('0.####', [Globalization.CultureInfo]::InvariantCulture)
|
||||
$gpsFilter += ",alimiter=limit=${gpsPeak}:level=disabled,apad=pad_dur=0.05"
|
||||
# For player gains 4 / 6 / 8, begin at -PeakLimit 0.18 / 0.12 / 0.09
|
||||
# (72% nominal full scale after gain). Check decoded/reconstructed peaks too:
|
||||
# ADPCM quantization and interpolation can overshoot the source PCM ceiling.
|
||||
Write-Verbose "Voice: $Voice; rate: $Rate; output directory: $gpsDirectory"
|
||||
Write-Verbose "Output header: $gpsHeader"
|
||||
Write-Verbose "FFmpeg filter: $gpsFilter"
|
||||
if (-not $PSCmdlet.ShouldProcess($gpsHeader, "Synthesize GPS on/off with $Voice and encode previews from $gpsDirectory")) {
|
||||
return
|
||||
}
|
||||
|
||||
Add-Type -AssemblyName System.Speech
|
||||
$gpsVoice = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
||||
try {
|
||||
$gpsVoices = @($gpsVoice.GetInstalledVoices() | Where-Object Enabled | ForEach-Object { $_.VoiceInfo.Name })
|
||||
if ($gpsVoices -notcontains $Voice) {
|
||||
throw "Voice '$Voice' is unavailable. Installed voices: $($gpsVoices -join ', ')"
|
||||
}
|
||||
$gpsVoice.SelectVoice($Voice)
|
||||
$gpsVoice.Rate = $Rate
|
||||
Get-Command ffmpeg, python -ErrorAction Stop | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path $gpsDirectory | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path ([IO.Path]::GetDirectoryName($gpsHeader)) | Out-Null
|
||||
foreach ($gpsState in @('on','off')) {
|
||||
$gpsRaw = Join-Path $gpsDirectory "gps-$gpsState-raw.wav"
|
||||
$gpsPcm = Join-Path $gpsDirectory "gps-$gpsState.wav"
|
||||
$gpsVoice.SetOutputToWaveFile([IO.Path]::GetFullPath($gpsRaw))
|
||||
$gpsVoice.Speak("G P S $gpsState")
|
||||
$gpsVoice.SetOutputToNull()
|
||||
# Keep enough consonant energy for a small beeper; limit clipping.
|
||||
& ffmpeg -hide_banner -loglevel error -y -i $gpsRaw -af $gpsFilter -ar 8000 -ac 1 -c:a pcm_s16le $gpsPcm
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Voice conversion failed' }
|
||||
}
|
||||
} finally { $gpsVoice.Dispose() }
|
||||
& python $gpsEncoder --on (Join-Path $gpsDirectory 'gps-on.wav') --off (Join-Path $gpsDirectory 'gps-off.wav') --output $gpsHeader --voice $Voice
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Voice encoding failed' }
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Encode 8/16 kHz mono 16-bit WAV speech as independent IMA ADPCM clips."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import struct
|
||||
import wave
|
||||
|
||||
STEPS = (7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,
|
||||
60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,
|
||||
337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,
|
||||
1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,
|
||||
5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,
|
||||
16818,18500,20350,22385,24623,27086,29794,32767)
|
||||
ADJUST = (-1,-1,-1,-1,2,4,6,8)
|
||||
|
||||
def encode(samples):
|
||||
predictor = index = 0
|
||||
codes = []
|
||||
for sample in samples:
|
||||
step = STEPS[index]
|
||||
difference = sample - predictor
|
||||
code = 8 if difference < 0 else 0
|
||||
difference = abs(difference)
|
||||
delta = step >> 3
|
||||
for bit, part in ((4,step),(2,step >> 1),(1,step >> 2)):
|
||||
if difference >= part:
|
||||
code |= bit
|
||||
difference -= part
|
||||
delta += part
|
||||
predictor = max(-32768,min(32767,predictor + (-delta if code & 8 else delta)))
|
||||
index = max(0,min(88,index + ADJUST[code & 7]))
|
||||
codes.append(code)
|
||||
if len(codes) & 1:
|
||||
codes.append(0)
|
||||
return bytes(a | b << 4 for a,b in zip(codes[::2], codes[1::2]))
|
||||
|
||||
def read(path, rate=8000):
|
||||
with wave.open(str(path),'rb') as wav:
|
||||
if (wav.getnchannels(),wav.getsampwidth(),wav.getframerate()) != (1,2,rate):
|
||||
raise ValueError(f'Expected mono 16-bit PCM at {rate} Hz')
|
||||
data = wav.readframes(wav.getnframes())
|
||||
return struct.unpack('<' + 'h' * (len(data)//2),data)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--on',type=Path,required=True)
|
||||
parser.add_argument('--off',type=Path,required=True)
|
||||
parser.add_argument('--output',type=Path,required=True)
|
||||
parser.add_argument('--rate',type=int,choices=(8000,16000),default=8000)
|
||||
parser.add_argument('--voice', help='Speech voice used to synthesize the source WAVs')
|
||||
args = parser.parse_args()
|
||||
if args.voice is not None and (not args.voice.strip() or '\n' in args.voice or '\r' in args.voice):
|
||||
parser.error('--voice must be a nonempty single-line label')
|
||||
lines = [f'// Generated by scripts/generate_gps_voice.py. {args.rate/1000:g} kHz IMA ADPCM.',
|
||||
'// Phrases: "GPS on", "GPS off". No runtime speech engine.',
|
||||
'#pragma once','#include <helpers/ui/GpsVoice.h>',
|
||||
'namespace mesh { namespace audio {']
|
||||
if args.voice is not None:
|
||||
lines.insert(2, f'// Voice: {args.voice}')
|
||||
for name,path in (('On',args.on),('Off',args.off)):
|
||||
samples = read(path,args.rate)
|
||||
encoded = encode(samples)
|
||||
lines.append(f'static const uint8_t gps{name}Data[] = {{')
|
||||
for i in range(0,len(encoded),20):
|
||||
lines.append(' '+','.join(f'0x{b:02x}' for b in encoded[i:i+20])+',')
|
||||
lines.extend(['};',f'static constexpr VoiceClip gps{name}Clip = {{',
|
||||
f' gps{name}Data, sizeof(gps{name}Data), {len(samples)}, {args.rate}', '};'])
|
||||
print(f'GPS {name.lower()}: {len(samples)/args.rate:.3f}s, {len(encoded)} bytes')
|
||||
lines.append('}} // namespace mesh::audio')
|
||||
args.output.write_text('\n'.join(lines)+'\n',encoding='utf-8')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// A compact request, not a runtime speech engine: all phrases are in flash.
|
||||
enum class ButtonVoicePrompt : uint8_t {
|
||||
Ready,
|
||||
NotificationCleared,
|
||||
AdvertQueued,
|
||||
AdvertFailed,
|
||||
SoundOn,
|
||||
SoundOff,
|
||||
GpsOn,
|
||||
GpsOff,
|
||||
ActionFailed,
|
||||
UsbSetup,
|
||||
ShuttingDown,
|
||||
Restarting,
|
||||
AlertsSoundVibration,
|
||||
AlertsSoundOnly,
|
||||
AlertsVibrationOnly,
|
||||
AlertsSilent
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,175 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Decoder experiment only: production speech stays IMA until acoustic tests
|
||||
// qualify another codec. Do not enable this in release recipes yet.
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
#if !defined(MESH_BUTTON_AUDIO_HIL) || !MESH_BUTTON_AUDIO_HIL
|
||||
#error "G.726 speech is an opt-in MESH_BUTTON_AUDIO_HIL experiment"
|
||||
#endif
|
||||
#if MESH_GPS_VOICE_G726_BITRATE != 16 && MESH_GPS_VOICE_G726_BITRATE != 24
|
||||
#error "G.726 speech bitrate must be 16 or 24 kbps"
|
||||
#endif
|
||||
#include <helpers/ui/g726/g726_decoder.h>
|
||||
#endif
|
||||
|
||||
namespace mesh { namespace audio {
|
||||
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
enum class VoiceCodec : uint8_t { Ima, G72616, G72624 };
|
||||
#endif
|
||||
|
||||
// Low nibble first, independent IMA ADPCM stream starting at predictor/index 0.
|
||||
// The samples live in flash; playback only needs two small DMA buffers in RAM.
|
||||
struct VoiceClip {
|
||||
const uint8_t* data;
|
||||
size_t bytes;
|
||||
uint32_t samples;
|
||||
uint32_t sample_rate;
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
VoiceCodec codec;
|
||||
constexpr VoiceClip(const uint8_t* data = nullptr, size_t bytes = 0,
|
||||
uint32_t samples = 0, uint32_t sample_rate = 8000,
|
||||
VoiceCodec codec = VoiceCodec::Ima)
|
||||
: data(data), bytes(bytes), samples(samples), sample_rate(sample_rate), codec(codec) {}
|
||||
unsigned bits() const {
|
||||
if (codec == VoiceCodec::Ima) return 4;
|
||||
#if MESH_GPS_VOICE_G726_BITRATE == 16
|
||||
if (codec == VoiceCodec::G72616) return 2;
|
||||
#else
|
||||
if (codec == VoiceCodec::G72624) return 3;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
// Divide before multiplying: valid even for UINT32_MAX sample counts and
|
||||
// SIZE_MAX byte counts. The final byte may contain unused padding bits.
|
||||
size_t requiredBytes(uint32_t count) const {
|
||||
const unsigned b = bits();
|
||||
return (count / 8) * b + ((count % 8) * b + 7) / 8;
|
||||
}
|
||||
bool valid() const {
|
||||
return data && samples && bits() && bytes >= requiredBytes(samples)
|
||||
&& (codec == VoiceCodec::Ima ? (sample_rate == 8000 || sample_rate == 16000)
|
||||
: sample_rate == 8000);
|
||||
}
|
||||
#else
|
||||
constexpr VoiceClip(const uint8_t* data = nullptr, size_t bytes = 0,
|
||||
uint32_t samples = 0, uint32_t sample_rate = 8000)
|
||||
: data(data), bytes(bytes), samples(samples), sample_rate(sample_rate) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
class VoiceDecoder {
|
||||
VoiceClip clip_ = {};
|
||||
uint32_t position_ = 0;
|
||||
int32_t predictor_ = 0;
|
||||
int index_ = 0;
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
G726State g726_ = {};
|
||||
#endif
|
||||
public:
|
||||
void begin(VoiceClip clip) {
|
||||
clip_ = clip;
|
||||
position_ = 0;
|
||||
predictor_ = 0;
|
||||
index_ = 0;
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
g726_init(&g726_);
|
||||
#endif
|
||||
}
|
||||
uint32_t position() const { return position_; }
|
||||
bool done() const {
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
return !clip_.data || !clip_.bits() || position_ >= clip_.samples
|
||||
|| clip_.requiredBytes(position_ + 1) > clip_.bytes;
|
||||
#else
|
||||
return !clip_.data || position_ >= clip_.samples
|
||||
|| position_ / 2 >= clip_.bytes;
|
||||
#endif
|
||||
}
|
||||
int16_t next() {
|
||||
static const int16_t steps[89] = {
|
||||
7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,
|
||||
60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,
|
||||
307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,
|
||||
1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,
|
||||
4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,
|
||||
12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767
|
||||
};
|
||||
static const int8_t adjustments[8] = {-1,-1,-1,-1,2,4,6,8};
|
||||
if (done()) return 0;
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
if (clip_.codec != VoiceCodec::Ima) {
|
||||
const unsigned bits = clip_.bits();
|
||||
const unsigned bit = ((position_ % 8) * bits) % 8;
|
||||
const size_t byte = (position_ / 8) * bits + ((position_ % 8) * bits) / 8;
|
||||
unsigned word = clip_.data[byte];
|
||||
unsigned shift;
|
||||
if (bit + bits > 8) {
|
||||
word = (word << 8) | clip_.data[byte + 1];
|
||||
shift = 16 - bit - bits;
|
||||
} else shift = 8 - bit - bits;
|
||||
++position_;
|
||||
return g726_decode(&g726_, (word >> shift) & ((1u << bits) - 1), bits);
|
||||
}
|
||||
#endif
|
||||
const uint8_t code = (clip_.data[position_ / 2]
|
||||
>> ((position_ & 1) * 4)) & 15;
|
||||
++position_;
|
||||
const int32_t step = steps[index_];
|
||||
int32_t delta = step >> 3;
|
||||
if (code & 1) delta += step >> 2;
|
||||
if (code & 2) delta += step >> 1;
|
||||
if (code & 4) delta += step;
|
||||
predictor_ += (code & 8) ? -delta : delta;
|
||||
if (predictor_ > 32767) predictor_ = 32767;
|
||||
if (predictor_ < -32768) predictor_ = -32768;
|
||||
index_ += adjustments[code & 7];
|
||||
if (index_ < 0) index_ = 0;
|
||||
if (index_ > 88) index_ = 88;
|
||||
return static_cast<int16_t>(predictor_);
|
||||
}
|
||||
};
|
||||
|
||||
// Reconstruction at 32 kHz, without larger clips or allocations. Four phases
|
||||
// suppress 8 kHz sampling images (3.2 kHz cutoff, Kaiser beta=7). Two phases
|
||||
// retain the consonant band of 16 kHz clips (7.2 kHz cutoff, Kaiser beta=5).
|
||||
// Each phase has exactly unity DC gain (Q14).
|
||||
class VoiceInterpolator {
|
||||
int16_t history_[16] = {};
|
||||
unsigned head_ = 0;
|
||||
unsigned phase_ = 0;
|
||||
unsigned phases_ = 4;
|
||||
public:
|
||||
void begin(uint32_t sample_rate = 8000) {
|
||||
for (auto& sample : history_) sample = 0;
|
||||
head_ = phase_ = 0;
|
||||
phases_ = sample_rate == 16000 ? 2 : 4;
|
||||
}
|
||||
int32_t next(VoiceDecoder& decoder) {
|
||||
static const int16_t coefficients[4][16] = {
|
||||
{3,-31,86,-84,-181,940,-2310,4633,12885,1341,-1562,983,-394,67,25,-17},
|
||||
{2,-35,137,-268,216,424,-2259,8176,11169,-1061,-502,671,-404,141,-19,-4},
|
||||
{-4,-19,141,-404,671,-502,-1061,11169,8176,-2259,424,216,-268,137,-35,2},
|
||||
{-17,25,67,-394,983,-1562,1341,12885,4633,-2310,940,-181,-84,86,-31,3}
|
||||
};
|
||||
static const int16_t wide_coefficients[2][16] = {
|
||||
{2,21,-113,332,-739,1415,-2581,5802,13506,-1505,150,249,-311,238,-133,51},
|
||||
{51,-133,238,-311,249,150,-1505,13506,5802,-2581,1415,-739,332,-113,21,2}
|
||||
};
|
||||
if (!phase_) {
|
||||
head_ = (head_ + 1) & 15;
|
||||
history_[head_] = decoder.next();
|
||||
}
|
||||
int32_t value = 0;
|
||||
const int16_t* taps = phases_ == 2 ? wide_coefficients[phase_] : coefficients[phase_];
|
||||
for (unsigned i = 0; i < 16; ++i)
|
||||
value += static_cast<int32_t>(history_[(head_ - i) & 15]) * taps[i];
|
||||
phase_ = (phase_ + 1) & (phases_ - 1);
|
||||
return value / 16384;
|
||||
}
|
||||
};
|
||||
|
||||
}} // namespace mesh::audio
|
||||
@@ -0,0 +1,491 @@
|
||||
// Generated by scripts/generate_gps_voice.py. 8 kHz IMA ADPCM.
|
||||
// Phrases: "GPS on", "GPS off". No runtime speech engine.
|
||||
// Voice: Microsoft Zira Desktop
|
||||
#pragma once
|
||||
#include <helpers/ui/GpsVoice.h>
|
||||
namespace mesh { namespace audio {
|
||||
static const uint8_t gpsOnData[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,
|
||||
0x7f,0xf7,0xf7,0x61,0x5c,0x8b,0xd1,0x04,0x4a,0x8c,0xb3,0x83,0x90,0x98,0x91,0x22,0x2d,0x89,0x28,0xd1,
|
||||
0xa3,0x20,0x0a,0x80,0xf1,0xb7,0x01,0x5d,0x1a,0x88,0x91,0x18,0x2a,0xa0,0xb5,0x81,0x38,0x2c,0x88,0x2b,
|
||||
0x5a,0xb9,0xa7,0xa1,0xb4,0xc3,0x51,0x1d,0x08,0x90,0x20,0x3c,0x1b,0xf3,0xa3,0x81,0x28,0x1b,0x98,0xb4,
|
||||
0x82,0x6c,0x8a,0xc3,0xc4,0x11,0x09,0x00,0x0a,0xb1,0xa5,0x20,0x2c,0x39,0x4f,0x8a,0xa2,0x01,0x5b,0x0a,
|
||||
0xc1,0xb6,0x82,0x4a,0x8a,0xb2,0x02,0x5c,0x1b,0xa1,0xa2,0x01,0x3a,0x2a,0x3b,0x99,0xf7,0xa3,0x30,0x2d,
|
||||
0x19,0x29,0x2c,0xc0,0xb5,0x21,0x3c,0x2b,0xc0,0xb4,0xb4,0x11,0x2a,0x1a,0x98,0x82,0x3a,0x89,0x10,0xb9,
|
||||
0xb7,0x82,0x5a,0x2b,0xe0,0xc6,0x82,0x49,0x2c,0x89,0xc3,0x82,0x29,0x4b,0x8a,0xd4,0xa3,0x20,0x4d,0x0a,
|
||||
0xc2,0x82,0x29,0x2b,0xb0,0xb5,0x02,0x4b,0x3b,0x8a,0xd4,0xb4,0x01,0x29,0x4b,0x2b,0xd0,0xb6,0x82,0x39,
|
||||
0x2c,0x89,0xb2,0xa3,0x10,0x1a,0x90,0xa2,0x50,0x2e,0xe1,0xb4,0x02,0x5c,0x2b,0x89,0xa2,0x01,0x19,0x09,
|
||||
0xc2,0x11,0x3b,0x4c,0xa9,0xb5,0x11,0x5b,0x1b,0xc1,0x83,0x5b,0x0a,0xc2,0x82,0x39,0x2c,0x88,0x29,0x89,
|
||||
0x93,0x4d,0x99,0xe6,0xb5,0x82,0x5b,0x2b,0x98,0xc3,0x82,0x49,0x3d,0x99,0xc4,0x82,0x39,0x3d,0x99,0xc3,
|
||||
0x93,0x39,0x2c,0x09,0xb1,0xa4,0x10,0x3b,0x89,0xb2,0x12,0x3d,0xc8,0xb5,0x21,0x4f,0x2b,0xa0,0xb3,0x92,
|
||||
0x18,0x19,0x4a,0x3c,0x0a,0x00,0x3a,0x0a,0xf5,0xc5,0x21,0x3d,0x0a,0xa1,0xa3,0x80,0xb1,0x03,0x6e,0x2c,
|
||||
0x98,0xb3,0x92,0x00,0x5b,0x1a,0x88,0x00,0x19,0x98,0xc6,0x21,0x4f,0x0a,0xa0,0xb4,0x82,0x08,0x19,0x08,
|
||||
0x4a,0x1a,0x29,0xb8,0xb4,0xc5,0x21,0x3c,0x4b,0x9a,0xc5,0x82,0x39,0x3d,0x0a,0xb1,0xa4,0x81,0x18,0x2a,
|
||||
0xa8,0xa4,0x28,0xb0,0x31,0x2e,0xa0,0xc3,0xb3,0x70,0x4f,0x0a,0xc1,0xa3,0x20,0x4d,0x1a,0xb0,0xa5,0x10,
|
||||
0x4b,0x0a,0xa1,0xc3,0x82,0x19,0x19,0xa0,0x11,0x3b,0x1b,0xf5,0xa3,0x10,0x4c,0x0a,0x80,0x30,0x9a,0xb7,
|
||||
0x11,0x2c,0x8a,0xb0,0xb2,0x21,0x6c,0x19,0x91,0x93,0x02,0x29,0x2b,0x0b,0x8b,0xf8,0x24,0x3f,0xc0,0xa3,
|
||||
0x88,0x8a,0x1a,0x9a,0xa4,0x13,0x32,0x34,0x50,0x18,0x98,0xd1,0xb0,0x99,0x1f,0xb3,0x78,0x2b,0xd1,0x00,
|
||||
0x0c,0xa8,0x00,0x18,0x12,0x52,0x12,0x32,0x39,0xb9,0xd0,0xaa,0xcb,0x2a,0xf3,0x04,0x5c,0x9a,0xb2,0x19,
|
||||
0x9b,0x91,0x30,0x41,0x62,0x21,0x83,0x11,0x1c,0xbb,0xe8,0x99,0x59,0x2d,0xc1,0x83,0x2c,0xaa,0xb1,0x08,
|
||||
0x00,0x42,0x51,0x03,0x15,0x10,0x89,0xa9,0xca,0xba,0x0c,0xf2,0x12,0x4d,0xb8,0xb4,0x39,0x0c,0x90,0x11,
|
||||
0x20,0x14,0x42,0x20,0x91,0xb1,0xc9,0xca,0xab,0x6b,0x1d,0xe2,0x83,0x3b,0x9b,0xb2,0x18,0x90,0x06,0x60,
|
||||
0x10,0x83,0x11,0x0a,0xb8,0x9b,0x9e,0x1a,0xd9,0xb7,0x30,0x1d,0xc0,0x92,0x29,0x09,0x11,0x31,0x13,0x15,
|
||||
0x30,0x1a,0xb9,0xf9,0xb8,0x8a,0xe2,0x12,0x3e,0xc9,0xb4,0x39,0x1c,0x90,0x02,0x12,0x14,0x42,0x28,0x98,
|
||||
0xc1,0xa9,0x9c,0x0c,0xf2,0x83,0x4c,0xa9,0xc3,0x18,0x8a,0x81,0x40,0x38,0x13,0x24,0x01,0xa2,0x98,0x9e,
|
||||
0xca,0x99,0xf3,0x83,0x4d,0xa9,0xd3,0x10,0x1b,0xa0,0x84,0x31,0x21,0x42,0x28,0xb0,0xd3,0x1a,0x0f,0x0a,
|
||||
0xd1,0xb5,0x20,0x1d,0xa8,0x92,0x19,0x08,0x12,0x60,0x01,0x94,0x12,0x3c,0xab,0xf2,0x80,0x4a,0x1c,0xc1,
|
||||
0xa4,0x39,0x0c,0xa0,0x81,0x18,0x01,0x33,0x70,0x08,0xb3,0x82,0x1c,0x8c,0xc8,0xb3,0x58,0x1c,0xb0,0x81,
|
||||
0x1d,0xb8,0x93,0x69,0x18,0x85,0x22,0x28,0xa0,0xc2,0x89,0x9c,0xa9,0xc5,0x12,0x3d,0x9a,0xd2,0x08,0x8a,
|
||||
0xa2,0x32,0x40,0x14,0x33,0x38,0xb0,0xe2,0x0a,0x8f,0x00,0x3b,0xf0,0xb4,0x38,0x1e,0xb0,0xa3,0x20,0x29,
|
||||
0x12,0x41,0x18,0xb3,0x92,0x2d,0x8d,0x99,0xd3,0x83,0x4c,0x8b,0xb0,0x19,0x8c,0xb2,0x24,0x79,0x10,0x03,
|
||||
0x82,0x81,0x09,0x0e,0xab,0x01,0x3c,0xf0,0xa4,0x4a,0x0d,0xb0,0x82,0x18,0x81,0x14,0x50,0x18,0x91,0xa2,
|
||||
0x09,0x0d,0x8b,0xf4,0x93,0x6b,0x0b,0xc1,0x81,0x1a,0x98,0x12,0x48,0x01,0x85,0x12,0x08,0x98,0x0a,0x0f,
|
||||
0x88,0x09,0xe1,0xb3,0x4a,0x0d,0xa8,0x81,0x28,0x01,0x15,0x60,0x18,0xa2,0x82,0x0b,0xca,0x88,0xb0,0x94,
|
||||
0x5d,0x0c,0xc0,0xa1,0x88,0x08,0x30,0x30,0x86,0x86,0x21,0x19,0x89,0xa9,0xd9,0x82,0x4e,0x9a,0xc3,0x00,
|
||||
0x1c,0x99,0x00,0x4a,0x00,0x85,0x32,0x38,0x81,0x92,0x8a,0xad,0xc9,0xa3,0x7b,0x1c,0xe2,0x81,0x2b,0x9b,
|
||||
0xc3,0x31,0x5a,0x01,0x04,0x21,0x18,0x98,0x99,0xbb,0x9b,0xf3,0x02,0x5f,0x8b,0xe2,0x81,0x2a,0x0a,0x81,
|
||||
0x12,0x12,0x24,0x40,0x29,0x99,0xf1,0xa0,0x1a,0xa8,0x93,0x5d,0x8b,0xe2,0x00,0x2b,0x8a,0x93,0x04,0x32,
|
||||
0x61,0x28,0x91,0xb2,0xa0,0x0d,0x9c,0xc3,0x58,0x2d,0xc0,0x92,0x2b,0x9b,0xc3,0x31,0x5a,0x01,0x14,0x31,
|
||||
0x08,0xa1,0x99,0x9d,0xba,0x3b,0xbb,0xc7,0x33,0x2f,0xaa,0xd3,0x00,0x2a,0x08,0x03,0x43,0x31,0x12,0x10,
|
||||
0x9a,0xf9,0xb8,0x8b,0x4c,0x1b,0xe5,0x83,0x4c,0x8b,0xc1,0x01,0x2a,0x00,0x31,0x30,0x85,0x13,0x4b,0xaa,
|
||||
0xd1,0x99,0x8b,0x3a,0x2c,0xe5,0x83,0x5b,0x9b,0xd3,0x00,0x1a,0x81,0x13,0x31,0x04,0x32,0x1a,0xe0,0xa0,
|
||||
0x0d,0x9b,0x08,0xd2,0x85,0x6a,0x8a,0xd2,0x00,0x1b,0x98,0x82,0x22,0x41,0x41,0x11,0x92,0x88,0x8c,0xbc,
|
||||
0xb9,0xaa,0x42,0x5d,0xb1,0x84,0x2b,0xbb,0xe1,0x08,0x2a,0x10,0x15,0x43,0x31,0x11,0xa1,0xa8,0xad,0xac,
|
||||
0xba,0x9a,0x87,0x58,0x88,0xa2,0x09,0x8d,0xba,0xa0,0x48,0x48,0x23,0x17,0x31,0x00,0xa1,0xa8,0x9d,0xbb,
|
||||
0xca,0x09,0x42,0x38,0x85,0x91,0x0a,0xaf,0xc8,0x89,0x19,0x11,0x25,0x34,0x42,0x11,0x81,0x98,0xac,0xdb,
|
||||
0xba,0x9a,0x39,0x12,0x25,0x21,0x80,0xd8,0xca,0xbb,0x8c,0xa8,0xa8,0x72,0x43,0x24,0x32,0x21,0x00,0x99,
|
||||
0xcb,0xbc,0xab,0xa9,0x00,0x08,0x80,0xa1,0xaa,0xbd,0xdb,0xa9,0x0a,0x30,0x44,0x35,0x34,0x24,0x23,0x12,
|
||||
0x81,0xa8,0xbb,0x09,0x8b,0xb9,0xfb,0xbd,0xbd,0xdb,0xaa,0x9b,0x89,0x11,0x44,0x53,0x33,0x24,0x23,0x12,
|
||||
0x00,0xa8,0xba,0x9d,0x91,0x18,0x80,0xb8,0xdc,0xbc,0xcd,0xba,0xba,0x9a,0x18,0x41,0x44,0x43,0x24,0x33,
|
||||
0x32,0x21,0x80,0xa8,0x1b,0xc9,0xa8,0xdb,0xcb,0xad,0xdb,0xaa,0xab,0x9a,0x88,0x30,0x52,0x34,0x34,0x34,
|
||||
0x32,0x23,0x22,0x01,0xa1,0x35,0x1b,0xa8,0xcc,0xbd,0xbd,0xdb,0xaa,0xab,0x9a,0x89,0x11,0x35,0x63,0x42,
|
||||
0x32,0x32,0x32,0x12,0x01,0xb0,0x54,0x8d,0xa8,0xdb,0xbb,0xbc,0xac,0xaa,0x99,0x00,0x33,0x45,0x53,0x32,
|
||||
0x23,0x14,0x02,0x81,0xa8,0xba,0xcd,0x21,0x9f,0xa8,0xc9,0xa9,0xaa,0xa9,0x10,0x41,0x51,0x43,0x23,0x24,
|
||||
0x23,0x12,0x00,0xa9,0xcc,0xda,0xba,0xda,0x32,0x0e,0x08,0x99,0xa9,0x80,0x88,0x41,0x32,0x34,0x43,0x33,
|
||||
0x32,0x93,0xb1,0xda,0xdb,0xca,0xaa,0xdb,0xb8,0x67,0x0a,0x00,0x08,0xba,0x29,0xba,0xb5,0x87,0x08,0x01,
|
||||
0x08,0x11,0xa5,0x21,0x1e,0xa8,0xa0,0xa2,0x1b,0x31,0x88,0xf1,0x38,0xc0,0x12,0x91,0x70,0x80,0x98,0x19,
|
||||
0x8b,0xa2,0x5c,0xc0,0x80,0x21,0x18,0x79,0xa8,0x97,0xa2,0x19,0x9b,0xa9,0x0a,0x8e,0x7b,0xa1,0x81,0x20,
|
||||
0x19,0x88,0x07,0x88,0x1a,0x14,0x3a,0x59,0xc8,0x90,0x82,0x9d,0x00,0x89,0xe1,0x13,0x28,0x3d,0x89,0x80,
|
||||
0x11,0x09,0xf9,0x89,0x29,0xe4,0x08,0x83,0x49,0x5a,0x90,0x18,0xb1,0x29,0x4b,0x90,0x11,0xb3,0x1f,0x1a,
|
||||
0x99,0x18,0xb9,0xb2,0x87,0x41,0x69,0x00,0x19,0x0b,0xcb,0xaa,0xb7,0x11,0x00,0x90,0x9e,0x80,0x42,0x8d,
|
||||
0x30,0xa0,0xa6,0x04,0x0a,0x00,0x99,0x01,0xd3,0x21,0x1f,0x89,0xa0,0x08,0x18,0x02,0x02,0x51,0x95,0x22,
|
||||
0x89,0x8f,0xc1,0x90,0x19,0x91,0xa8,0x5b,0x3d,0x98,0x02,0xa2,0x1f,0x9a,0x96,0x02,0x2a,0x11,0x42,0x5a,
|
||||
0x08,0xb1,0x00,0xa8,0x9f,0xc2,0xa9,0xa0,0x8e,0x21,0x6b,0x10,0x83,0x1a,0x11,0xb0,0x82,0xd1,0x90,0x30,
|
||||
0x4c,0x09,0xa3,0x9a,0xc8,0xf1,0xb8,0x07,0x1b,0x89,0xb3,0x91,0x70,0x09,0x81,0x6a,0xb2,0x2d,0x14,0xb9,
|
||||
0x33,0xf9,0x38,0xa9,0x9a,0x10,0x1c,0x93,0x7b,0xb1,0x18,0x04,0xf0,0x7f,0xb1,0x3a,0x08,0x9a,0x07,0x0b,
|
||||
0xa6,0x0a,0x12,0x0a,0x80,0xf3,0x21,0x1a,0x2f,0xb0,0x01,0x93,0x1a,0x0a,0x8a,0x17,0x5d,0xa0,0xaa,0x07,
|
||||
0x3d,0x88,0x00,0x88,0x2a,0xc0,0x95,0x29,0x18,0x0f,0xa4,0x90,0x02,0x48,0x9d,0x05,0x0d,0xa4,0x3b,0xb1,
|
||||
0x38,0xc1,0x01,0x92,0x5b,0xa9,0x95,0x3a,0x08,0x1e,0xc4,0x28,0x88,0x08,0xb4,0x80,0x58,0x8d,0x94,0x0a,
|
||||
0x93,0x5d,0xc0,0x21,0xb8,0x22,0x0b,0xb1,0x41,0xac,0x14,0x1d,0x92,0x98,0x83,0x4e,0xa8,0x11,0xb8,0x22,
|
||||
0x8c,0x01,0x09,0x28,0xc2,0x7a,0xe8,0x84,0x88,0x39,0xb8,0x11,0xf1,0x22,0x2e,0x90,0x08,0xb2,0x30,0xaa,
|
||||
0x12,0x1d,0xc3,0x11,0xa9,0xa7,0x49,0xaa,0xa6,0x38,0x8a,0x10,0xa9,0xa5,0x49,0x0a,0x81,0x2a,0xe1,0x94,
|
||||
0x39,0x0a,0x29,0xd8,0xa6,0x10,0x1a,0x90,0x28,0xa8,0x93,0x88,0x90,0x20,0x9c,0xc7,0x21,0x89,0x30,0x1d,
|
||||
0x98,0xc5,0x11,0x0a,0x38,0x2d,0xd1,0xa4,0x28,0x1a,0x19,0xd2,0x02,0x4c,0x0a,0xa2,0x18,0xc0,0xb5,0x02,
|
||||
0x5b,0x2b,0x99,0xd6,0x93,0x28,0x2b,0x19,0x1a,0xe2,0xb4,0x82,0x4a,0x1b,0xd1,0xb4,0x12,0x4c,0x0a,0xa0,
|
||||
0xb4,0x02,0x5b,0x2b,0x09,0xb0,0xb7,0xa3,0x38,0x3d,0x0a,0x90,0x91,0xb3,0x40,0x2c,0x89,0xa1,0x02,0xa8,
|
||||
0x31,0x3c,0xc8,0xb7,0x81,0x00,0x4c,0x8a,0xa2,0x20,0xb8,0x44,0x3f,0xb9,0xb6,0x01,0x2a,0x88,0x6a,0x1b,
|
||||
0xb1,0xc6,0x93,0x38,0x3e,0x0a,0xb1,0xa3,0x18,0x18,0x19,0x4a,0x8a,0x21,0x1e,0xe2,0xb5,0x20,0x3b,0x0a,
|
||||
0x00,0xc0,0xa5,0x01,0x6b,0x2c,0x19,0x88,0xc2,0xb3,0x31,0x1f,0x80,0x08,0x80,0xb1,0xb4,0x42,0x3e,0x89,
|
||||
0x90,0x88,0xc1,0xa3,0x48,0x3c,0x09,0x91,0x01,0x90,0x92,0x38,0x3c,0x9a,0x17,0x7a,0x0a,0xc0,0x80,0x0c,
|
||||
0xa9,0xa2,0x11,0x20,0x22,0x51,0x10,0xa2,0xb3,0x80,0x3c,0xb7,0x51,0x2f,0xa9,0x91,0x8a,0xc8,0xb3,0x40,
|
||||
0x4b,0x00,0x03,0x11,0xa2,0xa4,0x18,0x4f,0xa8,0xa5,0x18,0x8b,0xd8,0x90,0x0a,0x89,0x02,0x51,0x30,0x03,
|
||||
0x14,0x38,0x1b,0xab,0x7a,0xb8,0xc7,0x82,0x2d,0x9b,0xb0,0x08,0x09,0x02,0x53,0x58,0x01,0x83,0x10,0x8a,
|
||||
0xd8,0x22,0x3f,0xb9,0xc5,0x08,0x8b,0xb8,0x00,0x4a,0x00,0x05,0x41,0x28,0x81,0x81,0x1a,0x0c,0xe5,0x93,
|
||||
0x5b,0x8c,0xa0,0x88,0x8a,0xc2,0x13,0x7a,0x18,0x82,0x12,0x19,0x98,0x98,0x48,0x3e,0xc9,0xc3,0x09,0x8c,
|
||||
0xb8,0x10,0x4a,0x81,0x87,0x22,0x38,0x80,0x91,0x8a,0x0c,0xf3,0x83,0x3d,0x9b,0xf2,0x80,0x2b,0x99,0x83,
|
||||
0x50,0x10,0x04,0x21,0x29,0xb8,0xd1,0x20,0x2e,0xc8,0xc3,0x19,0x0d,0xa8,0x00,0x39,0x00,0x06,0x31,0x38,
|
||||
0x91,0x92,0x0a,0x1e,0xf3,0xa3,0x39,0x0e,0xb8,0x09,0x0b,0xb1,0x85,0x41,0x30,0x22,0x40,0x09,0xe1,0xb1,
|
||||
0x58,0x2e,0xa8,0xc3,0x18,0x0c,0xa8,0x28,0x4c,0x88,0x95,0x22,0x39,0x80,0x81,0x1a,0x8c,0xf5,0xa3,0x39,
|
||||
0x0d,0xa8,0x80,0x1a,0xb0,0x96,0x31,0x39,0x02,0x03,0x38,0x0c,0xb9,0x21,0x3f,0xcb,0xd6,0x00,0x1b,0xa9,
|
||||
0x92,0x59,0x3a,0x92,0x86,0x02,0x00,0x00,0x1b,0x1c,0xf1,0xb3,0x38,0x1e,0xa9,0x90,0x1a,0x89,0x93,0x14,
|
||||
0x32,0x24,0x32,0x39,0xb8,0xf2,0xd4,0x20,0x2f,0x9a,0xb1,0x08,0x8b,0xb2,0x13,0x50,0x11,0x05,0x21,0x08,
|
||||
0xb1,0x98,0x7a,0x3e,0xaa,0xd4,0x91,0x1a,0x8a,0x88,0x39,0x10,0x96,0x85,0x21,0x18,0x80,0x09,0x5c,0x0b,
|
||||
0xf3,0x91,0x1a,0x8c,0x98,0x19,0x19,0xa3,0x07,0x31,0x48,0x18,0x90,0xb1,0x88,0xf2,0xa3,0x5c,0x0d,0xc0,
|
||||
0xa2,0x08,0x09,0x92,0x32,0x58,0x01,0x83,0x20,0x1c,0xd8,0xc5,0x11,0x3d,0x9b,0xb1,0x08,0x0b,0xc1,0x84,
|
||||
0x40,0x38,0x11,0x02,0x92,0xc2,0xa1,0x91,0x6c,0x1e,0xa9,0xc1,0x88,0x9a,0xb2,0x32,0x7a,0x01,0x95,0x13,
|
||||
0x29,0x89,0x98,0xb3,0x6a,0x1e,0xc9,0xc2,0x08,0x0b,0x88,0x21,0x79,0x00,0x84,0x02,0x10,0x89,0x98,0x91,
|
||||
0x7b,0x1e,0xc8,0xc2,0x80,0x1a,0x09,0x01,0x31,0x31,0x04,0x04,0x48,0x1b,0xe8,0xb5,0x20,0x2f,0x9a,0xb1,
|
||||
0x08,0x0a,0xa1,0x84,0x60,0x29,0x82,0x03,0x28,0x8a,0xb8,0xd6,0x92,0x3b,0x0f,0xa8,0x90,0x09,0xa0,0x95,
|
||||
0x42,0x59,0x00,0x92,0x01,0x89,0x39,0x0c,0xf1,0xc2,0x88,0x8b,0x8a,0x1a,0x18,0x04,0x15,0x23,0x13,0x22,
|
||||
0x3a,0x8e,0x81,0x4c,0x9c,0xf1,0xa0,0x0a,0x1b,0x09,0x11,0x32,0x35,0x33,0x13,0x02,0x89,0x1f,0xf1,0xc3,
|
||||
0x29,0x0f,0xa8,0xa1,0x28,0x2a,0x92,0x15,0x40,0x18,0x92,0x92,0x89,0x28,0x2f,0xca,0xf4,0x91,0x2a,0x0b,
|
||||
0x90,0x83,0x22,0x31,0x22,0x32,0x29,0x9a,0x8b,0xf6,0xa2,0x3c,0x8e,0xc0,0x80,0x2a,0xa0,0x86,0x31,0x59,
|
||||
0x80,0x92,0x81,0x8a,0x80,0x4c,0x8c,0xf1,0xa1,0x09,0x0a,0x90,0x12,0x51,0x40,0x10,0x93,0x93,0x09,0x1d,
|
||||
0xf2,0xb3,0x3a,0x8f,0xb0,0xa1,0x29,0x08,0x04,0x42,0x48,0x81,0x93,0x08,0xab,0x82,0x4f,0x9c,0xf3,0x80,
|
||||
0x1a,0x99,0x82,0x30,0x48,0x02,0x85,0x01,0x19,0x8a,0x9a,0xe6,0x93,0x4b,0x8c,0xc0,0x80,0x09,0x91,0x23,
|
||||
0x70,0x10,0x82,0x01,0x0a,0xba,0x82,0x3f,0xab,0xf3,0x08,0x0b,0xa8,0x11,0x30,0x04,0x25,0x48,0x08,0xb1,
|
||||
0x88,0x2e,0xe1,0x93,0x5b,0x8c,0xc1,0x00,0x2b,0x90,0x04,0x50,0x18,0x92,0x01,0x8a,0xe0,0x21,0x3e,0xa9,
|
||||
0xd4,0x00,0x0b,0xa8,0x10,0x4a,0x01,0x15,0x30,0x00,0xa2,0x89,0x9d,0xd1,0x18,0x1c,0xc0,0x92,0x09,0x98,
|
||||
0x02,0x58,0x00,0x85,0x22,0x29,0x98,0xb0,0x19,0xf2,0x82,0x2e,0xac,0xd1,0x08,0x1a,0x11,0x33,0x14,0x04,
|
||||
0x10,0x99,0xb9,0x9a,0x3c,0xd2,0x96,0x29,0x8d,0xb9,0x99,0x88,0x42,0x70,0x11,0x82,0x82,0x89,0x8b,0xaa,
|
||||
0xb0,0x87,0x40,0x0d,0xc8,0x98,0x8a,0x18,0x40,0x32,0x14,0x02,0x00,0x9a,0xba,0xa9,0x98,0x37,0x3c,0xe9,
|
||||
0xc0,0x99,0x8a,0x38,0x41,0x14,0x13,0x11,0x09,0x0c,0x9a,0x88,0x10,0x7a,0xd4,0xa2,0x0d,0xab,0x88,0x00,
|
||||
0x24,0x51,0x10,0x01,0x09,0x98,0x08,0x19,0x90,0xa0,0x79,0xa9,0xf4,0xaa,0xaa,0x29,0x38,0x25,0x52,0x18,
|
||||
0x81,0xa1,0x81,0x39,0x1c,0xa8,0xf0,0x38,0xf2,0x00,0x8e,0xb1,0x98,0x11,0x61,0x28,0x92,0x11,0x19,0x29,
|
||||
0x0b,0xd2,0xa0,0xb8,0xb9,0x77,0x2d,0xc8,0x90,0x98,0x11,0x38,0x85,0x12,0x08,0x2b,0xaa,0xb4,0x01,0x1b,
|
||||
0xca,0xf2,0xa1,0x77,0x1b,0xd0,0x88,0x99,0x31,0x48,0x02,0x80,0xe1,0x28,0x1b,0x92,0x91,0x92,0x2f,0x8c,
|
||||
0x01,0x79,0xb7,0x10,0x8d,0x88,0x88,0x85,0x30,0x88,0x09,0xb9,0x83,0x3a,0x92,0x2a,0xf9,0x00,0x98,0x23,
|
||||
0x7d,0xe3,0xa2,0xaa,0x10,0x4a,0x83,0x12,0xa8,0x1a,0x9c,0x84,0x20,0xa0,0x98,0xaa,0x39,0x29,0x06,0x58,
|
||||
0xb7,0x4b,0x9e,0x00,0x80,0x15,0x19,0xa0,0x99,0xa1,0x50,0x19,0x00,0xaa,0x88,0x0a,0x04,0x31,0x3a,0x7f,
|
||||
0xf3,0x80,0x0b,0x38,0x88,0x87,0x08,0x89,0x1b,0xb2,0x23,0x08,0x2a,0xad,0x91,0x21,0x41,0x89,0xe1,0x79,
|
||||
0xe2,0x00,0xaa,0x21,0x19,0x15,0x89,0xa1,0x0c,0x80,0x48,0xa2,0x10,0xbb,0x88,0x88,0x17,0x29,0x98,0xca,
|
||||
0x57,0x0d,0xb0,0x09,0x82,0x60,0x80,0x80,0xc8,0x10,0x1a,0x12,0x98,0x91,0x0d,0x08,0x10,0x94,0x18,0x99,
|
||||
0x3c,0x07,0x3d,0xdb,0x08,0xa2,0x44,0x08,0x90,0xc9,0x82,0x5b,0x10,0x98,0xc1,0x09,0x19,0x38,0xa3,0x83,
|
||||
0xab,0x5c,0x07,0x2c,0xea,0x08,0x80,0x43,0x80,0x81,0xbb,0x81,0x19,0x05,0x19,0xc0,0x8a,0x80,0x69,0x91,
|
||||
0x01,0xa9,0x39,0x37,0x2f,0xdb,0x08,0x91,0x63,0x08,0x80,0xb9,0x01,0x3b,0x12,0xa8,0xd3,0x1b,0x89,0x11,
|
||||
0xa7,0x11,0x8b,0xb0,0x77,0x0a,0xc8,0x8a,0x81,0x50,0x01,0x00,0xb8,0x29,0x0a,0x12,0xa1,0x91,0x8f,0x90,
|
||||
0x10,0x23,0x2b,0xb8,0x9a,0x77,0xe2,0xa2,0x8d,0x18,0x28,0x05,0x18,0x99,0x8a,0xa1,0x31,0x81,0x89,0xe9,
|
||||
0x18,0x00,0x31,0xa0,0x08,0xac,0x70,0xa7,0x00,0xae,0x18,0x00,0x25,0x90,0x08,0xac,0x11,0x00,0x13,0x9b,
|
||||
0x99,0x0d,0x03,0x01,0x94,0x0c,0x89,0x39,0x77,0x1b,0xcb,0x8a,0x84,0x51,0x00,0x89,0xb8,0x28,0x01,0x20,
|
||||
0xe1,0x09,0x99,0x30,0xa3,0x02,0xba,0x4d,0x1a,0x57,0x8b,0xbb,0x8d,0x05,0x21,0x11,0x8c,0xa8,0x18,0x13,
|
||||
0x29,0xb8,0xac,0x01,0x69,0x01,0x89,0xb8,0x19,0x41,0x77,0x9b,0xaa,0x8b,0x15,0x31,0x82,0xac,0x90,0x28,
|
||||
0x33,0x99,0xe1,0x9a,0x30,0x39,0x94,0xc8,0x08,0x2b,0x61,0x27,0x8d,0xab,0x8b,0x07,0x11,0x01,0x9c,0x80,
|
||||
0x00,0x23,0x8a,0x99,0xbb,0x24,0x01,0x21,0xae,0x18,0x88,0x34,0x47,0x9e,0x99,0x8b,0x16,0x01,0x00,0xbb,
|
||||
0x01,0x82,0x52,0x9a,0x9a,0xc0,0x42,0x10,0x0a,0xf0,0x00,0x20,0x4a,0x07,0xbb,0x8a,0x8c,0x34,0x82,0x10,
|
||||
0xbc,0x28,0x93,0x33,0xc8,0x0d,0x98,0x21,0x03,0x8b,0xb8,0x1c,0x53,0x10,0x57,0xbc,0x9a,0xaa,0x36,0x01,
|
||||
0x18,0xca,0x18,0x02,0x40,0xb0,0x9b,0x88,0x49,0x04,0xa9,0x90,0x9c,0x42,0x11,0x77,0xba,0x8a,0xab,0x53,
|
||||
0x02,0x28,0xc9,0x09,0x03,0x40,0x81,0x9d,0xa0,0x08,0x43,0x99,0x90,0xda,0x31,0x28,0x77,0xb9,0x9a,0xba,
|
||||
0x42,0x13,0x20,0xc8,0x0b,0x12,0x31,0x86,0xab,0xa8,0x8a,0x34,0x90,0x18,0xbd,0x29,0x92,0x77,0xa2,0xac,
|
||||
0xd9,0x28,0x22,0x20,0xb2,0xab,0x30,0x59,0x33,0xc8,0xa8,0xbb,0x40,0x10,0x11,0xf0,0x89,0x88,0x71,0x87,
|
||||
0xa9,0xb9,0x0d,0x21,0x11,0x04,0xb9,0x08,0x08,0x63,0x81,0x88,0xc9,0x0b,0x11,0x30,0x83,0xbd,0x99,0x1b,
|
||||
0x77,0x91,0x9a,0xdc,0x08,0x02,0x42,0x81,0x9a,0xa0,0x38,0x44,0x28,0xa1,0xfa,0x88,0x19,0x30,0xa1,0xa0,
|
||||
0xe9,0x78,0x82,0x98,0xf8,0x8a,0x18,0x38,0x04,0xa1,0x92,0x0c,0x40,0x00,0x04,0xb1,0x1a,0x8c,0x29,0xb2,
|
||||
0x83,0x98,0x2f,0x07,0x98,0xb8,0x9f,0x09,0x88,0x15,0x00,0x18,0x9a,0x10,0x94,0x43,0x00,0x3a,0xc9,0x80,
|
||||
0xa2,0x38,0x1a,0x8e,0x61,0xa5,0xa0,0xbc,0x8e,0x88,0x81,0x23,0x89,0x82,0x2a,0x11,0x12,0x07,0x10,0x10,
|
||||
0x1a,0x81,0x80,0x02,0x0a,0xb9,0x77,0x92,0x8c,0xbf,0x98,0x98,0x22,0x19,0x29,0x9b,0x13,0x12,0x15,0x00,
|
||||
0x31,0x5a,0x11,0x94,0xa5,0x82,0x49,0x2c,0x57,0xab,0xa0,0x9d,0x02,0xa1,0x5a,0x1d,0x0a,0xb2,0xa3,0x84,
|
||||
0x2a,0x0a,0x2f,0x82,0x96,0x99,0x68,0x4b,0x08,0xc1,0xa1,0x02,0x79,0x99,0x38,0xd9,0x12,0xc8,0x10,0x1c,
|
||||
0x18,0xc0,0xb3,0x92,0x7a,0x3a,0x1a,0xb1,0x84,0x93,0x10,0x8c,0x7a,0xa0,0x08,0xa8,0x4a,0xa8,0x1a,0xf4,
|
||||
0x00,0x01,0x38,0x29,0x1c,0x82,0xb0,0x95,0xb3,0x20,0x1f,0x8a,0x92,0xd1,0x98,0x33,0x48,0x0e,0x18,0x21,
|
||||
0xa0,0xc8,0x92,0x58,0x08,0x9f,0x94,0x08,0x82,0x1f,0x30,0x0a,0xc4,0xa0,0x12,0x29,0x99,0xaa,0x95,0x12,
|
||||
0xc9,0x10,0x08,0x16,0x9e,0x22,0x1c,0xb3,0x0b,0x10,0x78,0x98,0x88,0x88,0x00,0x87,0x0c,0x81,0x19,0xc4,
|
||||
0x08,0x20,0x3c,0xa8,0xe2,0x93,0x11,0x3b,0x0c,0x82,0xa1,0xb2,0x2b,0x79,0x89,0xf2,0x82,0x18,0x88,0x11,
|
||||
0x1b,0x20,0x9e,0x94,0x09,0x01,0x2c,0x90,0x13,0xf0,0x48,0x80,0x29,0x0b,0x4b,0xd1,0x10,0xb0,0x7e,0xa0,
|
||||
0x80,0xd3,0x10,0x82,0x4c,0x89,0xa0,0xb3,0x92,0x08,0x38,0x8b,0xf5,0x01,0x92,0x19,0x8b,0x86,0x91,0x1b,
|
||||
0x38,0x6a,0x8a,0x99,0xa4,0x20,0x08,0x0f,0xa5,0x88,0xa3,0x1c,0x34,0x1f,0x08,0x09,0x92,0xc0,0x02,0x1a,
|
||||
0x80,0xb3,0x28,0x39,0x0f,0xa2,0x08,0x82,0x2c,0xa1,0x13,0xf0,0x40,0x9a,0x95,0x98,0x18,0x80,0x3b,0x3f,
|
||||
0x4b,0xb1,0x91,0x11,0x4f,0x19,0x99,0x92,0x98,0x13,0x2b,0x7c,0x1c,0x28,0x9a,0xb4,0x28,0x41,0x0f,0x81,
|
||||
0xb0,0x84,0x9a,0x52,0x0d,0x10,0x88,0x11,0xd8,0x20,0xb0,0x10,0xe3,0x28,0x92,0x4c,0x2b,0xa9,0x94,0x49,
|
||||
0x90,0x88,0xe4,0x28,0x88,0x18,0xb0,0x02,0x48,0x80,0x0f,0x12,0x19,0xa8,0x0e,0x80,0x15,0xca,0x41,0x08,
|
||||
0x3a,0xb9,0x2e,0xa5,0x09,0x80,0x08,0x24,0xcb,0x85,0x8c,0x22,0xb0,0x1a,0x84,0x2f,0x12,0x9d,0x92,0x18,
|
||||
0x86,0x0a,0xa8,0x4c,0x83,0x8a,0xc1,0x38,0x22,0x9b,0xca,0xa2,0x07,0x09,0x3b,0x88,0x13,0xf8,0x1b,0x95,
|
||||
0x01,0x80,0x99,0x88,0x7b,0x39,0xb8,0xb2,0xb5,0x5d,0x28,0x1b,0xc1,0xc4,0x02,0x2b,0x59,0xc9,0x82,0xc3,
|
||||
0x49,0x89,0x4b,0xe3,0x91,0x83,0x19,0x10,0x0e,0x81,0xa9,0x24,0xc8,0x28,0x98,0x5c,0x00,0xa8,0xa3,0x18,
|
||||
0x30,0x8b,0xba,0x3b,0x96,0x94,0x81,0x99,0xb9,0x05,0x68,0x8a,0x99,0xa8,0x63,0x01,0x2a,0xf9,0x92,0xa4,
|
||||
0x4b,0x1a,0x0b,0x97,0x90,0x88,0x3b,0x60,0xc1,0x90,0xa4,0x29,0x20,0x8e,0x03,0xc0,0x99,0x28,0x38,0x89,
|
||||
0x02,0x05,0x20,0x00,0xb8,0xab,0x00,0xef,0x11,0xb8,0x49,0x89,0x1c,0x15,0x00,0x12,0xa8,0x70,0xa1,0xbb,
|
||||
0xa1,0xac,0x59,0x00,0x18,0x84,0x89,0x30,0x98,0x11,0x84,0x1a,0x09,0xbc,0xa1,0x77,0x90,0x9d,0xa8,0xa8,
|
||||
0x42,0x20,0x10,0x92,0xa8,0x30,0x18,0x30,0x94,0xca,0x98,0x9c,0x2b,0x77,0xb0,0x8d,0x99,0x89,0x24,0x12,
|
||||
0x28,0x90,0xba,0x14,0x02,0x50,0x88,0xcb,0xa0,0xa8,0x7a,0x17,0xda,0x89,0x98,0x39,0x33,0xa2,0x01,0xa9,
|
||||
0x0c,0x33,0x83,0x14,0xa8,0x9f,0x88,0xa0,0x74,0x84,0xbc,0x8a,0x9a,0x48,0x24,0x80,0x80,0xb8,0x19,0x34,
|
||||
0x11,0x11,0xf9,0x9a,0x00,0x88,0x73,0x87,0xdb,0x98,0x88,0x30,0x32,0x88,0x98,0xb8,0x38,0x45,0x00,0x88,
|
||||
0xc9,0x9a,0x30,0x18,0x71,0x87,0xcc,0x89,0x08,0x20,0x24,0xa8,0x88,0x09,0x39,0x16,0xa2,0x88,0x9b,0x0c,
|
||||
0x21,0x92,0x70,0x87,0xcd,0x88,0x01,0x28,0x22,0xa8,0x99,0x81,0x20,0x44,0x90,0xa9,0xa9,0x89,0x32,0x82,
|
||||
0x7a,0x07,0xce,0x09,0x01,0x28,0x22,0xc0,0x89,0x20,0x28,0x33,0xc2,0xca,0x08,0x19,0x30,0xa2,0x3c,0x67,
|
||||
0xeb,0x8b,0x12,0x80,0x22,0xa2,0xbb,0x21,0x22,0x32,0x94,0xbc,0x8b,0x01,0x13,0x92,0xbc,0x77,0xd1,0x9e,
|
||||
0x11,0x81,0x28,0x01,0xaa,0x19,0x23,0x11,0x01,0xca,0x9b,0x38,0x22,0x80,0xeb,0x7a,0x17,0xec,0x09,0x12,
|
||||
0x88,0x21,0x90,0xab,0x31,0x23,0x80,0x89,0xab,0x8b,0x15,0x84,0x8a,0x8c,0x71,0x97,0xcd,0x10,0x02,0x88,
|
||||
0x11,0xa0,0xaa,0x52,0x21,0x0a,0x8a,0xb0,0x90,0x43,0x00,0xad,0xa9,0x77,0xb1,0x9e,0x10,0x82,0x08,0x11,
|
||||
0xa8,0x0c,0x41,0x82,0xa8,0x08,0x09,0x8a,0x14,0xa3,0xac,0x2b,0x77,0xb0,0x9e,0x20,0x01,0x09,0x11,0xa0,
|
||||
0x8c,0x41,0x03,0xa9,0x89,0x80,0x99,0x42,0x93,0xcc,0x0a,0x75,0x92,0xbf,0x28,0x12,0x89,0x20,0x91,0xcb,
|
||||
0x40,0x23,0xa8,0x9b,0x82,0xb0,0x20,0x25,0xca,0x9c,0x21,0x67,0xc0,0xac,0x20,0x02,0x90,0x11,0x98,0x9c,
|
||||
0x41,0x04,0xb0,0x99,0x01,0x09,0x39,0x13,0xfa,0x9a,0x41,0x46,0xb8,0xbf,0x20,0x12,0x88,0x10,0x88,0x9c,
|
||||
0x40,0x04,0xa0,0x9a,0x10,0x08,0x08,0x13,0xd9,0x9c,0x21,0x76,0x91,0xbe,0x19,0x13,0x81,0x09,0x00,0xb9,
|
||||
0x29,0x36,0x91,0xbb,0x08,0x02,0x88,0x30,0xa0,0xce,0x18,0x53,0x27,0xf9,0x9b,0x30,0x12,0x98,0x08,0x90,
|
||||
0xa9,0x61,0x23,0xb9,0x9c,0x11,0x11,0x89,0x10,0xc8,0xbb,0x50,0x52,0x17,0xf8,0xab,0x30,0x23,0xa8,0x09,
|
||||
0x80,0x98,0x40,0x34,0xb8,0xad,0x20,0x83,0xa0,0x08,0x90,0xac,0x08,0x24,0x77,0xa1,0xbf,0x18,0x23,0x91,
|
||||
0x8a,0x18,0x88,0x09,0x35,0x92,0xbc,0x1a,0x33,0xa1,0xa9,0x10,0xca,0x8c,0x73,0x21,0x16,0xf8,0xad,0x20,
|
||||
0x23,0xa0,0x8a,0x00,0x80,0x28,0x25,0xb1,0xbc,0x28,0x24,0x98,0x8a,0x08,0xaa,0x1a,0x34,0xb2,0x70,0x27,
|
||||
0xee,0x89,0x32,0x82,0x9a,0x19,0x01,0x89,0x41,0x13,0xca,0x8c,0x31,0x83,0xb9,0x09,0x80,0xbb,0x38,0x16,
|
||||
0xb8,0x77,0xa1,0xbf,0x29,0x33,0x90,0x9a,0x20,0x90,0x09,0x44,0x82,0xbc,0x2a,0x43,0xa0,0x9a,0x10,0xa9,
|
||||
0x8c,0x41,0x82,0xdb,0x71,0x07,0xcc,0x0a,0x33,0x81,0x8b,0x28,0x91,0xaa,0x73,0x12,0xba,0x8b,0x32,0x92,
|
||||
0x9a,0x38,0xa9,0xaf,0x11,0x04,0xb8,0x3b,0x77,0xd1,0xac,0x30,0x13,0xa8,0x09,0x01,0xa9,0x38,0x27,0xa0,
|
||||
0xbb,0x20,0x23,0x99,0x1a,0x80,0xbd,0x1a,0x53,0x90,0xbb,0x69,0x77,0xc8,0x9c,0x30,0x02,0x98,0x18,0x81,
|
||||
0xaa,0x48,0x34,0xb0,0xbb,0x30,0x11,0xa9,0x01,0xc3,0xcc,0x2a,0x32,0xa8,0xb9,0x83,0x77,0x87,0xcc,0x1a,
|
||||
0x22,0x81,0x89,0x01,0xa8,0x0a,0x35,0x84,0xba,0x0a,0x12,0xa1,0x00,0x21,0xbe,0x8c,0x22,0x83,0xba,0x09,
|
||||
0x00,0x78,0x77,0xd9,0x8b,0x31,0x02,0x99,0x01,0xa0,0x8b,0x71,0x22,0xc8,0xa9,0x11,0x01,0x09,0x20,0xc9,
|
||||
0xcb,0x11,0x04,0x98,0x8a,0x00,0x98,0x77,0x97,0xad,0x18,0x12,0x90,0x08,0x01,0xb9,0x19,0x36,0x91,0xab,
|
||||
0x18,0x82,0x99,0x21,0x92,0xce,0x1a,0x32,0x88,0x9b,0x00,0xb1,0x39,0x77,0x97,0xaf,0x10,0x12,0x88,0x18,
|
||||
0x80,0xab,0x48,0x34,0xa0,0xab,0x20,0x80,0x09,0x42,0xb0,0xaf,0x08,0x11,0x01,0x80,0x99,0xab,0x38,0x74,
|
||||
0x67,0xd9,0x9b,0x31,0x01,0x88,0x11,0xc8,0x9a,0x62,0x12,0xa9,0x89,0x81,0x98,0x31,0x13,0xfb,0x9a,0x11,
|
||||
0x81,0x19,0x29,0xcb,0xaa,0x34,0x73,0x47,0xf9,0x8b,0x21,0x81,0x18,0x10,0xb9,0x8c,0x62,0x02,0x99,0x88,
|
||||
0x90,0x98,0x32,0x04,0xbc,0x9a,0x11,0x88,0x28,0x20,0xbe,0x99,0x05,0x92,0x76,0x94,0xbe,0x08,0x03,0x08,
|
||||
0x30,0x98,0xdb,0x20,0x24,0x80,0x1a,0x98,0xd8,0x11,0x23,0xa9,0x9c,0x88,0xa8,0x30,0x12,0xcb,0xaa,0x02,
|
||||
0x13,0x12,0x77,0x27,0xcf,0x18,0x81,0x00,0x21,0x98,0x9c,0x20,0x23,0x81,0x08,0xaa,0x9b,0x42,0x03,0xa9,
|
||||
0xaa,0xac,0x0a,0x23,0x92,0xab,0x0f,0x19,0x20,0x05,0x72,0x77,0xdb,0x09,0x81,0x18,0x31,0xa0,0x9c,0x10,
|
||||
0x12,0x31,0x02,0xbb,0x9b,0x22,0x31,0x39,0xcc,0xfa,0x90,0x01,0x38,0x09,0xbc,0xa0,0x83,0x42,0x11,0x77,
|
||||
0x87,0xad,0x08,0x90,0x20,0x14,0xaa,0x89,0x01,0x11,0x34,0x88,0x9c,0x88,0x92,0x12,0x10,0x8f,0x8a,0x88,
|
||||
0x80,0x92,0xa0,0x8a,0x09,0x82,0x87,0xa3,0x77,0x87,0xad,0x80,0xa0,0x31,0x03,0x9b,0x09,0xb1,0x42,0x25,
|
||||
0x0a,0x0a,0xa8,0x80,0x05,0x98,0x98,0xaa,0x8a,0x11,0x80,0x0a,0xbc,0x1c,0x43,0x01,0x85,0x73,0x67,0xdb,
|
||||
0x88,0x99,0x38,0x23,0xa9,0x81,0xc8,0x40,0x33,0x09,0x80,0xd1,0x8a,0x13,0x3a,0x3a,0xfb,0xb0,0x92,0x08,
|
||||
0x38,0x8b,0x8b,0xc3,0xa3,0x25,0x29,0x77,0xa7,0x0c,0xa9,0x8a,0x24,0x91,0x10,0x88,0x1d,0x22,0x91,0x12,
|
||||
0xb1,0x0c,0x21,0x9b,0x12,0xf1,0x8a,0x81,0x8a,0x48,0xb8,0xa0,0x96,0x80,0x30,0x99,0x78,0x77,0x99,0x98,
|
||||
0xac,0x19,0x80,0x29,0x11,0x89,0x43,0x03,0x42,0x12,0x8a,0x20,0xd8,0x88,0xb0,0x9d,0x89,0xbb,0x09,0xc0,
|
||||
0x80,0x14,0x49,0x78,0x18,0x20,0x77,0x92,0x09,0xdb,0xab,0x90,0x9a,0x10,0x80,0x40,0x24,0x31,0x25,0x02,
|
||||
0x22,0x91,0xa9,0xb8,0xaf,0x9b,0xdb,0xa9,0xa0,0x09,0x30,0x31,0x42,0x24,0x33,0x75,0x17,0x08,0xa0,0xcb,
|
||||
0x9a,0xbb,0x9b,0xa8,0x98,0x43,0x31,0x73,0x23,0x32,0x15,0x01,0x21,0x99,0x9b,0xcb,0xcd,0xb8,0xba,0x8b,
|
||||
0x8b,0x1b,0x11,0x03,0x47,0x77,0x00,0x10,0x99,0xaa,0xc0,0xaa,0x89,0x9a,0x29,0x81,0x22,0x17,0x22,0x52,
|
||||
0x20,0x20,0x82,0xa1,0x81,0xac,0x9b,0xbd,0xcb,0xb9,0xbb,0x89,0x8b,0x81,0x77,0x17,0x18,0x01,0xbb,0x89,
|
||||
0xcc,0x8a,0xa8,0x1a,0x21,0x20,0x36,0x13,0x43,0x14,0x20,0x21,0x98,0x90,0xe9,0x9a,0xcb,0x9c,0xaa,0xbb,
|
||||
0x99,0xb8,0x21,0x79,0x77,0x11,0x01,0xba,0x8a,0xcc,0xaa,0x98,0x0a,0x32,0x20,0x27,0x13,0x52,0x21,0x10,
|
||||
0x01,0x98,0x98,0xcb,0x9c,0xca,0xba,0xb9,0x9b,0x0a,0x0b,0x10,0x45,0x77,0x13,0x21,0xca,0xab,0xea,0x9b,
|
||||
0x99,0x9a,0x22,0x11,0x45,0x23,0x52,0x22,0x20,0x02,0xa0,0x90,0xdb,0xab,0xdb,0xab,0xb9,0xba,0x80,0x98,
|
||||
0x58,0x20,0x77,0x05,0x11,0xb9,0xaa,0xea,0x9b,0x99,0x8a,0x21,0x11,0x45,0x23,0x52,0x12,0x11,0x02,0x98,
|
||||
0x88,0xbb,0xad,0xda,0xaa,0xb9,0x8c,0x89,0x9a,0x01,0x70,0x77,0x18,0x01,0xaa,0x99,0xdb,0x9a,0x99,0x0a,
|
||||
0x02,0x21,0x37,0x21,0x43,0x02,0x22,0x82,0x09,0x98,0xad,0xaa,0x9c,0xba,0xba,0xbb,0xae,0xa9,0xb9,0x77,
|
||||
0x03,0x21,0xb1,0xab,0xe9,0x9d,0x98,0x9a,0x11,0x02,0x72,0x12,0x32,0x23,0x11,0x13,0x90,0x18,0xbc,0xac,
|
||||
0xda,0xbb,0xa9,0x9d,0x99,0xa9,0x10,0x79,0x57,0x10,0x01,0xba,0x9a,0xec,0x99,0xa9,0x09,0x01,0x20,0x35,
|
||||
0x22,0x35,0x12,0x32,0x82,0x00,0xa0,0xac,0xb9,0xae,0x9a,0xcb,0x09,0xa9,0x09,0x00,0x77,0x13,0x21,0xca,
|
||||
0xaa,0xfb,0x9b,0x9a,0x9b,0x00,0x11,0x54,0x22,0x53,0x13,0x32,0x13,0x00,0x02,0x9b,0xa9,0xfb,0x9a,0xbb,
|
||||
0x9d,0x1a,0x80,0x80,0x08,0x80,0x08,0x80,0x08,0x80,0x08,0x80,0x08,0x80,0x08,0x08,0x08,0x08,0x80,0x80,
|
||||
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,
|
||||
};
|
||||
static constexpr VoiceClip gpsOnClip = {
|
||||
gpsOnData, sizeof(gpsOnData), 9683, 8000
|
||||
};
|
||||
static const uint8_t gpsOffData[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,
|
||||
0x7f,0xf7,0xf7,0x61,0x5c,0x8b,0xd1,0x04,0x4a,0x8c,0xb3,0x83,0x90,0x98,0x91,0x22,0x2d,0x89,0x28,0xd1,
|
||||
0xa3,0x20,0x0a,0x80,0xf1,0xb7,0x01,0x5d,0x1a,0x88,0x91,0x18,0x2a,0xa0,0xb5,0x81,0x38,0x2c,0x88,0x2b,
|
||||
0x5a,0xb9,0xa7,0xa1,0xb4,0xc3,0x51,0x1d,0x08,0x90,0x20,0x3c,0x1b,0xf3,0xa3,0x81,0x28,0x1b,0x98,0xb4,
|
||||
0x82,0x6c,0x8a,0xc3,0xc4,0x11,0x09,0x00,0x0a,0xb1,0xa5,0x20,0x2c,0x39,0x4f,0x8a,0xa2,0x01,0x5b,0x0a,
|
||||
0xc1,0xb6,0x82,0x4a,0x8a,0xb2,0x02,0x5c,0x1b,0xa1,0xa2,0x01,0x3a,0x2a,0x3b,0x99,0xf7,0xa3,0x30,0x2d,
|
||||
0x19,0x29,0x2c,0xc0,0xb5,0x21,0x3c,0x2b,0xc0,0xb4,0xb4,0x11,0x2a,0x1a,0x98,0x82,0x3a,0x89,0x10,0xb9,
|
||||
0xb7,0x82,0x5a,0x2b,0xe0,0xc6,0x82,0x49,0x2c,0x89,0xc3,0x82,0x29,0x4b,0x8a,0xd4,0xa3,0x20,0x4d,0x0a,
|
||||
0xc2,0x82,0x29,0x2b,0xb0,0xb5,0x02,0x4b,0x3b,0x8a,0xd4,0xb4,0x01,0x29,0x4b,0x2b,0xd0,0xb6,0x82,0x39,
|
||||
0x2c,0x89,0xb2,0xa3,0x10,0x1a,0x90,0xa2,0x50,0x2e,0xe1,0xb4,0x02,0x5c,0x2b,0x89,0xa2,0x01,0x19,0x09,
|
||||
0xc2,0x11,0x3b,0x4c,0xa9,0xb5,0x11,0x5b,0x1b,0xc1,0x83,0x5b,0x0a,0xc2,0x82,0x39,0x2c,0x88,0x29,0x89,
|
||||
0x93,0x4d,0x99,0xe6,0xb5,0x82,0x5b,0x2b,0x98,0xc3,0x82,0x49,0x3d,0x99,0xc4,0x82,0x39,0x3d,0x99,0xc3,
|
||||
0x93,0x39,0x2c,0x09,0xb1,0xa4,0x10,0x3b,0x89,0xb2,0x12,0x3d,0xc8,0xb5,0x21,0x4f,0x2b,0xa0,0xb3,0x92,
|
||||
0x18,0x19,0x4a,0x3c,0x0a,0x00,0x3a,0x0a,0xf5,0xc5,0x21,0x3d,0x0a,0xa1,0xa3,0x80,0xb1,0x03,0x6e,0x2c,
|
||||
0x98,0xb3,0x92,0x00,0x5b,0x1a,0x88,0x00,0x19,0x98,0xc6,0x21,0x4f,0x0a,0xa0,0xb4,0x82,0x08,0x19,0x08,
|
||||
0x4a,0x1a,0x29,0xb8,0xb4,0xc5,0x21,0x3c,0x4b,0x9a,0xc5,0x82,0x39,0x3d,0x0a,0xb1,0xa4,0x81,0x18,0x2a,
|
||||
0xa8,0xa4,0x28,0xb0,0x31,0x2e,0xa0,0xc3,0xb3,0x70,0x4f,0x0a,0xc1,0xa3,0x20,0x4d,0x1a,0xb0,0xa5,0x10,
|
||||
0x4b,0x0a,0xa1,0xc3,0x82,0x19,0x19,0xa0,0x11,0x3b,0x1b,0xf5,0xa3,0x10,0x4c,0x0a,0x80,0x30,0x9a,0xb7,
|
||||
0x11,0x2c,0x8a,0xb0,0xb2,0x21,0x6c,0x19,0x91,0x93,0x02,0x29,0x2b,0x0b,0x8b,0xf8,0x24,0x3f,0xc0,0xa3,
|
||||
0x88,0x8a,0x1a,0x9a,0xa4,0x13,0x32,0x34,0x50,0x18,0x98,0xd1,0xb0,0x99,0x1f,0xb3,0x78,0x2b,0xd1,0x00,
|
||||
0x0c,0xa8,0x00,0x18,0x12,0x52,0x12,0x32,0x39,0xb9,0xd0,0xaa,0xcb,0x2a,0xf3,0x04,0x5c,0x9a,0xb2,0x19,
|
||||
0x9b,0x91,0x30,0x41,0x62,0x21,0x83,0x11,0x1c,0xbb,0xe8,0x99,0x59,0x2d,0xc1,0x83,0x2c,0xaa,0xb1,0x08,
|
||||
0x00,0x42,0x51,0x03,0x15,0x10,0x89,0xa9,0xca,0xba,0x0c,0xf2,0x12,0x4d,0xb8,0xb4,0x39,0x0c,0x90,0x11,
|
||||
0x20,0x14,0x42,0x20,0x91,0xb1,0xc9,0xca,0xab,0x6b,0x1d,0xe2,0x83,0x3b,0x9b,0xb2,0x18,0x90,0x06,0x60,
|
||||
0x10,0x83,0x11,0x0a,0xb8,0x9b,0x9e,0x1a,0xd9,0xb7,0x30,0x1d,0xc0,0x92,0x29,0x09,0x11,0x31,0x13,0x15,
|
||||
0x30,0x1a,0xb9,0xf9,0xb8,0x8a,0xe2,0x12,0x3e,0xc9,0xb4,0x39,0x1c,0x90,0x02,0x12,0x14,0x42,0x28,0x98,
|
||||
0xc1,0xa9,0x9c,0x0c,0xf2,0x83,0x4c,0xa9,0xc3,0x18,0x8a,0x81,0x40,0x38,0x13,0x24,0x01,0xa2,0x98,0x9e,
|
||||
0xca,0x99,0xf3,0x83,0x4d,0xa9,0xd3,0x10,0x1b,0xa0,0x84,0x31,0x21,0x42,0x28,0xb0,0xd3,0x1a,0x0f,0x0a,
|
||||
0xd1,0xb5,0x20,0x1d,0xa8,0x92,0x19,0x08,0x12,0x60,0x01,0x94,0x12,0x3c,0xab,0xf2,0x80,0x4a,0x1c,0xc1,
|
||||
0xa4,0x39,0x0c,0xa0,0x81,0x18,0x01,0x33,0x70,0x08,0xb3,0x82,0x1c,0x8c,0xc8,0xb3,0x58,0x1c,0xb0,0x81,
|
||||
0x1d,0xb8,0x93,0x69,0x18,0x85,0x22,0x28,0xa0,0xc2,0x89,0x9c,0xa9,0xc5,0x12,0x3d,0x9a,0xd2,0x08,0x8a,
|
||||
0xa2,0x32,0x40,0x14,0x33,0x38,0xb0,0xe2,0x0a,0x8f,0x00,0x3b,0xf0,0xb4,0x38,0x1e,0xb0,0xa3,0x20,0x29,
|
||||
0x12,0x41,0x18,0xb3,0x92,0x2d,0x8d,0x99,0xd3,0x83,0x4c,0x8b,0xb0,0x19,0x8c,0xb2,0x24,0x79,0x10,0x03,
|
||||
0x82,0x81,0x09,0x0e,0xab,0x01,0x3c,0xf0,0xa4,0x4a,0x0d,0xb0,0x82,0x18,0x81,0x14,0x50,0x18,0x91,0xa2,
|
||||
0x09,0x0d,0x8b,0xf4,0x93,0x6b,0x0b,0xc1,0x81,0x1a,0x98,0x12,0x48,0x01,0x85,0x12,0x08,0x98,0x0a,0x0f,
|
||||
0x88,0x09,0xe1,0xb3,0x4a,0x0d,0xa8,0x81,0x28,0x01,0x15,0x60,0x18,0xa2,0x82,0x0b,0xca,0x88,0xb0,0x94,
|
||||
0x5d,0x0c,0xc0,0xa1,0x88,0x08,0x30,0x30,0x86,0x86,0x21,0x19,0x89,0xa9,0xd9,0x82,0x4e,0x9a,0xc3,0x00,
|
||||
0x1c,0x99,0x00,0x4a,0x00,0x85,0x32,0x38,0x81,0x92,0x8a,0xad,0xc9,0xa3,0x7b,0x1c,0xe2,0x81,0x2b,0x9b,
|
||||
0xc3,0x31,0x5a,0x01,0x04,0x21,0x18,0x98,0x99,0xbb,0x9b,0xf3,0x02,0x5f,0x8b,0xe2,0x81,0x2a,0x0a,0x81,
|
||||
0x12,0x12,0x24,0x40,0x29,0x99,0xf1,0xa0,0x1a,0xa8,0x93,0x5d,0x8b,0xe2,0x00,0x2b,0x8a,0x93,0x04,0x32,
|
||||
0x61,0x28,0x91,0xb2,0xa0,0x0d,0x9c,0xc3,0x58,0x2d,0xc0,0x92,0x2b,0x9b,0xc3,0x31,0x5a,0x01,0x14,0x31,
|
||||
0x08,0xa1,0x99,0x9d,0xba,0x3b,0xbb,0xc7,0x33,0x2f,0xaa,0xd3,0x00,0x2a,0x08,0x03,0x43,0x31,0x12,0x10,
|
||||
0x9a,0xf9,0xb8,0x8b,0x4c,0x1b,0xe5,0x83,0x4c,0x8b,0xc1,0x01,0x2a,0x00,0x31,0x30,0x85,0x13,0x4b,0xaa,
|
||||
0xd1,0x99,0x8b,0x3a,0x2c,0xe5,0x83,0x5b,0x9b,0xd3,0x00,0x1a,0x81,0x13,0x31,0x04,0x32,0x1a,0xe0,0xa0,
|
||||
0x0d,0x9b,0x08,0xd2,0x85,0x6a,0x8a,0xd2,0x00,0x1b,0x98,0x82,0x22,0x41,0x41,0x11,0x92,0x88,0x8c,0xbc,
|
||||
0xb9,0xaa,0x42,0x5d,0xb1,0x84,0x2b,0xbb,0xe1,0x08,0x2a,0x10,0x15,0x43,0x31,0x11,0xa1,0xa8,0xad,0xac,
|
||||
0xba,0x9a,0x87,0x58,0x88,0xa2,0x09,0x8d,0xba,0xa0,0x48,0x48,0x23,0x17,0x31,0x00,0xa1,0xa8,0x9d,0xbb,
|
||||
0xca,0x09,0x42,0x38,0x85,0x91,0x0a,0xaf,0xc8,0x89,0x19,0x11,0x25,0x34,0x42,0x11,0x81,0x98,0xac,0xdb,
|
||||
0xba,0x9a,0x39,0x12,0x25,0x21,0x80,0xd8,0xca,0xbb,0x8c,0xa8,0xa8,0x72,0x43,0x24,0x32,0x21,0x00,0x99,
|
||||
0xcb,0xbc,0xab,0xa9,0x00,0x08,0x80,0xa1,0xaa,0xbd,0xdb,0xa9,0x0a,0x30,0x44,0x35,0x34,0x24,0x23,0x12,
|
||||
0x81,0xa8,0xbb,0x09,0x8b,0xb9,0xfb,0xbd,0xbd,0xdb,0xaa,0x9b,0x89,0x11,0x44,0x53,0x33,0x24,0x23,0x12,
|
||||
0x00,0xa8,0xba,0x9d,0x91,0x18,0x80,0xb8,0xdc,0xbc,0xcd,0xba,0xba,0x9a,0x18,0x41,0x44,0x43,0x24,0x33,
|
||||
0x32,0x21,0x80,0xa8,0x1b,0xc9,0xa8,0xdb,0xcb,0xad,0xdb,0xaa,0xab,0x9a,0x88,0x30,0x52,0x34,0x34,0x34,
|
||||
0x32,0x23,0x22,0x01,0xa1,0x35,0x1b,0xa8,0xcc,0xbd,0xbd,0xdb,0xaa,0xab,0x9a,0x89,0x11,0x35,0x63,0x42,
|
||||
0x32,0x32,0x32,0x12,0x01,0xb0,0x54,0x8d,0xa8,0xdb,0xbb,0xbc,0xac,0xaa,0x99,0x00,0x33,0x45,0x53,0x32,
|
||||
0x23,0x14,0x02,0x81,0xa8,0xba,0xcd,0x21,0x9f,0xa8,0xc9,0xa9,0xaa,0xa9,0x10,0x41,0x51,0x43,0x23,0x24,
|
||||
0x23,0x12,0x00,0xa9,0xcc,0xda,0xba,0xda,0x32,0x0e,0x08,0x99,0xa9,0x80,0x88,0x41,0x32,0x34,0x43,0x33,
|
||||
0x32,0x93,0xb1,0xda,0xdb,0xca,0xaa,0xdb,0xb8,0x67,0x0a,0x00,0x08,0xba,0x29,0xba,0xb5,0x87,0x08,0x01,
|
||||
0x08,0x11,0xa5,0x21,0x1e,0xa8,0xa0,0xa2,0x1b,0x31,0x88,0xf1,0x38,0xc0,0x12,0x91,0x70,0x80,0x98,0x19,
|
||||
0x8b,0xa2,0x5c,0xc0,0x80,0x21,0x18,0x79,0xa8,0x97,0xa2,0x19,0x9b,0xa9,0x0a,0x8e,0x7b,0xa1,0x81,0x20,
|
||||
0x19,0x88,0x07,0x88,0x1a,0x14,0x3a,0x59,0xc8,0x90,0x82,0x9d,0x00,0x89,0xe1,0x13,0x28,0x3d,0x89,0x80,
|
||||
0x11,0x09,0xf9,0x89,0x29,0xe4,0x08,0x83,0x49,0x5a,0x90,0x18,0xb1,0x29,0x4b,0x90,0x11,0xb3,0x1f,0x1a,
|
||||
0x99,0x18,0xb9,0xb2,0x87,0x41,0x69,0x00,0x19,0x0b,0xcb,0xaa,0xb7,0x11,0x00,0x90,0x9e,0x80,0x42,0x8d,
|
||||
0x30,0xa0,0xa6,0x04,0x0a,0x00,0x99,0x01,0xd3,0x21,0x1f,0x89,0xa0,0x08,0x18,0x02,0x02,0x51,0x95,0x22,
|
||||
0x89,0x8f,0xc1,0x90,0x19,0x91,0xa8,0x5b,0x3d,0x98,0x02,0xa2,0x1f,0x9a,0x96,0x02,0x2a,0x11,0x42,0x5a,
|
||||
0x08,0xb1,0x00,0xa8,0x9f,0xc2,0xa9,0xa0,0x8e,0x21,0x6b,0x10,0x83,0x1a,0x11,0xb0,0x82,0xd1,0x90,0x30,
|
||||
0x4c,0x09,0xa3,0x9a,0xc8,0xf1,0xb8,0x07,0x1b,0x89,0xb3,0x91,0x70,0x09,0x81,0x6a,0xb2,0x2d,0x14,0xb9,
|
||||
0x33,0xf9,0x38,0xa9,0x9a,0x10,0x1c,0x93,0x7b,0xb1,0x18,0x04,0xf0,0x7f,0xb1,0x3a,0x08,0x9a,0x07,0x0b,
|
||||
0xa6,0x0a,0x12,0x0a,0x80,0xf3,0x21,0x1a,0x2f,0xb0,0x01,0x93,0x1a,0x0a,0x8a,0x17,0x5d,0xa0,0xaa,0x07,
|
||||
0x3d,0x88,0x00,0x88,0x2a,0xc0,0x95,0x29,0x18,0x0f,0xa4,0x90,0x02,0x48,0x9d,0x05,0x0d,0xa4,0x3b,0xb1,
|
||||
0x38,0xc1,0x01,0x92,0x5b,0xa9,0x95,0x3a,0x08,0x1e,0xc4,0x28,0x88,0x08,0xb4,0x80,0x58,0x8d,0x94,0x0a,
|
||||
0x93,0x5d,0xc0,0x21,0xb8,0x22,0x0b,0xb1,0x41,0xac,0x14,0x1d,0x92,0x98,0x83,0x4e,0xa8,0x11,0xb8,0x22,
|
||||
0x8c,0x01,0x09,0x28,0xc2,0x7a,0xe8,0x84,0x88,0x39,0xb8,0x11,0xf1,0x22,0x2e,0x90,0x08,0xb2,0x30,0xaa,
|
||||
0x12,0x1d,0xc3,0x11,0xa9,0xa7,0x49,0xaa,0xa6,0x38,0x8a,0x10,0xa9,0xa5,0x49,0x0a,0x81,0x2a,0xe1,0x94,
|
||||
0x39,0x0a,0x29,0xd8,0xa6,0x10,0x1a,0x90,0x28,0xa8,0x93,0x88,0x90,0x20,0x9c,0xc7,0x21,0x89,0x30,0x1d,
|
||||
0x98,0xc5,0x11,0x0a,0x38,0x2d,0xd1,0xa4,0x28,0x1a,0x19,0xd2,0x02,0x4c,0x0a,0xa2,0x18,0xc0,0xb5,0x02,
|
||||
0x5b,0x2b,0x99,0xd6,0x93,0x28,0x2b,0x19,0x1a,0xe2,0xb4,0x82,0x4a,0x1b,0xd1,0xb4,0x12,0x4c,0x0a,0xa0,
|
||||
0xb4,0x02,0x5b,0x2b,0x09,0xb0,0xb7,0xa3,0x38,0x3d,0x0a,0x90,0x91,0xb3,0x40,0x2c,0x89,0xa1,0x02,0xa8,
|
||||
0x31,0x3c,0xc8,0xb7,0x81,0x00,0x4c,0x8a,0xa2,0x20,0xb8,0x44,0x3f,0xb9,0xb6,0x01,0x2a,0x88,0x6a,0x1b,
|
||||
0xb1,0xc6,0x93,0x38,0x3e,0x0a,0xb1,0xa3,0x18,0x18,0x19,0x4a,0x8a,0x21,0x1e,0xe2,0xb5,0x20,0x3b,0x0a,
|
||||
0x00,0xc0,0xa5,0x01,0x6b,0x2c,0x19,0x88,0xc2,0xb3,0x31,0x1f,0x80,0x08,0x80,0xb1,0xb4,0x42,0x3e,0x89,
|
||||
0x90,0x88,0xc1,0xa3,0x48,0x3c,0x09,0x91,0x01,0x90,0x92,0x38,0x3c,0x9a,0x17,0x7a,0x0a,0xc0,0x80,0x0c,
|
||||
0xa9,0xa2,0x11,0x20,0x22,0x51,0x10,0xa2,0xb3,0x80,0x3c,0xb7,0x51,0x2f,0xa9,0x91,0x8a,0xc8,0xb3,0x40,
|
||||
0x4b,0x00,0x03,0x11,0xa2,0xa4,0x18,0x4f,0xa8,0xa5,0x18,0x8b,0xd8,0x90,0x0a,0x89,0x02,0x51,0x30,0x03,
|
||||
0x14,0x38,0x1b,0xab,0x7a,0xb8,0xc7,0x82,0x2d,0x9b,0xb0,0x08,0x09,0x02,0x53,0x58,0x01,0x83,0x10,0x8a,
|
||||
0xd8,0x22,0x3f,0xb9,0xc5,0x08,0x8b,0xb8,0x00,0x4a,0x00,0x05,0x41,0x28,0x81,0x81,0x1a,0x0c,0xe5,0x93,
|
||||
0x5b,0x8c,0xa0,0x88,0x8a,0xc2,0x13,0x7a,0x18,0x82,0x12,0x19,0x98,0x98,0x48,0x3e,0xc9,0xc3,0x09,0x8c,
|
||||
0xb8,0x10,0x4a,0x81,0x87,0x22,0x38,0x80,0x91,0x8a,0x0c,0xf3,0x83,0x3d,0x9b,0xf2,0x80,0x2b,0x99,0x83,
|
||||
0x50,0x10,0x04,0x21,0x29,0xb8,0xd1,0x20,0x2e,0xc8,0xc3,0x19,0x0d,0xa8,0x00,0x39,0x00,0x06,0x31,0x38,
|
||||
0x91,0x92,0x0a,0x1e,0xf3,0xa3,0x39,0x0e,0xb8,0x09,0x0b,0xb1,0x85,0x41,0x30,0x22,0x40,0x09,0xe1,0xb1,
|
||||
0x58,0x2e,0xa8,0xc3,0x18,0x0c,0xa8,0x28,0x4c,0x88,0x95,0x22,0x39,0x80,0x81,0x1a,0x8c,0xf5,0xa3,0x39,
|
||||
0x0d,0xa8,0x80,0x1a,0xb0,0x96,0x31,0x39,0x02,0x03,0x38,0x0c,0xb9,0x21,0x3f,0xcb,0xd6,0x00,0x1b,0xa9,
|
||||
0x92,0x59,0x3a,0x92,0x86,0x02,0x00,0x00,0x1b,0x1c,0xf1,0xb3,0x38,0x1e,0xa9,0x90,0x1a,0x89,0x93,0x14,
|
||||
0x32,0x24,0x32,0x39,0xb8,0xf2,0xd4,0x20,0x2f,0x9a,0xb1,0x08,0x8b,0xb2,0x13,0x50,0x11,0x05,0x21,0x08,
|
||||
0xb1,0x98,0x7a,0x3e,0xaa,0xd4,0x91,0x1a,0x8a,0x88,0x39,0x10,0x96,0x85,0x21,0x18,0x80,0x09,0x5c,0x0b,
|
||||
0xf3,0x91,0x1a,0x8c,0x98,0x19,0x19,0xa3,0x07,0x31,0x48,0x18,0x90,0xb1,0x88,0xf2,0xa3,0x5c,0x0d,0xc0,
|
||||
0xa2,0x08,0x09,0x92,0x32,0x58,0x01,0x83,0x20,0x1c,0xd8,0xc5,0x11,0x3d,0x9b,0xb1,0x08,0x0b,0xc1,0x84,
|
||||
0x40,0x38,0x11,0x02,0x92,0xc2,0xa1,0x91,0x6c,0x1e,0xa9,0xc1,0x88,0x9a,0xb2,0x32,0x7a,0x01,0x95,0x13,
|
||||
0x29,0x89,0x98,0xb3,0x6a,0x1e,0xc9,0xc2,0x08,0x0b,0x88,0x21,0x79,0x00,0x84,0x02,0x10,0x89,0x98,0x91,
|
||||
0x7b,0x1e,0xc8,0xc2,0x80,0x1a,0x09,0x01,0x31,0x31,0x04,0x04,0x48,0x1b,0xe8,0xb5,0x20,0x2f,0x9a,0xb1,
|
||||
0x08,0x0a,0xa1,0x84,0x60,0x29,0x82,0x03,0x28,0x8a,0xb8,0xd6,0x92,0x3b,0x0f,0xa8,0x90,0x09,0xa0,0x95,
|
||||
0x42,0x59,0x00,0x92,0x01,0x89,0x39,0x0c,0xf1,0xc2,0x88,0x8b,0x8a,0x1a,0x18,0x04,0x15,0x23,0x13,0x22,
|
||||
0x3a,0x8e,0x81,0x4c,0x9c,0xf1,0xa0,0x0a,0x1b,0x09,0x11,0x32,0x35,0x33,0x13,0x02,0x89,0x1f,0xf1,0xc3,
|
||||
0x29,0x0f,0xa8,0xa1,0x28,0x2a,0x92,0x15,0x40,0x18,0x92,0x92,0x89,0x28,0x2f,0xca,0xf4,0x91,0x2a,0x0b,
|
||||
0x90,0x83,0x22,0x31,0x22,0x32,0x29,0x9a,0x8b,0xf6,0xa2,0x3c,0x8e,0xc0,0x80,0x2a,0xa0,0x86,0x31,0x59,
|
||||
0x80,0x92,0x81,0x8a,0x80,0x4c,0x8c,0xf1,0xa1,0x09,0x0a,0x90,0x12,0x51,0x40,0x10,0x93,0x93,0x09,0x1d,
|
||||
0xf2,0xb3,0x3a,0x8f,0xb0,0xa1,0x29,0x08,0x04,0x42,0x48,0x81,0x93,0x08,0xab,0x82,0x4f,0x9c,0xf3,0x80,
|
||||
0x1a,0x99,0x82,0x30,0x48,0x02,0x85,0x01,0x19,0x8a,0x9a,0xe6,0x93,0x4b,0x8c,0xc0,0x80,0x09,0x91,0x23,
|
||||
0x70,0x10,0x82,0x01,0x0a,0xba,0x82,0x3f,0xab,0xf3,0x08,0x0b,0xa8,0x11,0x30,0x04,0x25,0x48,0x08,0xb1,
|
||||
0x88,0x2e,0xe1,0x93,0x5b,0x8c,0xc1,0x00,0x2b,0x90,0x04,0x50,0x18,0x92,0x01,0x8a,0xe0,0x21,0x3e,0xa9,
|
||||
0xd4,0x00,0x0b,0xa8,0x10,0x4a,0x01,0x15,0x30,0x00,0xa2,0x89,0x9d,0xd1,0x18,0x1c,0xc0,0x92,0x09,0x98,
|
||||
0x02,0x58,0x00,0x85,0x22,0x29,0x98,0xb0,0x19,0xf2,0x82,0x2e,0xac,0xd1,0x08,0x1a,0x11,0x33,0x14,0x04,
|
||||
0x10,0x99,0xb9,0x9a,0x3c,0xd2,0x96,0x29,0x8d,0xb9,0x99,0x88,0x42,0x70,0x11,0x82,0x82,0x89,0x8b,0xaa,
|
||||
0xb0,0x87,0x40,0x0d,0xc8,0x98,0x8a,0x18,0x40,0x32,0x14,0x02,0x00,0x9a,0xba,0xa9,0x98,0x37,0x3c,0xe9,
|
||||
0xc0,0x99,0x8a,0x38,0x41,0x14,0x13,0x11,0x09,0x0c,0x9a,0x88,0x10,0x7a,0xd4,0xa2,0x0d,0xab,0x88,0x00,
|
||||
0x24,0x51,0x10,0x01,0x09,0x98,0x08,0x19,0x90,0xa0,0x79,0xa9,0xf4,0xaa,0xaa,0x29,0x38,0x25,0x52,0x18,
|
||||
0x81,0xa1,0x81,0x39,0x1c,0xa8,0xf0,0x38,0xf2,0x00,0x8e,0xb1,0x98,0x11,0x61,0x28,0x92,0x11,0x19,0x29,
|
||||
0x0b,0xd2,0xa0,0xb8,0xb9,0x77,0x2d,0xc8,0x90,0x98,0x11,0x38,0x85,0x12,0x08,0x2b,0xaa,0xb4,0x01,0x1b,
|
||||
0xca,0xf2,0xa1,0x77,0x1b,0xd0,0x88,0x99,0x31,0x48,0x02,0x80,0xe1,0x28,0x1b,0x92,0x91,0x92,0x2f,0x8c,
|
||||
0x01,0x79,0xb7,0x10,0x8d,0x88,0x88,0x85,0x30,0x88,0x09,0xb9,0x83,0x3a,0x92,0x2a,0xf9,0x00,0x98,0x23,
|
||||
0x7d,0xe3,0xa2,0xaa,0x10,0x4a,0x83,0x12,0xa8,0x1a,0x9c,0x84,0x20,0xa0,0x98,0xaa,0x39,0x29,0x06,0x58,
|
||||
0xb7,0x4b,0x9e,0x00,0x80,0x15,0x19,0xa0,0x99,0xa1,0x50,0x19,0x00,0xaa,0x88,0x0a,0x04,0x31,0x3a,0x7f,
|
||||
0xf3,0x80,0x0b,0x38,0x88,0x87,0x08,0x89,0x1b,0xb2,0x23,0x08,0x2a,0xad,0x91,0x21,0x41,0x89,0xe1,0x79,
|
||||
0xe2,0x00,0xaa,0x21,0x19,0x15,0x89,0xa1,0x0c,0x80,0x48,0xa2,0x10,0xbb,0x88,0x88,0x17,0x29,0x98,0xca,
|
||||
0x57,0x0d,0xb0,0x09,0x82,0x60,0x80,0x80,0xc8,0x10,0x1a,0x12,0x98,0x91,0x0d,0x08,0x10,0x94,0x18,0x99,
|
||||
0x3c,0x07,0x3d,0xdb,0x08,0xa2,0x44,0x08,0x90,0xc9,0x82,0x5b,0x10,0x98,0xc1,0x09,0x19,0x38,0xa3,0x83,
|
||||
0xab,0x5c,0x07,0x2c,0xea,0x08,0x80,0x43,0x80,0x81,0xbb,0x81,0x19,0x05,0x19,0xc0,0x8a,0x80,0x69,0x91,
|
||||
0x01,0xa9,0x39,0x37,0x2f,0xdb,0x08,0x91,0x63,0x08,0x80,0xb9,0x01,0x3b,0x12,0xa8,0xd3,0x1b,0x89,0x11,
|
||||
0xa7,0x11,0x8b,0xb0,0x77,0x0a,0xc8,0x8a,0x81,0x50,0x01,0x00,0xb8,0x29,0x0a,0x12,0xa1,0x91,0x8f,0x90,
|
||||
0x10,0x23,0x2b,0xb8,0x9a,0x77,0xe2,0xa2,0x8d,0x18,0x28,0x05,0x18,0x99,0x8a,0xa1,0x31,0x81,0x89,0xe9,
|
||||
0x18,0x00,0x31,0xa0,0x08,0xac,0x70,0xa7,0x00,0xae,0x18,0x00,0x25,0x90,0x08,0xac,0x11,0x00,0x13,0x9b,
|
||||
0x99,0x0d,0x03,0x01,0x94,0x0c,0x89,0x39,0x77,0x1b,0xcb,0x8a,0x84,0x51,0x00,0x89,0xb8,0x28,0x01,0x20,
|
||||
0xe1,0x09,0x99,0x30,0xa3,0x02,0xba,0x4d,0x1a,0x57,0x8b,0xbb,0x8d,0x05,0x21,0x11,0x8c,0xa8,0x18,0x13,
|
||||
0x29,0xb8,0xac,0x01,0x69,0x01,0x89,0xb8,0x19,0x41,0x77,0x9b,0xaa,0x8b,0x15,0x31,0x82,0xac,0x90,0x28,
|
||||
0x33,0x99,0xe1,0x9a,0x30,0x39,0x94,0xc8,0x08,0x2b,0x61,0x27,0x8d,0xab,0x8b,0x07,0x11,0x01,0x9c,0x80,
|
||||
0x00,0x23,0x8a,0x99,0xbb,0x24,0x01,0x21,0xae,0x18,0x88,0x34,0x47,0x9e,0x99,0x8b,0x16,0x01,0x00,0xbb,
|
||||
0x01,0x82,0x52,0x9a,0x9a,0xc0,0x42,0x10,0x0a,0xf0,0x00,0x20,0x4a,0x07,0xbb,0x8a,0x8c,0x34,0x82,0x10,
|
||||
0xbc,0x28,0x93,0x33,0xc8,0x0d,0x98,0x21,0x03,0x8b,0xb8,0x1c,0x53,0x10,0x57,0xbc,0x9a,0xaa,0x36,0x01,
|
||||
0x18,0xca,0x18,0x02,0x40,0xb0,0x9b,0x88,0x49,0x04,0xa9,0x90,0x9c,0x42,0x11,0x77,0xba,0x8a,0xab,0x53,
|
||||
0x02,0x28,0xc9,0x09,0x03,0x40,0x81,0x9d,0xa0,0x08,0x43,0x99,0x90,0xda,0x31,0x28,0x77,0xb9,0x9a,0xba,
|
||||
0x42,0x13,0x20,0xc8,0x0b,0x12,0x31,0x86,0xab,0xa8,0x8a,0x34,0x90,0x18,0xbd,0x29,0x92,0x77,0xa2,0xac,
|
||||
0xd9,0x28,0x22,0x20,0xb2,0xab,0x30,0x59,0x33,0xc8,0xa8,0xbb,0x40,0x10,0x11,0xf0,0x89,0x88,0x71,0x87,
|
||||
0xa9,0xb9,0x0d,0x21,0x11,0x04,0xb9,0x08,0x08,0x63,0x81,0x88,0xc9,0x0b,0x11,0x30,0x83,0xbd,0x99,0x1b,
|
||||
0x77,0x91,0x9a,0xdc,0x08,0x02,0x42,0x81,0x9a,0xa0,0x38,0x44,0x28,0xa1,0xfa,0x88,0x19,0x30,0xa1,0xa0,
|
||||
0xe9,0x78,0x82,0x98,0xf8,0x8a,0x18,0x38,0x04,0xa1,0x92,0x0c,0x40,0x00,0x04,0xb1,0x1a,0x8c,0x29,0xb2,
|
||||
0x83,0x98,0x2f,0x07,0x98,0xb8,0x9f,0x09,0x88,0x15,0x00,0x18,0x9a,0x10,0x94,0x43,0x00,0x3a,0xc9,0x80,
|
||||
0xa2,0x38,0x1a,0x8e,0x61,0xa5,0xa0,0xbc,0x8e,0x88,0x81,0x23,0x89,0x82,0x2a,0x11,0x12,0x07,0x10,0x10,
|
||||
0x1a,0x81,0x80,0x02,0x0a,0xb9,0x77,0x92,0x8c,0xbf,0x98,0x98,0x22,0x19,0x29,0x9b,0x13,0x12,0x15,0x00,
|
||||
0x31,0x5a,0x11,0x94,0xa5,0x82,0x49,0x2c,0x57,0xab,0xa0,0x9d,0x02,0xa1,0x5a,0x1d,0x0a,0xb2,0xa3,0x84,
|
||||
0x2a,0x0a,0x2f,0x82,0x96,0x99,0x68,0x4b,0x08,0xc1,0xa1,0x02,0x79,0x99,0x38,0xd9,0x12,0xc8,0x10,0x1c,
|
||||
0x18,0xc0,0xb3,0x92,0x7a,0x3a,0x1a,0xb1,0x84,0x93,0x10,0x8c,0x7a,0xa0,0x08,0xa8,0x4a,0xa8,0x1a,0xf4,
|
||||
0x00,0x01,0x38,0x29,0x1c,0x82,0xb0,0x95,0xb3,0x20,0x1f,0x8a,0x92,0xd1,0x98,0x33,0x48,0x0e,0x18,0x21,
|
||||
0xa0,0xc8,0x92,0x58,0x08,0x9f,0x94,0x08,0x82,0x1f,0x30,0x0a,0xc4,0xa0,0x12,0x29,0x99,0xaa,0x95,0x12,
|
||||
0xc9,0x10,0x08,0x16,0x9e,0x22,0x1c,0xb3,0x0b,0x10,0x78,0x98,0x88,0x88,0x00,0x87,0x0c,0x81,0x19,0xc4,
|
||||
0x08,0x20,0x3c,0xa8,0xe2,0x93,0x11,0x3b,0x0c,0x82,0xa1,0xb2,0x2b,0x79,0x89,0xf2,0x82,0x18,0x88,0x11,
|
||||
0x1b,0x20,0x9e,0x94,0x09,0x01,0x2c,0x90,0x13,0xf0,0x48,0x80,0x29,0x0b,0x4b,0xd1,0x10,0xb0,0x7e,0xa0,
|
||||
0x80,0xd3,0x10,0x82,0x4c,0x89,0xa0,0xb3,0x92,0x08,0x38,0x8b,0xf5,0x01,0x92,0x29,0x8c,0x84,0xa2,0x1b,
|
||||
0x38,0x7a,0x8a,0xa8,0xa4,0x20,0x08,0x0f,0xa4,0x90,0x94,0x1c,0x33,0x0f,0x00,0x09,0x92,0xd0,0x02,0x1a,
|
||||
0x80,0xb3,0x28,0x28,0x0f,0x92,0x88,0x82,0x2c,0xa1,0x13,0xf0,0x40,0x9a,0x95,0x98,0x18,0x80,0x3b,0x3f,
|
||||
0x4b,0xb1,0x91,0x11,0x3f,0x18,0x8a,0xa2,0xa0,0x04,0x2a,0x6c,0x1c,0x28,0x9a,0xb4,0x38,0x40,0x0f,0x81,
|
||||
0xb0,0x84,0x8b,0x52,0x0d,0x10,0x90,0x11,0xd8,0x20,0xc0,0x20,0xe2,0x10,0x81,0x4b,0x2c,0xa8,0x93,0x6a,
|
||||
0x88,0x88,0xe3,0x28,0x88,0x18,0xb0,0x02,0x59,0x80,0x0e,0x03,0x19,0xb0,0x0e,0x80,0x15,0xca,0x41,0x08,
|
||||
0x3a,0xb9,0x2e,0xa5,0x09,0x80,0x08,0x24,0xcb,0x85,0x8c,0x13,0xb0,0x1a,0x84,0x2f,0x12,0x9d,0xa2,0x10,
|
||||
0x86,0x0a,0xa8,0x4c,0x83,0x8a,0xc1,0x38,0x22,0x9b,0xca,0xa2,0x07,0x09,0x3b,0x88,0x04,0xd8,0x1b,0x95,
|
||||
0x01,0x91,0x99,0x98,0x7b,0x49,0xa8,0xa1,0xc4,0x7b,0x18,0x0a,0xb1,0xc4,0x12,0x1c,0x59,0xc8,0x82,0xb2,
|
||||
0x49,0x0a,0x4c,0xd2,0x91,0x83,0x19,0x20,0x0f,0x91,0x98,0x23,0xc8,0x18,0x90,0x4c,0x01,0xa9,0xa5,0x08,
|
||||
0x21,0x9a,0xa9,0x3b,0x85,0xb3,0x82,0xb8,0xb8,0x06,0x7a,0x0a,0x99,0xb0,0x34,0x01,0x4b,0xea,0xa3,0xa5,
|
||||
0x4b,0x1a,0x1b,0xa6,0x90,0x08,0x2c,0x41,0xd2,0x90,0xa4,0x29,0x20,0x0e,0x93,0xc0,0x99,0x28,0x38,0x89,
|
||||
0x14,0x12,0x48,0x08,0xc0,0x9a,0x18,0xbf,0x11,0xc8,0x48,0x9a,0x4b,0x14,0x10,0x13,0xa9,0x70,0xa2,0xad,
|
||||
0xa0,0xbb,0x48,0x02,0x21,0x04,0x1a,0x39,0x99,0x85,0x82,0x19,0xbb,0xeb,0x91,0x18,0x4a,0x98,0xb0,0x84,
|
||||
0x29,0x58,0x81,0xb2,0x77,0xa4,0x9f,0x90,0x99,0x51,0x10,0x08,0x92,0xa9,0x58,0x00,0x88,0xa3,0xba,0x1b,
|
||||
0x99,0x90,0x07,0x98,0x29,0x19,0x1a,0x05,0x92,0x28,0xa9,0x77,0xb5,0xaf,0x10,0x88,0x30,0x14,0xa9,0x19,
|
||||
0xa8,0x18,0x16,0x98,0x89,0x99,0x8b,0x22,0x82,0x29,0x89,0x9d,0x81,0x13,0x62,0x00,0xba,0xc0,0x77,0xa3,
|
||||
0xbf,0x08,0x00,0x40,0x22,0xc8,0x98,0x00,0x29,0x14,0xc2,0x9a,0x1a,0x0c,0x12,0x94,0x99,0x19,0x8a,0x12,
|
||||
0x07,0x88,0x2b,0x9a,0xb2,0x77,0x94,0xdc,0x09,0x10,0x20,0x22,0xc0,0x8b,0x30,0x00,0x13,0xb1,0xaf,0x19,
|
||||
0x82,0x11,0x01,0xbc,0x98,0x14,0x20,0x20,0xba,0x9c,0x31,0x30,0x7a,0x57,0xfb,0x0b,0x21,0x82,0x11,0x90,
|
||||
0x9e,0x11,0x03,0x08,0x09,0xbc,0x08,0x15,0x08,0x09,0xb9,0x88,0x63,0x00,0x9a,0x90,0x98,0x51,0x10,0xba,
|
||||
0x77,0xa1,0xbf,0x28,0x13,0x00,0x00,0xd9,0x1a,0x43,0xa1,0x98,0x99,0x8b,0x53,0x93,0xab,0x1a,0x80,0x22,
|
||||
0x14,0xcb,0x0b,0x22,0x82,0x10,0x9a,0x9f,0x77,0xd2,0x9e,0x11,0x03,0x08,0x08,0xba,0x28,0x35,0xa9,0xab,
|
||||
0x01,0x18,0x60,0x90,0xbb,0x20,0x32,0x0a,0x88,0xe8,0x18,0x42,0x08,0xaa,0xc8,0x28,0x77,0xd2,0x9f,0x21,
|
||||
0x12,0x89,0x89,0x98,0x38,0x43,0xc8,0xab,0x21,0x11,0x18,0xb0,0xdb,0x48,0x33,0xc0,0xaa,0x28,0x28,0x12,
|
||||
0xa0,0x9e,0x39,0x84,0x71,0x97,0xec,0x19,0x33,0x91,0xaa,0x08,0x18,0x41,0xa3,0xcc,0x2a,0x23,0xa1,0x98,
|
||||
0x8a,0x8a,0x16,0x82,0x9c,0x09,0x83,0x02,0x18,0xac,0x98,0x15,0xa1,0x77,0xc0,0x9f,0x20,0x14,0x99,0x8a,
|
||||
0x81,0x01,0x22,0xa8,0xae,0x11,0x23,0xa9,0x99,0x98,0x20,0x24,0xb8,0xac,0x30,0x23,0x89,0xa9,0xb9,0x50,
|
||||
0x51,0x49,0x67,0xfa,0x0d,0x31,0x02,0xaa,0x1a,0x10,0x11,0x12,0xe9,0x9b,0x42,0x83,0xb9,0x8a,0x18,0x21,
|
||||
0x83,0xd8,0x8b,0x31,0x04,0xa8,0x9a,0x08,0x12,0x86,0x59,0x57,0xfa,0x8d,0x32,0x02,0xba,0x09,0x11,0x02,
|
||||
0x11,0xba,0xad,0x33,0x14,0xab,0x8c,0x81,0x13,0x10,0xab,0xba,0x34,0x33,0xcb,0xab,0x22,0x42,0x09,0x6a,
|
||||
0x77,0xe9,0x8d,0x31,0x84,0xa9,0x1a,0x11,0x81,0x02,0x9a,0x8d,0x21,0x04,0x9a,0x8c,0x00,0x03,0x10,0x8c,
|
||||
0xa9,0x03,0x14,0x0a,0xab,0x92,0x14,0x10,0xab,0x77,0xc5,0xaf,0x30,0x14,0x99,0x9b,0x11,0x03,0x01,0x99,
|
||||
0xbb,0x11,0x26,0x98,0xac,0x08,0x13,0x82,0xaa,0x9b,0x31,0x43,0xb8,0xcb,0x41,0x32,0xb9,0xd8,0x77,0x93,
|
||||
0xef,0x18,0x32,0x90,0x9c,0x10,0x12,0x18,0x99,0xa9,0x10,0x52,0x88,0xcb,0x08,0x41,0x00,0xb9,0x99,0x30,
|
||||
0x22,0xb0,0xc9,0x29,0x51,0x81,0xb9,0x77,0x94,0xcf,0x29,0x43,0xa0,0xab,0x20,0x22,0x08,0xa0,0xba,0x49,
|
||||
0x53,0xb0,0xd9,0x18,0x21,0x80,0xb8,0x99,0x48,0x21,0xc1,0xb8,0x19,0x68,0x02,0xd1,0x72,0x84,0xdf,0x08,
|
||||
0x24,0x98,0xaa,0x20,0x12,0x08,0x88,0xba,0x20,0x44,0x98,0xac,0x18,0x31,0x18,0xaa,0xba,0x30,0x25,0xb0,
|
||||
0xbb,0x38,0x61,0x80,0xc8,0x77,0x92,0xcf,0x18,0x33,0xa0,0xac,0x11,0x12,0x00,0x98,0xaa,0x28,0x35,0xb0,
|
||||
0xbc,0x10,0x23,0x90,0xaa,0x9b,0x30,0x16,0xa0,0x9c,0x18,0x05,0x81,0x1b,0x77,0xc2,0xbf,0x30,0x14,0xb8,
|
||||
0x8b,0x21,0x12,0x10,0x99,0x9d,0x30,0x15,0xa9,0xab,0x21,0x21,0x98,0xca,0x80,0x32,0x82,0xca,0x99,0x41,
|
||||
0x21,0xb8,0x78,0x77,0xfb,0x0a,0x42,0x81,0xba,0x18,0x21,0x01,0x81,0xbb,0x0c,0x35,0x81,0xac,0x1a,0x12,
|
||||
0x01,0x89,0xbb,0x08,0x35,0x81,0xad,0x88,0x04,0x11,0x1b,0x77,0xd2,0xae,0x20,0x14,0xa8,0x8b,0x11,0x12,
|
||||
0x10,0xa8,0xbc,0x51,0x23,0xca,0x9a,0x11,0x12,0x88,0xb9,0x8b,0x30,0x33,0xa1,0xe9,0x09,0x51,0x01,0x70,
|
||||
0x17,0xfc,0x0b,0x43,0xa2,0xaa,0x19,0x22,0x01,0x81,0xcb,0x2b,0x45,0x91,0xac,0x19,0x31,0x80,0xb8,0xb9,
|
||||
0x28,0x44,0xa1,0xcb,0x18,0x42,0x80,0x49,0x57,0xf9,0x8c,0x31,0x83,0xba,0x1a,0x03,0x02,0x21,0xca,0x9c,
|
||||
0x53,0x02,0xcb,0x09,0x11,0x00,0x80,0xc9,0x0a,0x62,0x00,0xba,0x19,0x22,0x00,0x19,0x77,0xd3,0xaf,0x20,
|
||||
0x14,0x99,0x8b,0x01,0x12,0x30,0xa9,0xad,0x41,0x23,0xca,0x9a,0x11,0x20,0x80,0xc9,0x0b,0x68,0x02,0xb9,
|
||||
0x8a,0x21,0x12,0x91,0x77,0xa4,0xde,0x08,0x43,0x98,0x9a,0x00,0x11,0x21,0x90,0xdb,0x28,0x34,0xa8,0xab,
|
||||
0x08,0x21,0x01,0xb1,0x9f,0x3a,0x33,0xb0,0xbb,0x4a,0x21,0x93,0x74,0x17,0xed,0x0a,0x42,0x91,0xa9,0x08,
|
||||
0x10,0x12,0x93,0xca,0x1b,0x34,0x93,0xca,0x0a,0x28,0x21,0xa1,0xdb,0x0a,0x22,0x83,0xc9,0x8b,0x10,0x06,
|
||||
0x70,0x27,0xfa,0x8c,0x31,0x02,0xaa,0x0a,0x10,0x22,0x13,0xca,0x9c,0x42,0x13,0x9a,0x9c,0x00,0x31,0x00,
|
||||
0xe9,0xa9,0x40,0x11,0xb8,0xa9,0x39,0x68,0x78,0x07,0xe9,0x0c,0x30,0x83,0xb9,0x1a,0x18,0x12,0x04,0xa9,
|
||||
0x8d,0x31,0x14,0x9a,0x9b,0x00,0x22,0x02,0xda,0xab,0x31,0x33,0xbb,0xbc,0x01,0x61,0x79,0x27,0xfa,0x0c,
|
||||
0x30,0x82,0x99,0x0a,0x08,0x03,0x15,0x9a,0x8d,0x22,0x12,0x8a,0xaa,0x80,0x41,0x30,0xea,0x99,0x20,0x21,
|
||||
0xa9,0xa9,0x1b,0x58,0x71,0x37,0xfb,0x0d,0x21,0x92,0xa8,0x09,0x88,0x22,0x24,0xba,0x9c,0x23,0x23,0x0a,
|
||||
0xc9,0xc0,0x41,0x30,0xc9,0xc8,0x20,0x28,0x88,0xb0,0x1c,0x0a,0x73,0x17,0xeb,0x1b,0x21,0x92,0x08,0x8a,
|
||||
0xba,0x34,0x24,0xab,0xa9,0x04,0x30,0x20,0xd0,0x99,0x69,0x10,0xa0,0x98,0x0a,0x28,0x11,0xaa,0x9c,0x08,
|
||||
0x79,0x17,0xdd,0x28,0x00,0x90,0x82,0xba,0x39,0x24,0x90,0x09,0x80,0x01,0x16,0xa8,0x08,0x30,0x4a,0x19,
|
||||
0xa9,0xb8,0x96,0x00,0x1c,0x9a,0x98,0x01,0x7f,0xc7,0x99,0x11,0x1a,0x80,0xb0,0x29,0x23,0xa8,0x11,0x2a,
|
||||
0x93,0xa7,0x92,0x69,0x2a,0x88,0x91,0x2a,0x88,0xb2,0x89,0xe0,0x25,0x8f,0x32,0x8f,0x2a,0xc2,0xa5,0x18,
|
||||
0x39,0x8f,0x84,0xa0,0x10,0xa0,0x01,0x41,0x2d,0x09,0xc2,0x90,0x82,0xf3,0x88,0x31,0x9c,0x32,0xba,0xa1,
|
||||
0x83,0x88,0xa7,0x3c,0x22,0x1f,0xc5,0x91,0x21,0x1e,0x90,0xb2,0x11,0x2b,0xc0,0x81,0x97,0x5a,0x1a,0xb8,
|
||||
0xa3,0x94,0x1b,0x83,0x0b,0x18,0x98,0x30,0xf5,0x28,0x91,0x7b,0xa8,0xd3,0x93,0x10,0x2e,0x88,0xb1,0x13,
|
||||
0x1e,0x01,0xe1,0x21,0x89,0x3a,0xc0,0x48,0xc0,0x80,0x94,0x90,0x21,0x0d,0x10,0x91,0x0a,0xb2,0x39,0x08,
|
||||
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0x00,0x88,0x00,0x08,0x08,0x08,0x08,0x88,0x80,0x80,
|
||||
0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static constexpr VoiceClip gpsOffClip = {
|
||||
gpsOffData, sizeof(gpsOffData), 9237, 8000
|
||||
};
|
||||
}} // namespace mesh::audio
|
||||
+183
-2
@@ -1,6 +1,51 @@
|
||||
#include "Arduino.h"
|
||||
#ifdef PIN_BUZZER
|
||||
#include "buzzer.h"
|
||||
#if MESH_GPS_VOICE
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
// Board source filters already compile this player entry point. Keep the
|
||||
// experimental decoder out of ordinary images and avoid changing every
|
||||
// board's filter just for the hardware comparison.
|
||||
#include "g726/g726_decoder.c"
|
||||
#include "G726VoiceData.h"
|
||||
#else
|
||||
#include "ButtonVoiceData.h"
|
||||
#include "GpsVoiceData.h"
|
||||
#endif
|
||||
#include "nrf52/GpsVoicePlayer.h"
|
||||
static mesh::audio::GpsVoicePlayer gps_voice;
|
||||
extern "C" void PWM3_IRQHandler() { gps_voice.interrupt(); }
|
||||
|
||||
static mesh::audio::VoiceClip buttonVoiceClip(ButtonVoicePrompt prompt) {
|
||||
using namespace mesh::audio;
|
||||
switch (prompt) {
|
||||
case ButtonVoicePrompt::Ready: return readyClip;
|
||||
case ButtonVoicePrompt::NotificationCleared: return notificationClearedClip;
|
||||
case ButtonVoicePrompt::AdvertQueued: return advertQueuedClip;
|
||||
case ButtonVoicePrompt::AdvertFailed: return advertFailedClip;
|
||||
case ButtonVoicePrompt::SoundOn: return soundOnClip;
|
||||
case ButtonVoicePrompt::SoundOff: return soundOffClip;
|
||||
case ButtonVoicePrompt::GpsOn: return gpsOnClip;
|
||||
case ButtonVoicePrompt::GpsOff: return gpsOffClip;
|
||||
case ButtonVoicePrompt::ActionFailed: return actionFailedClip;
|
||||
case ButtonVoicePrompt::UsbSetup: return usbSetupClip;
|
||||
case ButtonVoicePrompt::ShuttingDown: return shuttingDownClip;
|
||||
case ButtonVoicePrompt::Restarting: return restartingClip;
|
||||
#ifdef HAS_DRV2605
|
||||
case ButtonVoicePrompt::AlertsSoundVibration: return alertsSoundVibrationClip;
|
||||
case ButtonVoicePrompt::AlertsSoundOnly: return alertsSoundOnlyClip;
|
||||
case ButtonVoicePrompt::AlertsVibrationOnly: return alertsVibrationOnlyClip;
|
||||
case ButtonVoicePrompt::AlertsSilent: return alertsSilentClip;
|
||||
#else
|
||||
case ButtonVoicePrompt::AlertsSoundVibration:
|
||||
case ButtonVoicePrompt::AlertsSoundOnly:
|
||||
case ButtonVoicePrompt::AlertsVibrationOnly:
|
||||
case ButtonVoicePrompt::AlertsSilent: return {};
|
||||
#endif
|
||||
}
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
void genericBuzzer::begin() {
|
||||
// Serial.print("DBG: Setting up buzzer on pin ");
|
||||
@@ -16,9 +61,14 @@ void genericBuzzer::begin() {
|
||||
}
|
||||
|
||||
void genericBuzzer::play(const char *melody) {
|
||||
#if MESH_GPS_VOICE
|
||||
// A muted ordinary alert must not cancel the one courtesy confirmation
|
||||
// that may still be queued or playing while the preference is quiet.
|
||||
if (_is_quiet) return;
|
||||
#endif
|
||||
if (isPlaying()) // interrupt existing
|
||||
{
|
||||
rtttl::stop();
|
||||
stop();
|
||||
}
|
||||
|
||||
if (_is_quiet) return;
|
||||
@@ -36,19 +86,149 @@ void genericBuzzer::playNotification(const char* melody) {
|
||||
rtttl::begin(PIN_BUZZER, melody);
|
||||
}
|
||||
|
||||
void genericBuzzer::stopNotification() {
|
||||
#if MESH_GPS_VOICE
|
||||
// Notification timers own their tones, not user-requested confirmations.
|
||||
// Preserve a pending direction tone, speech gap, or active voice clip.
|
||||
if (_voice_pending || gps_voice.active()) return;
|
||||
#endif
|
||||
stop();
|
||||
}
|
||||
|
||||
bool genericBuzzer::speakGps(bool enabled) {
|
||||
return speakButton(enabled ? ButtonVoicePrompt::GpsOn : ButtonVoicePrompt::GpsOff);
|
||||
}
|
||||
|
||||
bool genericBuzzer::speakButton(ButtonVoicePrompt prompt, bool allowQuiet) {
|
||||
const char* melody = nullptr;
|
||||
switch (prompt) {
|
||||
case ButtonVoicePrompt::GpsOn:
|
||||
melody = startup_song;
|
||||
break;
|
||||
case ButtonVoicePrompt::GpsOff:
|
||||
case ButtonVoicePrompt::ShuttingDown:
|
||||
case ButtonVoicePrompt::Restarting:
|
||||
melody = shutdown_song;
|
||||
break;
|
||||
case ButtonVoicePrompt::Ready:
|
||||
case ButtonVoicePrompt::NotificationCleared:
|
||||
case ButtonVoicePrompt::AdvertQueued:
|
||||
case ButtonVoicePrompt::AdvertFailed:
|
||||
case ButtonVoicePrompt::SoundOn:
|
||||
case ButtonVoicePrompt::SoundOff:
|
||||
case ButtonVoicePrompt::ActionFailed:
|
||||
case ButtonVoicePrompt::UsbSetup:
|
||||
case ButtonVoicePrompt::AlertsSoundVibration:
|
||||
case ButtonVoicePrompt::AlertsSoundOnly:
|
||||
case ButtonVoicePrompt::AlertsVibrationOnly:
|
||||
case ButtonVoicePrompt::AlertsSilent:
|
||||
#if MESH_GPS_VOICE && !defined(HAS_DRV2605)
|
||||
// Reject unavailable modes before cancelling any valid audio.
|
||||
if (prompt >= ButtonVoicePrompt::AlertsSoundVibration) return false;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
stop();
|
||||
if (_is_quiet && !allowQuiet) return true;
|
||||
#if !MESH_GPS_VOICE
|
||||
// The UI retains its legacy acknowledgements on untested boards. New
|
||||
// voice-only prompts must not introduce tones there (including Ready).
|
||||
if (!melody) return true;
|
||||
#endif
|
||||
#ifdef PIN_BUZZER_EN
|
||||
digitalWrite(PIN_BUZZER_EN, HIGH);
|
||||
#endif
|
||||
#if MESH_GPS_VOICE
|
||||
_voice_prompt = prompt;
|
||||
_voice_pending = true;
|
||||
_voice_allow_quiet = allowQuiet;
|
||||
_voice_gap_started = false;
|
||||
#endif
|
||||
// Preserve the recognisable rising/falling control tone even where voice
|
||||
// playback is disabled. Optional tones release their PWM before speech.
|
||||
if (melody) rtttl::begin(PIN_BUZZER, melody);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
void genericBuzzer::voiceStatus(char* reply, size_t size) {
|
||||
#if MESH_GPS_VOICE
|
||||
snprintf(reply, size, "voice playing=%u started=%lu completed=%lu cancelled=%lu samples=%lu quiet=%u gain=%u pending=%u tone=%u",
|
||||
gps_voice.playing(), (unsigned long)gps_voice.started(),
|
||||
(unsigned long)gps_voice.completed(), (unsigned long)gps_voice.cancelled(),
|
||||
(unsigned long)gps_voice.played(), _is_quiet, gps_voice.gain(),
|
||||
_voice_pending, rtttl::isPlaying());
|
||||
#else
|
||||
snprintf(reply, size, "voice unsupported");
|
||||
#endif
|
||||
}
|
||||
bool genericBuzzer::voiceGain(uint8_t gain) {
|
||||
#if MESH_GPS_VOICE
|
||||
return !_voice_pending && gps_voice.setGain(gain);
|
||||
#else
|
||||
(void)gain;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void genericBuzzer::stop() {
|
||||
rtttl::stop();
|
||||
#if MESH_GPS_VOICE
|
||||
_voice_pending = false;
|
||||
_voice_allow_quiet = false;
|
||||
_voice_gap_started = false;
|
||||
gps_voice.stop();
|
||||
#endif
|
||||
#ifdef PIN_BUZZER_EN
|
||||
if (_is_quiet) digitalWrite(PIN_BUZZER_EN, LOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool genericBuzzer::isPlaying() {
|
||||
#if MESH_GPS_VOICE
|
||||
if (_voice_pending || gps_voice.active()) return true;
|
||||
#endif
|
||||
return rtttl::isPlaying();
|
||||
}
|
||||
|
||||
void genericBuzzer::loop() {
|
||||
if (!rtttl::done()) rtttl::play();
|
||||
#if MESH_GPS_VOICE
|
||||
gps_voice.service();
|
||||
if (gps_voice.playing()) return;
|
||||
if (_voice_pending) {
|
||||
if (!rtttl::done()) {
|
||||
rtttl::play();
|
||||
return;
|
||||
}
|
||||
if (!_voice_gap_started) {
|
||||
rtttl::stop();
|
||||
_voice_gap_ms = millis();
|
||||
_voice_gap_started = true;
|
||||
}
|
||||
if (static_cast<uint32_t>(millis() - _voice_gap_ms) < 100) return;
|
||||
_voice_pending = false;
|
||||
_voice_gap_started = false;
|
||||
if (!_is_quiet || _voice_allow_quiet)
|
||||
gps_voice.start(buttonVoiceClip(_voice_prompt));
|
||||
_voice_allow_quiet = false;
|
||||
if (gps_voice.playing()) return;
|
||||
}
|
||||
#endif
|
||||
if (!rtttl::done()) {
|
||||
rtttl::play();
|
||||
return;
|
||||
}
|
||||
// Courtesy mute/unmute speech can temporarily power the driver while the
|
||||
// preference stays quiet. Return both pins to their low-power state.
|
||||
if (_is_quiet) {
|
||||
digitalWrite(PIN_BUZZER, LOW);
|
||||
#ifdef PIN_BUZZER_EN
|
||||
digitalWrite(PIN_BUZZER_EN, LOW);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void genericBuzzer::startup() {
|
||||
@@ -60,6 +240,7 @@ void genericBuzzer::shutdown() {
|
||||
}
|
||||
|
||||
void genericBuzzer::quiet(bool buzzer_state) {
|
||||
if (buzzer_state) stop();
|
||||
_is_quiet = buzzer_state;
|
||||
#ifdef PIN_BUZZER_EN
|
||||
if (_is_quiet) {
|
||||
|
||||
@@ -2,6 +2,29 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <NonBlockingRtttl.h>
|
||||
#include "ButtonVoice.h"
|
||||
|
||||
// Screenless Full Companions share spoken button confirmations. Keep an
|
||||
// explicit board list: a configured buzzer on a screened board is not an
|
||||
// opt-in, and the Wio joystick/display profiles retain their existing tones.
|
||||
// ThinkNode M4 is excluded until its buzzer wiring is verified: its current
|
||||
// PIN_BUZZER/PIN_BUZZER_EN overlap I2C SDA and a battery-status LED.
|
||||
// R1 Neo has no flash fitted; its dummy QSPI SCK aliases the buzzer, so a
|
||||
// profile which opts into QSPIFLASH must not also default to spoken audio.
|
||||
// Retain the existing prerecorded clips; intelligibility still needs physical
|
||||
// qualification on each board. MESH_GPS_VOICE=0 is an explicit opt-out.
|
||||
#ifndef MESH_GPS_VOICE
|
||||
#if defined(NRF52_PLATFORM) && defined(PIN_BUZZER) \
|
||||
&& defined(COMPANION_RADIO_FULL) && COMPANION_RADIO_FULL \
|
||||
&& (defined(T1000_E) || defined(RAK_WISMESH_TAG) \
|
||||
|| defined(MESH_TRACKER_X1) \
|
||||
|| (defined(R1Neo) && !defined(QSPIFLASH)) \
|
||||
|| defined(THINKNODE_M3))
|
||||
#define MESH_GPS_VOICE 1
|
||||
#else
|
||||
#define MESH_GPS_VOICE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* class abstracts underlying RTTTL library
|
||||
|
||||
@@ -22,6 +45,13 @@ class genericBuzzer
|
||||
void begin(); // set up buzzer port
|
||||
void play(const char *melody); // Generic play function
|
||||
void playNotification(const char* melody);
|
||||
void stopNotification(); // background alert cancellation must not cut off control speech
|
||||
bool speakGps(bool enabled); // direction tones, then optional spoken confirmation
|
||||
bool speakButton(ButtonVoicePrompt prompt, bool allowQuiet = false);
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
void voiceStatus(char* reply, size_t size);
|
||||
bool voiceGain(uint8_t gain);
|
||||
#endif
|
||||
void stop();
|
||||
void loop(); // loop driven-nonblocking
|
||||
void startup(); // play startup sound
|
||||
@@ -36,4 +66,11 @@ class genericBuzzer
|
||||
const char *shutdown_song = "Shutdown:d=4,o=5,b=100:8g5,16e5,16c5";
|
||||
|
||||
bool _is_quiet = true;
|
||||
#if MESH_GPS_VOICE
|
||||
bool _voice_pending = false;
|
||||
ButtonVoicePrompt _voice_prompt = ButtonVoicePrompt::Ready;
|
||||
bool _voice_allow_quiet = false;
|
||||
bool _voice_gap_started = false;
|
||||
uint32_t _voice_gap_ms = 0;
|
||||
#endif
|
||||
};
|
||||
@@ -0,0 +1,502 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
/* Decoder-only adaptation for MeshCore experiments, 2026.
|
||||
* Common code and G.723-24 tables: Sun source at codec-g7xx commit
|
||||
* 2ebdfe0c76670c6f887542fd4c291afbab988cdc, src/g72x.c and src/g723_24.c.
|
||||
* G.726-16 tables: Marc Randolph's 16 kbps adaptation, libsndfile commit
|
||||
* b9103bd48b6c8fb517ae737fe3baee0c718b804c, src/G72x/g723_16.c.
|
||||
* Encoder, A-law/u-law conversion and heap/block interfaces are removed.
|
||||
* Sun fmult rounding (+0x30) is preserved. Negative left shifts are replaced
|
||||
* by multiplication. State widths are fixed, rather than native long/short.
|
||||
*/
|
||||
/* MIX interpolation adapted from FFmpeg n7.1 libavcodec/g726.c.
|
||||
* Copyright (c) 2004 Roman Shaposhnik.
|
||||
* The MIX adaptation is under GNU LGPL version 2.1 or (at your option) later.
|
||||
* This combined experimental source is distributed under that LGPL license;
|
||||
* the original Sun unrestricted-use notice is retained above.
|
||||
* See COPYING.LGPLv2.1 next to this source. No production codec change is made.
|
||||
* Corrected fractional MIX matches FFmpeg sample-for-sample; this does not
|
||||
* constitute independent ITU conformance qualification.
|
||||
*/
|
||||
#include "g726_decoder.h"
|
||||
|
||||
#if defined(MESH_G726_DECODER_TEST) || \
|
||||
(defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_G726_BITRATE))
|
||||
|
||||
static const int16_t power2[15] = {
|
||||
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384
|
||||
};
|
||||
#if !defined(MESH_GPS_VOICE_G726_BITRATE) || MESH_GPS_VOICE_G726_BITRATE == 16
|
||||
static const int16_t dqln16[4] = {116, 365, 365, 116};
|
||||
static const int16_t wi16[4] = {-704, 14048, 14048, -704};
|
||||
static const int16_t fi16[4] = {0, 0xe00, 0xe00, 0};
|
||||
#endif
|
||||
#if !defined(MESH_GPS_VOICE_G726_BITRATE) || MESH_GPS_VOICE_G726_BITRATE == 24
|
||||
static const int16_t dqln24[8] = {-2048, 135, 273, 373, 373, 273, 135, -2048};
|
||||
static const int16_t wi24[8] = {-128, 960, 4384, 18624, 18624, 4384, 960, -128};
|
||||
static const int16_t fi24[8] = {0, 0x200, 0x400, 0xe00, 0xe00, 0x400, 0x200, 0};
|
||||
#endif
|
||||
|
||||
static int quan(int value)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 15; ++i)
|
||||
if (value < power2[i]) break;
|
||||
return i;
|
||||
}
|
||||
|
||||
static int fmult(int an, int srn)
|
||||
{
|
||||
int16_t anmag = (int16_t)(an > 0 ? an : ((-an) & 0x1fff));
|
||||
int16_t anexp = (int16_t)(quan(anmag) - 6);
|
||||
int16_t anmant = (int16_t)(anmag == 0 ? 32 : anexp >= 0
|
||||
? anmag >> anexp : anmag * (1 << -anexp));
|
||||
int16_t wanexp = (int16_t)(anexp + ((srn >> 6) & 15) - 13);
|
||||
int16_t wanmant = (int16_t)((anmant * (srn & 63) + 0x30) >> 4);
|
||||
int16_t retval = (int16_t)(wanexp >= 0
|
||||
? (wanmant * (1 << wanexp)) & 0x7fff
|
||||
: wanmant >> -wanexp);
|
||||
return (an ^ srn) < 0 ? -retval : retval;
|
||||
}
|
||||
|
||||
void g726_init(G726State *s)
|
||||
{
|
||||
unsigned i;
|
||||
s->yl = 34816;
|
||||
s->yu = 544;
|
||||
s->dms = s->dml = s->ap = 0;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
s->a[i] = s->pk[i] = 0;
|
||||
s->sr[i] = 32;
|
||||
}
|
||||
for (i = 0; i < 6; ++i) {
|
||||
s->b[i] = 0;
|
||||
s->dq[i] = 32;
|
||||
}
|
||||
s->td = 0;
|
||||
}
|
||||
|
||||
static int predictor_zero(const G726State *s)
|
||||
{
|
||||
int i, sezi = fmult(s->b[0] >> 2, s->dq[0]);
|
||||
for (i = 1; i < 6; ++i) sezi += fmult(s->b[i] >> 2, s->dq[i]);
|
||||
return sezi;
|
||||
}
|
||||
|
||||
static int predictor_pole(const G726State *s)
|
||||
{
|
||||
return fmult(s->a[1] >> 2, s->sr[1]) + fmult(s->a[0] >> 2, s->sr[0]);
|
||||
}
|
||||
|
||||
static int step_size(const G726State *s)
|
||||
{
|
||||
if (s->ap >= 256) return s->yu;
|
||||
/* Retain fractional yl before the final shift, rather than truncating it
|
||||
* first and applying the Sun reference's negative-difference rounding. */
|
||||
return (s->yl + (s->yu - (s->yl >> 6)) * (s->ap >> 2)) >> 6;
|
||||
}
|
||||
|
||||
static int reconstruct(int sign, int dqln, int y)
|
||||
{
|
||||
int16_t dql = (int16_t)(dqln + (y >> 2));
|
||||
int16_t dex, dqt, dq;
|
||||
if (dql < 0) return sign ? -32768 : 0;
|
||||
dex = (dql >> 7) & 15;
|
||||
dqt = 128 + (dql & 127);
|
||||
dq = (int16_t)((dqt * 128) >> (14 - dex));
|
||||
return sign ? dq - 32768 : dq;
|
||||
}
|
||||
|
||||
static int magnitude(int value) { return value < 0 ? -value : value; }
|
||||
|
||||
static void update(int y, int wi, int fi, int dq, int sr, int dqsez, G726State *s)
|
||||
{
|
||||
int cnt;
|
||||
int16_t mag, exp, a2p = 0, a1ul, pks1, fa1;
|
||||
int16_t ylint, ylfrac, thr1, thr2, dqthr, pk0;
|
||||
int8_t tr;
|
||||
pk0 = dqsez < 0 ? 1 : 0;
|
||||
mag = dq & 0x7fff;
|
||||
ylint = (int16_t)(s->yl >> 15);
|
||||
ylfrac = (s->yl >> 10) & 31;
|
||||
thr1 = (int16_t)((32 + ylfrac) * (1 << ylint));
|
||||
thr2 = ylint > 9 ? 31 * 1024 : thr1;
|
||||
dqthr = (thr2 + (thr2 >> 1)) >> 1;
|
||||
tr = s->td != 0 && mag > dqthr;
|
||||
|
||||
s->yu = (int16_t)(y + ((wi - y) >> 5));
|
||||
if (s->yu < 544) s->yu = 544;
|
||||
else if (s->yu > 5120) s->yu = 5120;
|
||||
s->yl += s->yu + ((-s->yl) >> 6);
|
||||
|
||||
if (tr) {
|
||||
s->a[0] = s->a[1] = 0;
|
||||
for (cnt = 0; cnt < 6; ++cnt) s->b[cnt] = 0;
|
||||
} else {
|
||||
pks1 = pk0 ^ s->pk[0];
|
||||
a2p = (int16_t)(s->a[1] - (s->a[1] >> 7));
|
||||
if (dqsez != 0) {
|
||||
fa1 = pks1 ? s->a[0] : (int16_t)-s->a[0];
|
||||
if (fa1 < -8191) a2p -= 256;
|
||||
else if (fa1 > 8191) a2p += 255;
|
||||
else a2p += fa1 >> 5;
|
||||
if (pk0 ^ s->pk[1]) {
|
||||
if (a2p <= -12160) a2p = -12288;
|
||||
else if (a2p >= 12416) a2p = 12288;
|
||||
else a2p -= 128;
|
||||
} else {
|
||||
if (a2p <= -12416) a2p = -12288;
|
||||
else if (a2p >= 12160) a2p = 12288;
|
||||
else a2p += 128;
|
||||
}
|
||||
}
|
||||
s->a[1] = a2p;
|
||||
s->a[0] -= s->a[0] >> 8;
|
||||
if (dqsez != 0) s->a[0] += pks1 == 0 ? 192 : -192;
|
||||
a1ul = 15360 - a2p;
|
||||
if (s->a[0] < -a1ul) s->a[0] = (int16_t)-a1ul;
|
||||
else if (s->a[0] > a1ul) s->a[0] = a1ul;
|
||||
for (cnt = 0; cnt < 6; ++cnt) {
|
||||
s->b[cnt] -= s->b[cnt] >> 8;
|
||||
if (dq & 0x7fff) s->b[cnt] += (dq ^ s->dq[cnt]) >= 0 ? 128 : -128;
|
||||
}
|
||||
}
|
||||
for (cnt = 5; cnt > 0; --cnt) s->dq[cnt] = s->dq[cnt - 1];
|
||||
if (mag == 0) s->dq[0] = dq >= 0 ? 32 : -992;
|
||||
else {
|
||||
exp = (int16_t)quan(mag);
|
||||
s->dq[0] = (int16_t)(exp * 64 + ((mag * 64) >> exp) - (dq >= 0 ? 0 : 1024));
|
||||
}
|
||||
s->sr[1] = s->sr[0];
|
||||
if (sr == 0) s->sr[0] = 32;
|
||||
else if (sr > 0) {
|
||||
exp = (int16_t)quan(sr);
|
||||
s->sr[0] = (int16_t)(exp * 64 + ((sr * 64) >> exp));
|
||||
} else if (sr > -32768) {
|
||||
mag = (int16_t)-sr;
|
||||
exp = (int16_t)quan(mag);
|
||||
s->sr[0] = (int16_t)(exp * 64 + ((mag * 64) >> exp) - 1024);
|
||||
} else s->sr[0] = -992;
|
||||
s->pk[1] = s->pk[0];
|
||||
s->pk[0] = pk0;
|
||||
s->td = !tr && a2p < -11776;
|
||||
s->dms += (fi - s->dms) >> 5;
|
||||
s->dml += (fi * 4 - s->dml) >> 7;
|
||||
if (tr) s->ap = 256;
|
||||
else if (y < 1536 || s->td == 1 || magnitude(s->dms * 4 - s->dml) >= (s->dml >> 3))
|
||||
s->ap += (512 - s->ap) >> 4;
|
||||
else s->ap += (-s->ap) >> 4;
|
||||
}
|
||||
|
||||
int16_t g726_decode(G726State *s, uint8_t code, uint8_t bits)
|
||||
{
|
||||
int16_t sezi, sei, sez, se, y, sr, dq, dqsez;
|
||||
const int16_t *dqln, *wi, *fi;
|
||||
int sign;
|
||||
if (bits == 2) {
|
||||
#if !defined(MESH_GPS_VOICE_G726_BITRATE) || MESH_GPS_VOICE_G726_BITRATE == 16
|
||||
code &= 3;
|
||||
sign = code & 2;
|
||||
dqln = dqln16; wi = wi16; fi = fi16;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
} else if (bits == 3) {
|
||||
#if !defined(MESH_GPS_VOICE_G726_BITRATE) || MESH_GPS_VOICE_G726_BITRATE == 24
|
||||
code &= 7;
|
||||
sign = code & 4;
|
||||
dqln = dqln24; wi = wi24; fi = fi24;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
} else return 0;
|
||||
sezi = (int16_t)predictor_zero(s);
|
||||
sez = sezi >> 1;
|
||||
sei = (int16_t)(sezi + predictor_pole(s));
|
||||
se = sei >> 1;
|
||||
y = (int16_t)step_size(s);
|
||||
dq = (int16_t)reconstruct(sign, dqln[code], y);
|
||||
sr = (int16_t)(dq < 0 ? se - (dq & 0x3fff) : se + dq);
|
||||
dqsez = (int16_t)(sr - se + sez);
|
||||
update(y, wi[code], fi[code], dq, sr, dqsez, s);
|
||||
return (int16_t)(sr * 4);
|
||||
}
|
||||
|
||||
|
||||
#endif /* experimental decoder only */
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef MESH_G726_EXPERIMENTAL_DECODER_H
|
||||
#define MESH_G726_EXPERIMENTAL_DECODER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Experimental Sun G.72x decoder with LGPL FFmpeg MIX interpolation.
|
||||
* See g726_decoder.c and COPYING.LGPLv2.1 for attribution and license.
|
||||
* All fields have explicit MCU-width types; state and code require no heap. */
|
||||
typedef struct {
|
||||
int32_t yl;
|
||||
int16_t yu, dms, dml, ap;
|
||||
int16_t a[2], b[6], pk[2], dq[6], sr[2];
|
||||
int8_t td;
|
||||
} G726State;
|
||||
|
||||
void g726_init(G726State *state);
|
||||
/* bits=2 for G.726-16; bits=3 for G.726-24. No packing or allocation here. */
|
||||
int16_t g726_decode(G726State *state, uint8_t code, uint8_t bits);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,174 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <HardwarePWM.h>
|
||||
#include <helpers/ui/GpsVoice.h>
|
||||
|
||||
namespace mesh { namespace audio {
|
||||
|
||||
class GpsVoicePlayer {
|
||||
static constexpr uint32_t OWNER = 0x63696f56; // Voic
|
||||
static constexpr size_t BLOCK = 128;
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && ((defined(MESH_GPS_VOICE_BINARY_DRIVE) && MESH_GPS_VOICE_BINARY_DRIVE) || (defined(MESH_GPS_VOICE_PDM_DRIVE) && MESH_GPS_VOICE_PDM_DRIVE) || (defined(MESH_GPS_VOICE_PCM32_DRIVE) && !MESH_GPS_VOICE_PCM32_DRIVE))
|
||||
static constexpr uint16_t TOP = 250; // 64 kHz carrier
|
||||
#else
|
||||
static constexpr uint16_t TOP = 500; // tested 32 kHz carrier and output
|
||||
#endif
|
||||
VoiceDecoder decoder_;
|
||||
VoiceInterpolator interpolator_;
|
||||
alignas(4) uint16_t buffers_[2][BLOCK] = {};
|
||||
uint16_t lengths_[2] = {};
|
||||
bool last_[2] = {};
|
||||
bool owned_ = false;
|
||||
volatile bool playing_ = false;
|
||||
volatile uint32_t played_ = 0;
|
||||
volatile uint32_t completed_ = 0;
|
||||
uint32_t started_ = 0;
|
||||
uint32_t cancelled_ = 0;
|
||||
uint8_t gain_ = 8; // acoustically selected drive for the T1000-E buzzer
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_BINARY_DRIVE) && MESH_GPS_VOICE_BINARY_DRIVE
|
||||
// Acoustic experiment: full GPIO-level drive with a small hysteresis band.
|
||||
// Unlike carrier PWM, silence holds a constant level instead of chattering.
|
||||
bool binary_level_ = false;
|
||||
#endif
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_PDM_DRIVE) && MESH_GPS_VOICE_PDM_DRIVE
|
||||
int32_t density_error_ = 0;
|
||||
int32_t held_pcm_ = 0;
|
||||
bool density_repeat_ = false;
|
||||
#endif
|
||||
|
||||
void fill(unsigned n) {
|
||||
const uint32_t before = decoder_.position();
|
||||
for (size_t i = 0; i < BLOCK; ++i) {
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_PDM_DRIVE) && MESH_GPS_VOICE_PDM_DRIVE
|
||||
// Twice the reconstruction rate: full-width pulses instead of narrow
|
||||
// duty-cycle pulses. Error feedback moves quantization noise upwards.
|
||||
if (!density_repeat_) held_pcm_ = interpolator_.next(decoder_) * gain_;
|
||||
density_repeat_ = !density_repeat_;
|
||||
int32_t pcm = held_pcm_;
|
||||
#else
|
||||
int32_t pcm = interpolator_.next(decoder_) * gain_;
|
||||
#endif
|
||||
if (pcm > 32767) pcm = 32767;
|
||||
if (pcm < -32768) pcm = -32768;
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_PDM_DRIVE) && MESH_GPS_VOICE_PDM_DRIVE
|
||||
density_error_ += pcm;
|
||||
const bool high = density_error_ >= 0;
|
||||
density_error_ -= high ? 32767 : -32768;
|
||||
buffers_[n][i] = 0x8000 | (high ? TOP : 0);
|
||||
#elif defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_BINARY_DRIVE) && MESH_GPS_VOICE_BINARY_DRIVE
|
||||
if (pcm > 1024) binary_level_ = true;
|
||||
else if (pcm < -1024) binary_level_ = false;
|
||||
buffers_[n][i] = 0x8000 | (binary_level_ ? TOP : 0);
|
||||
#else
|
||||
buffers_[n][i] = 0x8000 | ((pcm + 32768) * TOP / 65536);
|
||||
#endif
|
||||
}
|
||||
lengths_[n] = decoder_.position() - before;
|
||||
last_[n] = decoder_.done();
|
||||
}
|
||||
void finishFromInterrupt() {
|
||||
NRF_PWM3->INTENCLR = 0xffffffff;
|
||||
NRF_PWM3->SHORTS = 0;
|
||||
NRF_PWM3->ENABLE = 0;
|
||||
digitalWrite(PIN_BUZZER, LOW);
|
||||
playing_ = false;
|
||||
++completed_;
|
||||
}
|
||||
public:
|
||||
bool start(VoiceClip clip) {
|
||||
stop();
|
||||
#if defined(MESH_GPS_VOICE_G726_BITRATE)
|
||||
if (!clip.valid() || !HwPWM3.takeOwnership(OWNER)) return false;
|
||||
#else
|
||||
if (!clip.data || !clip.samples || clip.samples > clip.bytes * 2
|
||||
|| (clip.sample_rate != 8000 && clip.sample_rate != 16000)
|
||||
|| !HwPWM3.takeOwnership(OWNER)) return false;
|
||||
#endif
|
||||
owned_ = true;
|
||||
if (!HwPWM3.addPin(PIN_BUZZER)) { stop(); return false; }
|
||||
decoder_.begin(clip);
|
||||
interpolator_.begin(clip.sample_rate);
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_BINARY_DRIVE) && MESH_GPS_VOICE_BINARY_DRIVE
|
||||
binary_level_ = false;
|
||||
#endif
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && defined(MESH_GPS_VOICE_PDM_DRIVE) && MESH_GPS_VOICE_PDM_DRIVE
|
||||
density_error_ = held_pcm_ = 0;
|
||||
density_repeat_ = false;
|
||||
#endif
|
||||
fill(0);
|
||||
fill(1);
|
||||
played_ = 0;
|
||||
NRF_PWM3->ENABLE = 0;
|
||||
NRF_PWM3->MODE = PWM_MODE_UPDOWN_Up;
|
||||
NRF_PWM3->COUNTERTOP = TOP;
|
||||
NRF_PWM3->PRESCALER = PWM_PRESCALER_PRESCALER_DIV_1;
|
||||
NRF_PWM3->DECODER = PWM_DECODER_LOAD_Common;
|
||||
NRF_PWM3->LOOP = 1;
|
||||
NRF_PWM3->SHORTS = PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk;
|
||||
for (unsigned i = 0; i < 2; ++i) {
|
||||
NRF_PWM3->SEQ[i].PTR = reinterpret_cast<uintptr_t>(buffers_[i]);
|
||||
NRF_PWM3->SEQ[i].CNT = BLOCK;
|
||||
#if defined(MESH_BUTTON_AUDIO_HIL) && !(defined(MESH_GPS_VOICE_PDM_DRIVE) && MESH_GPS_VOICE_PDM_DRIVE) && ((defined(MESH_GPS_VOICE_BINARY_DRIVE) && MESH_GPS_VOICE_BINARY_DRIVE) || (defined(MESH_GPS_VOICE_PCM32_DRIVE) && !MESH_GPS_VOICE_PCM32_DRIVE))
|
||||
NRF_PWM3->SEQ[i].REFRESH = 1;
|
||||
#else
|
||||
NRF_PWM3->SEQ[i].REFRESH = 0;
|
||||
#endif
|
||||
NRF_PWM3->SEQ[i].ENDDELAY = 0;
|
||||
NRF_PWM3->EVENTS_SEQEND[i] = 0;
|
||||
NRF_PWM3->EVENTS_SEQSTARTED[i] = 0;
|
||||
}
|
||||
NRF_PWM3->EVENTS_STOPPED = 0;
|
||||
NRF_PWM3->EVENTS_LOOPSDONE = 0;
|
||||
NVIC_ClearPendingIRQ(PWM3_IRQn);
|
||||
NVIC_SetPriority(PWM3_IRQn, 7); // below SoftDevice/radio interrupts
|
||||
NRF_PWM3->INTENSET = PWM_INTENSET_SEQEND0_Msk | PWM_INTENSET_SEQEND1_Msk;
|
||||
playing_ = true;
|
||||
++started_;
|
||||
NRF_PWM3->ENABLE = 1;
|
||||
NVIC_EnableIRQ(PWM3_IRQn);
|
||||
NRF_PWM3->TASKS_SEQSTART[0] = 1;
|
||||
return true;
|
||||
}
|
||||
void interrupt() {
|
||||
for (unsigned i = 0; i < 2; ++i) {
|
||||
if (!NRF_PWM3->EVENTS_SEQEND[i]) continue;
|
||||
NRF_PWM3->EVENTS_SEQEND[i] = 0;
|
||||
if (!playing_) continue;
|
||||
played_ += lengths_[i];
|
||||
if (last_[i]) { finishFromInterrupt(); break; }
|
||||
fill(i); // refill the inactive buffer; no allocation or blocking in IRQ
|
||||
}
|
||||
}
|
||||
void service() { if (owned_ && !playing_) stop(); }
|
||||
void stop() {
|
||||
if (!owned_) return;
|
||||
NVIC_DisableIRQ(PWM3_IRQn);
|
||||
NRF_PWM3->INTENCLR = 0xffffffff;
|
||||
NRF_PWM3->SHORTS = 0;
|
||||
NRF_PWM3->ENABLE = 0;
|
||||
NVIC_ClearPendingIRQ(PWM3_IRQn);
|
||||
if (playing_) ++cancelled_;
|
||||
playing_ = false;
|
||||
HwPWM3.removePin(PIN_BUZZER);
|
||||
HwPWM3.releaseOwnership(OWNER);
|
||||
digitalWrite(PIN_BUZZER, LOW);
|
||||
owned_ = false;
|
||||
}
|
||||
bool playing() const { return playing_; }
|
||||
bool active() const { return owned_; } // includes deferred IRQ-completion cleanup
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
bool setGain(uint8_t gain) {
|
||||
if (active() || gain < 1 || gain > 8) return false;
|
||||
gain_ = gain;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
uint8_t gain() const { return gain_; }
|
||||
uint32_t played() const { return played_; }
|
||||
uint32_t started() const { return started_; }
|
||||
uint32_t completed() const { return completed_; }
|
||||
uint32_t cancelled() const { return cancelled_; }
|
||||
};
|
||||
|
||||
}} // namespace mesh::audio
|
||||
@@ -0,0 +1,854 @@
|
||||
"""Run production spoken-button mappings, courtesy audio, and UI transactions natively."""
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
import test_gps_voice_buttons as gps_tests
|
||||
from test_radio_receive_contract import method
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
PROMPTS = r'''
|
||||
#include <cassert>
|
||||
#include <initializer_list>
|
||||
#define PIN_BUZZER 25
|
||||
#define PIN_BUZZER_EN 37
|
||||
#define MESH_BUTTON_AUDIO_HIL 1
|
||||
#define HAS_DRV2605 1
|
||||
#define MESH_GPS_VOICE 1
|
||||
#include <helpers/ui/buzzer.cpp>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
using namespace mesh::audio;
|
||||
struct Mapping {ButtonVoicePrompt prompt;VoiceClip clip;const char* tone;};
|
||||
const Mapping mappings[]={
|
||||
{ButtonVoicePrompt::Ready,readyClip,nullptr},
|
||||
{ButtonVoicePrompt::NotificationCleared,notificationClearedClip,nullptr},
|
||||
{ButtonVoicePrompt::AdvertQueued,advertQueuedClip,nullptr},
|
||||
{ButtonVoicePrompt::AdvertFailed,advertFailedClip,nullptr},
|
||||
{ButtonVoicePrompt::SoundOn,soundOnClip,nullptr},
|
||||
{ButtonVoicePrompt::SoundOff,soundOffClip,nullptr},
|
||||
{ButtonVoicePrompt::GpsOn,gpsOnClip,"Startup:d=4,o=5,b=160:16c6,16e6,8g6"},
|
||||
{ButtonVoicePrompt::GpsOff,gpsOffClip,"Shutdown:d=4,o=5,b=100:8g5,16e5,16c5"},
|
||||
{ButtonVoicePrompt::ActionFailed,actionFailedClip,nullptr},
|
||||
{ButtonVoicePrompt::UsbSetup,usbSetupClip,nullptr},
|
||||
{ButtonVoicePrompt::ShuttingDown,shuttingDownClip,"Shutdown:d=4,o=5,b=100:8g5,16e5,16c5"},
|
||||
{ButtonVoicePrompt::Restarting,restartingClip,"Shutdown:d=4,o=5,b=100:8g5,16e5,16c5"},
|
||||
#ifdef HAS_DRV2605
|
||||
{ButtonVoicePrompt::AlertsSoundVibration,alertsSoundVibrationClip,nullptr},
|
||||
{ButtonVoicePrompt::AlertsSoundOnly,alertsSoundOnlyClip,nullptr},
|
||||
{ButtonVoicePrompt::AlertsVibrationOnly,alertsVibrationOnlyClip,nullptr},
|
||||
{ButtonVoicePrompt::AlertsSilent,alertsSilentClip,nullptr},
|
||||
#endif
|
||||
};
|
||||
genericBuzzer buzzer;buzzer.begin();
|
||||
auto finish=[&]{
|
||||
assert(!registers.ENABLE);
|
||||
rtttl::finish();buzzer.loop();
|
||||
now_ms+=99;buzzer.loop();assert(!registers.ENABLE);
|
||||
++now_ms;buzzer.loop();
|
||||
assert(HwPWM3.owned&&HwPWM3.pin&&HwPWM3.bound_pin==PIN_BUZZER);
|
||||
unsigned sequence=0,events=0;
|
||||
while(registers.ENABLE){
|
||||
assert(++events<2000);
|
||||
registers.EVENTS_SEQEND[sequence]=1;PWM3_IRQHandler();sequence^=1;
|
||||
}
|
||||
buzzer.loop();assert(!buzzer.isPlaying());
|
||||
assert(!HwPWM3.owned&&!HwPWM3.pin&&!irq_enabled);
|
||||
assert(pin_states[PIN_BUZZER]==LOW);
|
||||
};
|
||||
for(const auto& entry:mappings){
|
||||
auto actual=buttonVoiceClip(entry.prompt);
|
||||
assert(actual.data==entry.clip.data&&actual.bytes==entry.clip.bytes);
|
||||
assert(actual.samples==entry.clip.samples&&actual.sample_rate==entry.clip.sample_rate);
|
||||
assert(actual.data&&actual.bytes==(actual.samples+1)/2);
|
||||
assert(actual.sample_rate==8000||actual.sample_rate==16000);
|
||||
VoiceDecoder decoder;decoder.begin(actual);
|
||||
unsigned count=0,nonzero=0;
|
||||
while(!decoder.done()){nonzero+=decoder.next()!=0;++count;}
|
||||
assert(count==actual.samples&&nonzero>count/2);
|
||||
auto started=gps_voice.started(),completed=gps_voice.completed(),tones=rtttl::begins;
|
||||
assert(buzzer.speakButton(entry.prompt)&&buzzer.isPlaying());
|
||||
if(entry.tone){assert(rtttl::melody==entry.tone&&rtttl::begins==tones+1);}
|
||||
else {assert(rtttl::begins==tones&&!rtttl::isPlaying());}
|
||||
finish();
|
||||
assert(gps_voice.started()==started+1&&gps_voice.completed()==completed+1);
|
||||
}
|
||||
// Invalid values must reject without preempting a valid tone or active voice.
|
||||
const auto invalid=static_cast<ButtonVoicePrompt>(255);
|
||||
assert(!buttonVoiceClip(invalid).data);
|
||||
assert(buzzer.speakGps(true));
|
||||
auto tones=rtttl::begins,started=gps_voice.started();
|
||||
assert(!buzzer.speakButton(invalid));
|
||||
assert(buzzer.isPlaying()&&rtttl::isPlaying()&&rtttl::begins==tones);
|
||||
#ifndef HAS_DRV2605
|
||||
for(auto prompt:{ButtonVoicePrompt::AlertsSoundVibration,ButtonVoicePrompt::AlertsSoundOnly,
|
||||
ButtonVoicePrompt::AlertsVibrationOnly,ButtonVoicePrompt::AlertsSilent}){
|
||||
assert(!buttonVoiceClip(prompt).data&&!buzzer.speakButton(prompt,true));
|
||||
assert(buzzer.isPlaying()&&rtttl::isPlaying()&&rtttl::begins==tones);
|
||||
}
|
||||
#endif
|
||||
finish();
|
||||
assert(gps_voice.started()==started+1);
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::Ready));
|
||||
buzzer.loop();now_ms+=100;buzzer.loop();
|
||||
assert(registers.ENABLE&&buzzer.isPlaying());
|
||||
started=gps_voice.started();
|
||||
assert(!buzzer.speakButton(invalid,true));
|
||||
assert(registers.ENABLE&&gps_voice.started()==started);
|
||||
#ifndef HAS_DRV2605
|
||||
for(auto prompt:{ButtonVoicePrompt::AlertsSoundVibration,ButtonVoicePrompt::AlertsSoundOnly,
|
||||
ButtonVoicePrompt::AlertsVibrationOnly,ButtonVoicePrompt::AlertsSilent}){
|
||||
assert(!buzzer.speakButton(prompt,true));
|
||||
assert(registers.ENABLE&&gps_voice.started()==started);
|
||||
}
|
||||
#endif
|
||||
unsigned sequence=0,events=0;
|
||||
while(registers.ENABLE){
|
||||
assert(++events<2000);registers.EVENTS_SEQEND[sequence]=1;
|
||||
PWM3_IRQHandler();sequence^=1;
|
||||
}
|
||||
buzzer.loop();assert(!buzzer.isPlaying());
|
||||
// A busy PWM fails the deferred voice start, without leaking ownership.
|
||||
HwPWM3.reject=true;
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::Ready));
|
||||
buzzer.loop();now_ms+=100;buzzer.loop();
|
||||
assert(!buzzer.isPlaying()&&!registers.ENABLE&&!HwPWM3.owned&&!irq_enabled);
|
||||
}
|
||||
'''
|
||||
|
||||
COURTESY = r'''
|
||||
#include <cassert>
|
||||
#define PIN_BUZZER 25
|
||||
#define PIN_BUZZER_EN 37
|
||||
#define MESH_BUTTON_AUDIO_HIL 1
|
||||
#define MESH_GPS_VOICE 1
|
||||
#include <helpers/ui/buzzer.cpp>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
genericBuzzer buzzer;buzzer.begin();buzzer.quiet(true);
|
||||
assert(buzzer.isQuiet()&&pin_states[PIN_BUZZER_EN]==LOW);
|
||||
auto before=gps_voice.started();
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::Ready));
|
||||
assert(!buzzer.isPlaying()&&gps_voice.started()==before);
|
||||
assert(pin_states[PIN_BUZZER_EN]==LOW);
|
||||
// The explicit sound-off confirmation is one-shot: it never unmutes alerts.
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::SoundOff,true));
|
||||
assert(buzzer.isQuiet()&&buzzer.isPlaying()&&pin_states[PIN_BUZZER_EN]==HIGH);
|
||||
buzzer.loop();now_ms+=100;buzzer.loop();
|
||||
assert(registers.ENABLE&&gps_voice.started()==before+1);
|
||||
unsigned sequence=0,events=0;
|
||||
while(registers.ENABLE){
|
||||
assert(++events<2000);registers.EVENTS_SEQEND[sequence]=1;
|
||||
PWM3_IRQHandler();sequence^=1;
|
||||
}
|
||||
assert(buzzer.isPlaying()); // IRQ cleanup is deferred to the foreground.
|
||||
buzzer.loop();
|
||||
assert(buzzer.isQuiet()&&!buzzer.isPlaying()&&pin_states[PIN_BUZZER_EN]==LOW);
|
||||
assert(pin_states[PIN_BUZZER]==LOW&&!HwPWM3.owned&&!HwPWM3.pin&&!irq_enabled);
|
||||
auto tones=rtttl::begins;
|
||||
buzzer.play("normal:d=4,o=5,b=120:c");
|
||||
assert(!buzzer.isPlaying()&&rtttl::begins==tones&&pin_states[PIN_BUZZER_EN]==LOW);
|
||||
// Every cancellation path releases the courtesy output without changing mute.
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::SoundOff,true));
|
||||
buzzer.stop();assert(buzzer.isQuiet()&&!buzzer.isPlaying());
|
||||
assert(pin_states[PIN_BUZZER_EN]==LOW&&pin_states[PIN_BUZZER]==LOW);
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::SoundOff,true));
|
||||
buzzer.quiet(true);assert(!buzzer.isPlaying()&&pin_states[PIN_BUZZER_EN]==LOW);
|
||||
// Muted ordinary notifications must preserve queued and active courtesy voice.
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::SoundOff,true));
|
||||
before=gps_voice.started();auto cancelled=gps_voice.cancelled();tones=rtttl::begins;
|
||||
buzzer.play("normal:d=4,o=5,b=120:c");
|
||||
assert(buzzer.isQuiet()&&buzzer.isPlaying()&&pin_states[PIN_BUZZER_EN]==HIGH);
|
||||
assert(!registers.ENABLE&&gps_voice.started()==before&&rtttl::begins==tones);
|
||||
buzzer.loop();now_ms+=100;buzzer.loop();
|
||||
assert(registers.ENABLE&&gps_voice.started()==before+1);
|
||||
buzzer.play("normal:d=4,o=5,b=120:c");
|
||||
assert(buzzer.isQuiet()&&buzzer.isPlaying()&®isters.ENABLE);
|
||||
assert(gps_voice.cancelled()==cancelled&&rtttl::begins==tones&&pin_states[PIN_BUZZER_EN]==HIGH);
|
||||
// Ordinary sound still preempts voice as soon as the user actually unmutes.
|
||||
buzzer.quiet(false);buzzer.play("normal:d=4,o=5,b=120:c");
|
||||
assert(!registers.ENABLE&&gps_voice.cancelled()==cancelled+1);
|
||||
assert(rtttl::isPlaying()&&rtttl::begins==tones+1&&!HwPWM3.owned&&!irq_enabled);
|
||||
rtttl::finish();buzzer.loop();assert(!buzzer.isPlaying());buzzer.quiet(true);
|
||||
// Starting a courtesy direction tone also respects cancellation in its gap.
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::GpsOff,true));
|
||||
assert(buzzer.isQuiet()&&rtttl::isPlaying()&&pin_states[PIN_BUZZER_EN]==HIGH);
|
||||
rtttl::finish();buzzer.loop();buzzer.stop();
|
||||
now_ms+=1000;buzzer.loop();
|
||||
assert(!buzzer.isPlaying()&&pin_states[PIN_BUZZER_EN]==LOW&&!registers.ENABLE);
|
||||
// An unavailable player must restore the sleeping amplifier immediately.
|
||||
HwPWM3.reject=true;
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::SoundOff,true));
|
||||
buzzer.loop();now_ms+=100;buzzer.loop();
|
||||
assert(buzzer.isQuiet()&&!buzzer.isPlaying()&&pin_states[PIN_BUZZER_EN]==LOW);
|
||||
}
|
||||
'''
|
||||
|
||||
LEGACY_ORDINARY_PLAY = r'''
|
||||
#include <cassert>
|
||||
#define PIN_BUZZER 25
|
||||
#define PIN_BUZZER_EN 37
|
||||
#define MESH_GPS_VOICE 0
|
||||
#include <helpers/ui/buzzer.cpp>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
genericBuzzer buzzer;buzzer.begin();buzzer.quiet(true);
|
||||
assert(buzzer.speakButton(ButtonVoicePrompt::GpsOff,true)&&rtttl::isPlaying());
|
||||
auto tones=rtttl::begins;
|
||||
// Non-voice builds retain the original cancel-before-quiet behavior.
|
||||
buzzer.play("normal:d=4,o=5,b=120:c");
|
||||
assert(buzzer.isQuiet()&&!buzzer.isPlaying()&&rtttl::begins==tones);
|
||||
assert(pin_states[PIN_BUZZER_EN]==LOW);
|
||||
buzzer.quiet(false);assert(buzzer.speakGps(true));tones=rtttl::begins;
|
||||
buzzer.play("normal:d=4,o=5,b=120:c");
|
||||
assert(!buzzer.isQuiet()&&buzzer.isPlaying()&&rtttl::begins==tones+1);
|
||||
assert(rtttl::melody=="normal:d=4,o=5,b=120:c");
|
||||
}
|
||||
'''
|
||||
|
||||
UI_ACTIONS = r'''
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <helpers/ui/ButtonVoice.h>
|
||||
#include "examples/companion_radio/ui-orig/Button.h"
|
||||
#define PIN_BUZZER 25
|
||||
#define MESH_GPS_VOICE 1
|
||||
#define ENV_INCLUDE_GPS 1
|
||||
#define MESH_DEBUG_PRINTLN(...) ((void)0)
|
||||
uint32_t now_ms=0;
|
||||
static std::vector<std::string> events;
|
||||
enum class UIEventType{contactMessage,channelMessage,ack,roomMessage,newContactMessage,none};
|
||||
namespace mesh {
|
||||
namespace notify {enum {Sound=1};}
|
||||
namespace ui {
|
||||
enum class DisplayWake {Button};
|
||||
inline uint8_t radioProfileDisplayPageCount(bool,uint8_t){return 4;}
|
||||
}
|
||||
}
|
||||
struct Display {
|
||||
bool on=true;unsigned wakes=0;
|
||||
bool isOn(){return on;}
|
||||
void wake(mesh::ui::DisplayWake){++wakes;on=true;}
|
||||
};
|
||||
static uint8_t radioProfileStatusPageCount(Display&,bool){return 2;}
|
||||
struct CompanionNodePrefs {uint8_t gps_enabled=0,buzzer_quiet=0;};
|
||||
struct SensorManager {
|
||||
bool enabled=false,available=true,reject=false;
|
||||
bool setSettingValue(const char*,const char* value){
|
||||
events.push_back("gps");
|
||||
if(!available||reject)return false;
|
||||
enabled=value[0]=='1';return true;
|
||||
}
|
||||
const char* getSettingByKey(const char*){return available?(enabled?"1":"0"):nullptr;}
|
||||
};
|
||||
static SensorManager sensors;
|
||||
struct MyMesh {
|
||||
CompanionNodePrefs _prefs;
|
||||
bool save_ok=true,advert_ok=true,notification_active=false,output_muted=false,dual_radio=false;
|
||||
unsigned saves=0,adverts=0,notification_buttons=0,mute_calls=0,cli_entries=0;
|
||||
std::vector<bool> saved_quiet;
|
||||
bool savePrefs(){++saves;events.push_back("save");saved_quiet.push_back(_prefs.buzzer_quiet);return save_ok;}
|
||||
template<class T> bool savePreference(T& p,T v){T old=p;p=v;if(savePrefs())return true;p=old;return false;}
|
||||
void applyGpsPrefs(){sensors.setSettingValue("gps",_prefs.gps_enabled?"1":"0");}
|
||||
bool setGpsEnabled(bool);
|
||||
bool advert(){++adverts;events.push_back("advert");return advert_ok;}
|
||||
bool notificationButton(){++notification_buttons;bool cleared=notification_active;notification_active=false;return cleared;}
|
||||
void setNotificationOutputMute(int,bool muted){++mute_calls;output_muted=muted;events.push_back("mute");}
|
||||
bool isDualRadioActive(){return dual_radio;}
|
||||
void enterCLIRescue(){++cli_entries;events.push_back("cli");}
|
||||
};
|
||||
static MyMesh the_mesh;
|
||||
struct Buzzer {
|
||||
bool muted=false,playing=false,accept=true;
|
||||
unsigned plays=0,notification_plays=0,stops=0,notification_stops=0,shutdowns=0;
|
||||
std::vector<ButtonVoicePrompt> prompts;
|
||||
std::vector<bool> courtesy;
|
||||
bool speakButton(ButtonVoicePrompt prompt,bool allowQuiet=false){
|
||||
events.push_back("speak");prompts.push_back(prompt);courtesy.push_back(allowQuiet);
|
||||
playing=accept&&(!muted||allowQuiet);return accept;
|
||||
}
|
||||
bool speakGps(bool value){return speakButton(value?ButtonVoicePrompt::GpsOn:ButtonVoicePrompt::GpsOff);}
|
||||
void quiet(bool q){muted=q;events.push_back("quiet");}
|
||||
bool isQuiet(){return muted;}
|
||||
bool isPlaying(){return playing;}
|
||||
void stop(){++stops;playing=false;events.push_back("stop");}
|
||||
void stopNotification(){++notification_stops;playing=false;events.push_back("notification_stop");}
|
||||
void shutdown(){++shutdowns;playing=!muted;}
|
||||
void play(const char*){++plays;}
|
||||
void playNotification(const char*){++notification_plays;}
|
||||
void loop(){}
|
||||
};
|
||||
struct Board {
|
||||
unsigned offs=0,reboots=0;
|
||||
void powerOff(){++offs;events.push_back("off");}
|
||||
void reboot(){++reboots;events.push_back("reboot");}
|
||||
};
|
||||
struct UITask {
|
||||
Display* _display=nullptr;SensorManager* _sensors=&sensors;
|
||||
CompanionNodePrefs* _node_prefs=&the_mesh._prefs;
|
||||
Buzzer buzzer;Board board;Board* _board=&board;
|
||||
char _alert[80]={},_origin[80]={},_msg[80]={};
|
||||
bool _need_refresh=false,_displayWasOn=false,_button_notification_cleared=false;
|
||||
bool _shutdown_pending=false,_shutdown_restart=false;
|
||||
uint32_t _shutdown_started_at=0,ui_started_at=0;
|
||||
uint8_t _radio_profile_display_page=0,_notification_outputs=mesh::notify::Sound;
|
||||
bool guard_ok=true,guard_reject_drain=false;unsigned guards=0,preview_clears=0;
|
||||
bool prepareForShutdown(){++guards;events.push_back("guard");return guard_ok&&(!guard_reject_drain||guards==1);}
|
||||
bool shouldPlayMessageTone()const{return true;}
|
||||
bool isPairingScreenActive()const{return false;}
|
||||
void resetRadioProfileDisplayPage(){_radio_profile_display_page=0;}
|
||||
void clearMsgPreview(){++preview_clears;_origin[0]=_msg[0]=0;}
|
||||
void notify(UIEventType);void notificationMelody(const char*);
|
||||
void handleButtonAnyPress();void handleButtonShortPress();
|
||||
void handleButtonDoublePress();void handleButtonTriplePress();
|
||||
void handleButtonQuadruplePress();void handleButtonLongPress();
|
||||
void shutdown(bool restart=false);void servicePendingShutdown();
|
||||
};
|
||||
@METHODS@
|
||||
int main(){
|
||||
auto reset=[](){the_mesh=MyMesh{};sensors=SensorManager{};events.clear();now_ms=10000;};
|
||||
auto last=[](const UITask& ui,ButtonVoicePrompt expected){assert(!ui.buzzer.prompts.empty()&&ui.buzzer.prompts.back()==expected);};
|
||||
reset();UITask single;
|
||||
single.handleButtonAnyPress();single.handleButtonShortPress();
|
||||
last(single,ButtonVoicePrompt::Ready);
|
||||
the_mesh.notification_active=true;
|
||||
single.handleButtonAnyPress();single.handleButtonAnyPress(); // The first click really acknowledged it.
|
||||
single.handleButtonShortPress();last(single,ButtonVoicePrompt::NotificationCleared);
|
||||
single.handleButtonAnyPress();single.handleButtonShortPress();last(single,ButtonVoicePrompt::Ready);
|
||||
assert(single.buzzer.prompts.size()==3);
|
||||
// Multi-click actions consume the acknowledgement latch instead of leaking it to a later single.
|
||||
the_mesh.notification_active=true;
|
||||
single.handleButtonAnyPress();single.handleButtonDoublePress();last(single,ButtonVoicePrompt::AdvertQueued);
|
||||
single.handleButtonAnyPress();single.handleButtonShortPress();last(single,ButtonVoicePrompt::Ready);
|
||||
// An attached display retains its existing preview/wake behavior, with no Ready chatter.
|
||||
Display display;single._display=&display;single._displayWasOn=true;
|
||||
strcpy(single._origin,"sender");strcpy(single._msg,"message");
|
||||
auto prompt_count=single.buzzer.prompts.size();
|
||||
single.handleButtonAnyPress();single.handleButtonShortPress();
|
||||
assert(single.preview_clears==1&&single.buzzer.prompts.size()==prompt_count&&display.wakes==1);
|
||||
|
||||
reset();UITask advert;
|
||||
advert.handleButtonDoublePress();last(advert,ButtonVoicePrompt::AdvertQueued);
|
||||
assert((events==std::vector<std::string>{"advert","speak"}));
|
||||
the_mesh.advert_ok=false;events.clear();
|
||||
advert.handleButtonDoublePress();last(advert,ButtonVoicePrompt::AdvertFailed);
|
||||
assert(the_mesh.adverts==2&&strstr(advert._alert,"failed"));
|
||||
assert((events==std::vector<std::string>{"advert","speak"}));
|
||||
|
||||
reset();UITask mute;
|
||||
mute.handleButtonTriplePress();last(mute,ButtonVoicePrompt::SoundOff);
|
||||
assert(mute.buzzer.muted&&the_mesh._prefs.buzzer_quiet&&the_mesh.output_muted);
|
||||
assert(mute.buzzer.courtesy.back()&&mute.buzzer.playing);
|
||||
assert((events==std::vector<std::string>{"save","quiet","mute","speak"}));
|
||||
events.clear();mute.handleButtonTriplePress();last(mute,ButtonVoicePrompt::SoundOn);
|
||||
assert(!mute.buzzer.muted&&!the_mesh._prefs.buzzer_quiet&&!the_mesh.output_muted);
|
||||
assert(mute.buzzer.courtesy.back()&&the_mesh.saves==2&&the_mesh.mute_calls==2);
|
||||
// Failed commits preserve runtime quiet, stored preference, and output routing separately.
|
||||
for(bool old_quiet:{false,true}){
|
||||
mute.buzzer.muted=old_quiet;the_mesh._prefs.buzzer_quiet=old_quiet;
|
||||
the_mesh.output_muted=old_quiet;the_mesh.save_ok=false;events.clear();
|
||||
auto mutes=the_mesh.mute_calls;
|
||||
mute.handleButtonTriplePress();last(mute,ButtonVoicePrompt::ActionFailed);
|
||||
assert(mute.buzzer.muted==old_quiet&&the_mesh._prefs.buzzer_quiet==old_quiet);
|
||||
assert(the_mesh.output_muted==old_quiet&&the_mesh.mute_calls==mutes);
|
||||
assert(mute.buzzer.courtesy.back()&&mute.buzzer.playing&&strstr(mute._alert,"failed"));
|
||||
assert(std::find(events.begin(),events.end(),"mute")==events.end());
|
||||
}
|
||||
// Even an initially inconsistent runtime/preference pair is not rewritten on failure.
|
||||
mute.buzzer.muted=false;the_mesh._prefs.buzzer_quiet=1;
|
||||
mute.handleButtonTriplePress();assert(!mute.buzzer.muted&&the_mesh._prefs.buzzer_quiet==1);
|
||||
|
||||
reset();UITask gps;
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
gps.handleButtonQuadruplePress();last(gps,ButtonVoicePrompt::GpsOn);
|
||||
assert(sensors.enabled&&the_mesh._prefs.gps_enabled&&the_mesh.saves==1);
|
||||
assert((events==std::vector<std::string>{"gps","save","speak"}));
|
||||
events.clear();gps.handleButtonQuadruplePress();last(gps,ButtonVoicePrompt::GpsOff);
|
||||
assert(!sensors.enabled&&!the_mesh._prefs.gps_enabled&&the_mesh.saves==2);
|
||||
the_mesh.save_ok=false;events.clear();
|
||||
gps.handleButtonQuadruplePress();last(gps,ButtonVoicePrompt::ActionFailed);
|
||||
assert(!sensors.enabled&&!the_mesh._prefs.gps_enabled&&strstr(gps._alert,"failed"));
|
||||
assert((events==std::vector<std::string>{"gps","save","gps","speak"}));
|
||||
the_mesh.save_ok=true;sensors.reject=true;
|
||||
auto saves=the_mesh.saves;gps.handleButtonQuadruplePress();last(gps,ButtonVoicePrompt::ActionFailed);
|
||||
assert(the_mesh.saves==saves&&!sensors.enabled&&!the_mesh._prefs.gps_enabled);
|
||||
sensors.reject=false;sensors.available=false;
|
||||
gps.handleButtonQuadruplePress();last(gps,ButtonVoicePrompt::ActionFailed);
|
||||
assert(the_mesh.saves==saves);
|
||||
#else
|
||||
gps.handleButtonQuadruplePress();last(gps,ButtonVoicePrompt::ActionFailed);
|
||||
assert(the_mesh.saves==0&&!sensors.enabled&&!the_mesh._prefs.gps_enabled);
|
||||
#endif
|
||||
gps._sensors=nullptr;gps.handleButtonQuadruplePress();last(gps,ButtonVoicePrompt::ActionFailed);
|
||||
|
||||
reset();UITask early;
|
||||
now_ms=7999;early.handleButtonLongPress();last(early,ButtonVoicePrompt::UsbSetup);
|
||||
assert(the_mesh.cli_entries==1&&early.guards==0&&!early._shutdown_pending);
|
||||
assert((events==std::vector<std::string>{"cli","speak"}));
|
||||
// Uptime arithmetic is unsigned even when boot began just before clock wrap.
|
||||
early.ui_started_at=0xfffffff0;now_ms=7982;
|
||||
early.handleButtonLongPress();last(early,ButtonVoicePrompt::UsbSetup);
|
||||
assert(the_mesh.cli_entries==2);
|
||||
|
||||
reset();UITask rejected;rejected.guard_ok=false;
|
||||
rejected.shutdown();last(rejected,ButtonVoicePrompt::ActionFailed);
|
||||
assert(!rejected._shutdown_pending&&!rejected.board.offs&&!rejected.board.reboots);
|
||||
rejected.servicePendingShutdown();assert(rejected.guards==1&&!rejected.board.offs);
|
||||
|
||||
reset();UITask shutdown;
|
||||
now_ms=8000;shutdown.handleButtonLongPress();last(shutdown,ButtonVoicePrompt::ShuttingDown);
|
||||
assert(shutdown._shutdown_pending&&shutdown.guards==1&&!shutdown.board.offs);
|
||||
assert((events==std::vector<std::string>{"guard","speak"}));
|
||||
// Shutdown callbacks return immediately; draining is foreground service, not a busy wait.
|
||||
assert(now_ms==8000);
|
||||
auto before=shutdown.buzzer.prompts.size();
|
||||
auto adverts=the_mesh.adverts,shutdown_saves=the_mesh.saves;
|
||||
shutdown.handleButtonAnyPress();shutdown.handleButtonShortPress();shutdown.handleButtonDoublePress();
|
||||
shutdown.handleButtonTriplePress();shutdown.handleButtonQuadruplePress();shutdown.handleButtonLongPress();
|
||||
shutdown.shutdown(true);shutdown.notify(UIEventType::ack);shutdown.notificationMelody("notification");
|
||||
assert(shutdown.buzzer.prompts.size()==before&&the_mesh.adverts==adverts&&the_mesh.saves==shutdown_saves);
|
||||
assert(!shutdown.buzzer.plays&&!shutdown.buzzer.notification_plays&&shutdown.guards==1);
|
||||
now_ms+=4999;shutdown.servicePendingShutdown();assert(!shutdown.board.offs&&shutdown._shutdown_pending);
|
||||
shutdown.buzzer.playing=false;shutdown.servicePendingShutdown();
|
||||
assert(shutdown.board.offs==1&&!shutdown._shutdown_pending&&shutdown.guards==2&&shutdown.buzzer.stops==1);
|
||||
shutdown.servicePendingShutdown();assert(shutdown.board.offs==1);
|
||||
|
||||
reset();UITask restart;
|
||||
now_ms=0xfffffff0;restart.shutdown(true);last(restart,ButtonVoicePrompt::Restarting);
|
||||
now_ms+=4999;restart.servicePendingShutdown();assert(!restart.board.reboots&&restart._shutdown_pending);
|
||||
++now_ms;restart.servicePendingShutdown();
|
||||
assert(restart.board.reboots==1&&!restart.board.offs&&!restart._shutdown_pending&&!restart.buzzer.playing);
|
||||
|
||||
reset();UITask drain_rejected;drain_rejected.guard_reject_drain=true;
|
||||
drain_rejected.shutdown();drain_rejected.buzzer.playing=false;drain_rejected.servicePendingShutdown();
|
||||
last(drain_rejected,ButtonVoicePrompt::ActionFailed);
|
||||
assert(!drain_rejected._shutdown_pending&&!drain_rejected.board.offs&&drain_rejected.guards==2);
|
||||
|
||||
// Use the actual click decoder to establish that holding does not turn into a Ready/advert.
|
||||
reset();UITask held;now_ms=100;
|
||||
Button button(6,HIGH);button.begin();
|
||||
static_assert(BUTTON_LONG_PRESS_TIME_MS==3000,"three-second hold");
|
||||
button.onAnyPress([&]{held.handleButtonAnyPress();});
|
||||
button.onShortPress([&]{held.handleButtonShortPress();});
|
||||
button.onDoublePress([&]{held.handleButtonDoublePress();});
|
||||
button.onLongPress([&]{held.handleButtonLongPress();});
|
||||
assert(button.injectPresses(1,3500));
|
||||
for(unsigned i=0;i<500;++i){now_ms+=10;button.update();}
|
||||
assert(held.buzzer.prompts.size()==1&&the_mesh.adverts==0&&the_mesh.cli_entries==1);
|
||||
last(held,ButtonVoicePrompt::UsbSetup);
|
||||
}
|
||||
'''
|
||||
|
||||
NOTIFICATION_ACK = r'''
|
||||
#include <cassert>
|
||||
#include <initializer_list>
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||
#include <helpers/CompanionNotificationPolicy.h>
|
||||
#pragma GCC diagnostic pop
|
||||
uint32_t now_ms=0;
|
||||
using namespace mesh::notify;
|
||||
struct Probe : Sink,Store {
|
||||
unsigned stops=0;
|
||||
uint8_t capabilities()const override{return Sound;}
|
||||
bool gpioAvailable(uint8_t)const override{return false;}
|
||||
void pulse(Output,bool,int8_t)override{}
|
||||
void melody(const char* value)override{if(!value)++stops;}
|
||||
void screen(int8_t)override{}
|
||||
bool save(const Settings&)override{return true;}
|
||||
};
|
||||
struct MyMesh {
|
||||
Controller _notifications;
|
||||
explicit MyMesh(Probe& probe):_notifications(probe,probe){}
|
||||
@WRAPPER@
|
||||
};
|
||||
int main(){
|
||||
Probe probe;MyMesh mesh(probe);
|
||||
assert(!mesh.notificationButton()&&probe.stops==0);
|
||||
auto& settings=mesh._notifications.settings();settings.enabled=1;settings.outputs=Sound;
|
||||
auto& rule=settings.rules[0];rule.used=1;
|
||||
assert(setField(rule,FSound,"test:d=4,o=5,b=120:c"));
|
||||
assert(setField(rule,FStop,"button"));
|
||||
assert(mesh._notifications.message(nullptr,nullptr,false,100));
|
||||
assert(mesh.notificationButton()&&!mesh._notifications.active()&&probe.stops==1);
|
||||
assert(!mesh.notificationButton()&&probe.stops==1);
|
||||
// An active alert with another stop policy was not actually cleared by input.
|
||||
for(const char* policy:{"connected","never"}){
|
||||
assert(setField(rule,FStop,policy));
|
||||
assert(mesh._notifications.message(nullptr,nullptr,false,200));
|
||||
auto stops=probe.stops;
|
||||
assert(!mesh.notificationButton()&&mesh._notifications.active()&&probe.stops==stops);
|
||||
mesh._notifications.stop();
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
NOTIFICATION_MELODY = r'''
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#define PIN_BUZZER 25
|
||||
#define MESH_GPS_VOICE @VOICE@
|
||||
uint32_t now_ms=0;
|
||||
struct Buzzer {
|
||||
bool muted=true,playing=true,control_voice=true;unsigned melodies=0,stops=0,notification_stops=0;
|
||||
bool isQuiet(){return muted;}
|
||||
void playNotification(const char*){++melodies;playing=true;control_voice=false;}
|
||||
void stop(){++stops;playing=false;}
|
||||
void stopNotification(){++notification_stops;if(!MESH_GPS_VOICE||!control_voice)playing=false;}
|
||||
};
|
||||
struct UITask {
|
||||
Buzzer buzzer;bool _shutdown_pending=false;
|
||||
void notificationMelody(const char*);
|
||||
};
|
||||
@METHOD@
|
||||
int main(){
|
||||
UITask ui;
|
||||
// A muted programmable alert must not preempt the final courtesy confirmation.
|
||||
ui.notificationMelody("ordinary");
|
||||
#if MESH_GPS_VOICE
|
||||
assert(ui.buzzer.melodies==0&&ui.buzzer.playing&&ui.buzzer.stops==0);
|
||||
#else
|
||||
assert(ui.buzzer.melodies==1&&ui.buzzer.playing&&ui.buzzer.stops==0);
|
||||
#endif
|
||||
// Background stop requests retain control speech while quiet.
|
||||
ui.notificationMelody(nullptr);
|
||||
assert(ui.buzzer.stops==0&&ui.buzzer.notification_stops==1);
|
||||
#if MESH_GPS_VOICE
|
||||
assert(ui.buzzer.playing);
|
||||
#else
|
||||
assert(!ui.buzzer.playing);
|
||||
#endif
|
||||
ui.buzzer.muted=false;ui.notificationMelody("ordinary");
|
||||
#if MESH_GPS_VOICE
|
||||
assert(ui.buzzer.melodies==1&&ui.buzzer.playing);
|
||||
#else
|
||||
assert(ui.buzzer.melodies==2&&ui.buzzer.playing);
|
||||
#endif
|
||||
ui._shutdown_pending=true;
|
||||
ui.notificationMelody("ordinary");ui.notificationMelody(nullptr);
|
||||
#if MESH_GPS_VOICE
|
||||
assert(ui.buzzer.melodies==1&&ui.buzzer.stops==0&&ui.buzzer.notification_stops==1&&ui.buzzer.playing);
|
||||
#else
|
||||
assert(ui.buzzer.melodies==3&&ui.buzzer.stops==0&&ui.buzzer.notification_stops==2&&!ui.buzzer.playing);
|
||||
#endif
|
||||
}
|
||||
'''
|
||||
|
||||
NOTIFICATION_STOPS = r'''
|
||||
#include <cassert>
|
||||
#include <initializer_list>
|
||||
#define PIN_BUZZER 25
|
||||
#define PIN_BUZZER_EN 37
|
||||
#define MESH_BUTTON_AUDIO_HIL 1
|
||||
#define MESH_GPS_VOICE @VOICE@
|
||||
#include <helpers/ui/buzzer.cpp>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
genericBuzzer buzzer;buzzer.begin();
|
||||
buzzer.playNotification("ordinary:d=4,o=5,b=120:c");
|
||||
assert(buzzer.isPlaying()&&rtttl::isPlaying());
|
||||
buzzer.stopNotification();assert(!buzzer.isPlaying()&&!rtttl::isPlaying());
|
||||
assert(buzzer.speakGps(true)&&rtttl::isPlaying());
|
||||
buzzer.stopNotification();
|
||||
#if MESH_GPS_VOICE
|
||||
// A stale notification stop cannot cut off the direction tone or its gap.
|
||||
assert(buzzer.isPlaying()&&rtttl::isPlaying()&&!registers.ENABLE);
|
||||
auto starts=gps_voice.started(),cancelled=gps_voice.cancelled();
|
||||
rtttl::finish();buzzer.loop();
|
||||
assert(buzzer.isPlaying()&&!rtttl::isPlaying()&&!registers.ENABLE);
|
||||
buzzer.stopNotification();assert(buzzer.isPlaying());
|
||||
now_ms+=99;buzzer.loop();buzzer.stopNotification();
|
||||
assert(buzzer.isPlaying()&&!registers.ENABLE);
|
||||
++now_ms;buzzer.loop();assert(registers.ENABLE&&gps_voice.started()==starts+1);
|
||||
buzzer.stopNotification();
|
||||
assert(registers.ENABLE&&HwPWM3.owned&&buzzer.isPlaying()&&gps_voice.cancelled()==cancelled);
|
||||
auto drain=[&]{
|
||||
unsigned sequence=0,events=0;
|
||||
while(registers.ENABLE){
|
||||
assert(++events<2000);buzzer.stopNotification();
|
||||
assert(registers.ENABLE&&HwPWM3.owned&&gps_voice.cancelled()==cancelled);
|
||||
registers.EVENTS_SEQEND[sequence]=1;PWM3_IRQHandler();sequence^=1;
|
||||
}
|
||||
// Completed DMA still owns its hardware until foreground cleanup.
|
||||
assert(buzzer.isPlaying()&&HwPWM3.owned);
|
||||
buzzer.stopNotification();assert(HwPWM3.owned&&gps_voice.cancelled()==cancelled);
|
||||
buzzer.loop();assert(!buzzer.isPlaying()&&!HwPWM3.owned&&!HwPWM3.pin&&!irq_enabled);
|
||||
};
|
||||
drain();
|
||||
// The same protection covers a courtesy confirmation while alerts are muted.
|
||||
buzzer.quiet(true);assert(buzzer.speakButton(ButtonVoicePrompt::ActionFailed,true));
|
||||
buzzer.stopNotification();assert(buzzer.isPlaying()&&buzzer.isQuiet());
|
||||
buzzer.loop();now_ms+=100;buzzer.loop();assert(registers.ENABLE);
|
||||
drain();
|
||||
assert(pin_states[PIN_BUZZER_EN]==LOW&&pin_states[PIN_BUZZER]==LOW);
|
||||
#else
|
||||
// Without voice, this API remains an ordinary tone stop.
|
||||
assert(!buzzer.isPlaying()&&!rtttl::isPlaying());
|
||||
buzzer.quiet(true);
|
||||
#endif
|
||||
buzzer.playNotification("ordinary:d=4,o=5,b=120:c");
|
||||
assert(buzzer.isPlaying()&&pin_states[PIN_BUZZER_EN]==HIGH);
|
||||
buzzer.stopNotification();
|
||||
assert(!buzzer.isPlaying()&&!rtttl::isPlaying()&&buzzer.isQuiet());
|
||||
assert(pin_states[PIN_BUZZER_EN]==LOW);
|
||||
}
|
||||
'''
|
||||
|
||||
X1_ALERT_MODES = r'''
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <helpers/ui/ButtonVoice.h>
|
||||
#define PIN_BUZZER 25
|
||||
#define HAS_DRV2605 1
|
||||
#define MESH_GPS_VOICE @VOICE@
|
||||
#define MESH_DEBUG_PRINTLN(...) ((void)0)
|
||||
uint32_t now_ms=0;
|
||||
static std::vector<std::string> mode_events;
|
||||
enum class UIEventType{ack};
|
||||
namespace mesh{namespace notify{enum{Sound=1,Vibration=2};}}
|
||||
struct CompanionNodePrefs{uint8_t buzzer_quiet=0,vibe_quiet=0;};
|
||||
struct MyMesh {
|
||||
CompanionNodePrefs _prefs;
|
||||
bool save_ok=true,mask_save_ok=true;
|
||||
unsigned saves=0,mutes=0;
|
||||
bool sound_muted=false,vibration_muted=false;
|
||||
std::vector<unsigned> saved_modes;
|
||||
bool savePrefs(){
|
||||
mode_events.push_back("save");
|
||||
++saves;saved_modes.push_back((_prefs.buzzer_quiet?2:0)|(_prefs.vibe_quiet?1:0));
|
||||
return save_ok;
|
||||
}
|
||||
void setNotificationOutputMute(int output,bool quiet){
|
||||
++mutes;
|
||||
mode_events.push_back("mask");
|
||||
if(!mask_save_ok)return;
|
||||
if(output==mesh::notify::Sound)sound_muted=quiet;
|
||||
else if(output==mesh::notify::Vibration)vibration_muted=quiet;
|
||||
else assert(false);
|
||||
}
|
||||
};
|
||||
static MyMesh the_mesh;
|
||||
struct Buzzer {
|
||||
bool muted=false;
|
||||
std::vector<ButtonVoicePrompt> prompts;
|
||||
std::vector<bool> courtesy;
|
||||
void quiet(bool value){muted=value;}
|
||||
bool isQuiet(){return muted;}
|
||||
bool speakButton(ButtonVoicePrompt prompt,bool allowQuiet=false){
|
||||
mode_events.push_back("voice");
|
||||
prompts.push_back(prompt);courtesy.push_back(allowQuiet);return true;
|
||||
}
|
||||
};
|
||||
struct Vibration {
|
||||
bool muted=false,active=false;unsigned triggers=0,stops=0,pulses=0;
|
||||
void quiet(bool value){muted=value;}
|
||||
bool isQuiet(){return muted;}
|
||||
void trigger(bool confirmation=false){assert(confirmation);++triggers;}
|
||||
void stop(){++stops;active=false;mode_events.push_back("stop");}
|
||||
void pulse(bool on){++pulses;active=on;}
|
||||
};
|
||||
struct UITask {
|
||||
CompanionNodePrefs* _node_prefs=&the_mesh._prefs;
|
||||
Buzzer buzzer;Vibration vibration;
|
||||
bool _shutdown_pending=false,_button_notification_cleared=false,_need_refresh=false;
|
||||
char _alert[80]={};unsigned acknowledgements=0;
|
||||
void notify(UIEventType){++acknowledgements;}
|
||||
void handleButtonTriplePress();
|
||||
void notificationVibration(bool);
|
||||
};
|
||||
@METHOD@
|
||||
@VIBRATION_METHOD@
|
||||
int main(){
|
||||
UITask ui;
|
||||
const ButtonVoicePrompt expected[]={
|
||||
ButtonVoicePrompt::AlertsSoundVibration,ButtonVoicePrompt::AlertsSoundOnly,
|
||||
ButtonVoicePrompt::AlertsVibrationOnly,ButtonVoicePrompt::AlertsSilent,
|
||||
};
|
||||
unsigned vibration_triggers=0,vibration_stops=0;
|
||||
for(unsigned step=1;step<=8;++step){
|
||||
const auto mode=step&3;
|
||||
ui._button_notification_cleared=true;
|
||||
auto saves=the_mesh.saves;
|
||||
mode_events.clear();
|
||||
ui.vibration.active=true;
|
||||
ui.handleButtonTriplePress();
|
||||
assert(the_mesh.saves==saves+1&&the_mesh.saved_modes.back()==mode);
|
||||
assert(the_mesh._prefs.buzzer_quiet==!!(mode&2));
|
||||
assert(the_mesh._prefs.vibe_quiet==!!(mode&1));
|
||||
assert(ui.buzzer.muted==!!(mode&2)&&ui.vibration.muted==!!(mode&1));
|
||||
assert(the_mesh.sound_muted==!!(mode&2)&&the_mesh.vibration_muted==!!(mode&1));
|
||||
if(!(mode&1))++vibration_triggers;
|
||||
assert(ui.vibration.triggers==vibration_triggers&&ui._need_refresh);
|
||||
#if MESH_GPS_VOICE
|
||||
if(mode&1){
|
||||
++vibration_stops;assert(!ui.vibration.active);
|
||||
assert(mode_events.size()>=2&&mode_events[0]=="save"&&mode_events[1]=="stop");
|
||||
}
|
||||
assert(ui.vibration.stops==vibration_stops);
|
||||
assert(ui.buzzer.prompts.size()==step&&ui.buzzer.prompts.back()==expected[mode]);
|
||||
// Selecting silent or vibration-only gets a single final confirmation,
|
||||
// without unmuting saved alerts or notification routing.
|
||||
assert(ui.buzzer.courtesy.back()&&!ui._button_notification_cleared);
|
||||
assert(ui.acknowledgements==0);
|
||||
#else
|
||||
assert(ui.buzzer.prompts.empty());
|
||||
#endif
|
||||
}
|
||||
#if MESH_GPS_VOICE
|
||||
// Each possible persisted mode is restored on failure. Deliberately divergent
|
||||
// runtime and routing states are preserved too; a failed save is not a toggle.
|
||||
the_mesh.save_ok=false;
|
||||
for(unsigned mode=0;mode<4;++mode){
|
||||
the_mesh._prefs.buzzer_quiet=!!(mode&2);the_mesh._prefs.vibe_quiet=!!(mode&1);
|
||||
ui.buzzer.muted=!(mode&2);ui.vibration.muted=!(mode&1);
|
||||
the_mesh.sound_muted=!(mode&2);the_mesh.vibration_muted=!(mode&1);
|
||||
const auto old_buzzer=ui.buzzer.muted,old_vibration=ui.vibration.muted;
|
||||
const auto old_sound=the_mesh.sound_muted,old_vibe=the_mesh.vibration_muted;
|
||||
const auto mutes=the_mesh.mutes,triggers=ui.vibration.triggers,saves=the_mesh.saves;
|
||||
const auto stops=ui.vibration.stops;
|
||||
mode_events.clear();
|
||||
ui.handleButtonTriplePress();
|
||||
assert(the_mesh.saves==saves+1&&the_mesh.saved_modes.back()==((mode+1)&3));
|
||||
assert(the_mesh._prefs.buzzer_quiet==!!(mode&2)&&the_mesh._prefs.vibe_quiet==!!(mode&1));
|
||||
assert(ui.buzzer.muted==old_buzzer&&ui.vibration.muted==old_vibration);
|
||||
assert(the_mesh.sound_muted==old_sound&&the_mesh.vibration_muted==old_vibe);
|
||||
assert(the_mesh.mutes==mutes&&ui.vibration.triggers==triggers);
|
||||
assert(ui.vibration.stops==stops);
|
||||
assert((mode_events==std::vector<std::string>{"save","voice"}));
|
||||
assert(ui.buzzer.prompts.back()==ButtonVoicePrompt::ActionFailed&&strstr(ui._alert,"failed"));
|
||||
assert(ui.buzzer.courtesy.back());
|
||||
}
|
||||
// A notification-mask write failure cannot undo the committed physical mode.
|
||||
the_mesh.save_ok=true;the_mesh.mask_save_ok=false;
|
||||
the_mesh._prefs.buzzer_quiet=the_mesh._prefs.vibe_quiet=0;
|
||||
the_mesh.sound_muted=the_mesh.vibration_muted=false;
|
||||
ui.vibration.active=true;
|
||||
ui.handleButtonTriplePress();
|
||||
assert(the_mesh._prefs.vibe_quiet==1&&!the_mesh.vibration_muted&&!ui.vibration.active);
|
||||
auto pulses=ui.vibration.pulses,stops=ui.vibration.stops;
|
||||
ui.notificationVibration(true);
|
||||
assert(ui.vibration.pulses==pulses&&ui.vibration.stops==stops+1&&!ui.vibration.active);
|
||||
ui.notificationVibration(false);
|
||||
assert(ui.vibration.pulses==pulses+1&&!ui.vibration.active);
|
||||
the_mesh._prefs.vibe_quiet=0;ui.notificationVibration(true);
|
||||
assert(ui.vibration.pulses==pulses+2&&ui.vibration.active);
|
||||
ui.notificationVibration(false);assert(!ui.vibration.active);
|
||||
ui._node_prefs=nullptr;ui.notificationVibration(true);assert(ui.vibration.active);
|
||||
ui._node_prefs=&the_mesh._prefs;
|
||||
// Shutdown quiesces multi-click changes instead of preempting final speech.
|
||||
ui._shutdown_pending=true;
|
||||
const auto saves=the_mesh.saves;
|
||||
const auto prompts=ui.buzzer.prompts.size();
|
||||
ui.handleButtonTriplePress();
|
||||
assert(the_mesh.saves==saves&&ui.buzzer.prompts.size()==prompts);
|
||||
#else
|
||||
(void)expected;
|
||||
(void)vibration_stops;
|
||||
assert(ui.acknowledgements==4);
|
||||
// The opt-out retains its historical driver forwarding despite mute prefs.
|
||||
ui._node_prefs->vibe_quiet=1;
|
||||
ui.notificationVibration(true);assert(ui.vibration.active);
|
||||
ui.notificationVibration(false);assert(!ui.vibration.active);
|
||||
#endif
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
class Tests(unittest.TestCase):
|
||||
build = gps_tests.Tests.build
|
||||
|
||||
def test_every_prompt_uses_its_own_clip_and_preserves_direction_tones(self):
|
||||
self.build(PROMPTS, rtttl=True)
|
||||
|
||||
def test_each_new_board_default_uses_its_actual_buzzer_pin_and_releases_pwm(self):
|
||||
for board, pin, enable in (
|
||||
('RAK_WISMESH_TAG', 21, None),
|
||||
('MESH_TRACKER_X1', 25, None),
|
||||
('R1Neo', 3, None),
|
||||
('THINKNODE_M3', 23, 36),
|
||||
):
|
||||
with self.subTest(board=board):
|
||||
source = PROMPTS.replace('#define PIN_BUZZER 25', f'#define PIN_BUZZER {pin}')
|
||||
source = source.replace('#define PIN_BUZZER_EN 37',
|
||||
'' if enable is None else f'#define PIN_BUZZER_EN {enable}')
|
||||
source = source.replace('#define MESH_GPS_VOICE 1',
|
||||
'#define NRF52_PLATFORM\n#define COMPANION_RADIO_FULL 1\n'
|
||||
+f'#define {board}\n')
|
||||
if board != 'MESH_TRACKER_X1':
|
||||
source = source.replace('#define HAS_DRV2605 1', '')
|
||||
self.build(source, rtttl=True)
|
||||
|
||||
def test_quiet_courtesy_completion_and_cancellation_release_both_pins(self):
|
||||
self.build(COURTESY, rtttl=True)
|
||||
|
||||
def test_muted_x1_mode_announcements_never_unmute_notifications_and_release_pwm(self):
|
||||
for prompt in ('AlertsSoundVibration', 'AlertsSoundOnly',
|
||||
'AlertsVibrationOnly', 'AlertsSilent'):
|
||||
with self.subTest(prompt=prompt):
|
||||
self.build(COURTESY.replace('ButtonVoicePrompt::SoundOff',
|
||||
'ButtonVoicePrompt::'+prompt)
|
||||
.replace('#define MESH_GPS_VOICE 1',
|
||||
'#define HAS_DRV2605 1\n#define MESH_GPS_VOICE 1'), rtttl=True)
|
||||
|
||||
def test_x1_alert_modes_report_committed_result_and_legacy_tones_remain(self):
|
||||
ui = (ROOT / 'examples/companion_radio/ui-orig/UITask.cpp').read_text()
|
||||
triple = method(ui, 'void UITask::handleButtonTriplePress()')
|
||||
vibration = method(ui, 'void UITask::notificationVibration(bool on)')
|
||||
for voice in (0, 1):
|
||||
with self.subTest(voice=voice):
|
||||
self.build(X1_ALERT_MODES.replace('@METHOD@', triple)
|
||||
.replace('@VIBRATION_METHOD@', vibration)
|
||||
.replace('@VOICE@', str(voice)))
|
||||
|
||||
def test_voice_disabled_ordinary_play_keeps_its_legacy_preemption(self):
|
||||
self.build(LEGACY_ORDINARY_PLAY, rtttl=True)
|
||||
|
||||
def test_notification_cleared_requires_an_actual_button_acknowledgement(self):
|
||||
mesh = (ROOT / 'examples/companion_radio/MyMesh.h').read_text()
|
||||
wrapper = method(mesh, 'bool notificationButton()')
|
||||
self.build(NOTIFICATION_ACK.replace('@WRAPPER@', wrapper))
|
||||
|
||||
def test_muted_programmable_notifications_do_not_cancel_courtesy_audio(self):
|
||||
ui = (ROOT / 'examples/companion_radio/ui-orig/UITask.cpp').read_text()
|
||||
melody = method(ui, 'void UITask::notificationMelody(const char* text)')
|
||||
for voice in (0, 1):
|
||||
with self.subTest(voice=voice):
|
||||
self.build(NOTIFICATION_MELODY.replace('@METHOD@', melody)
|
||||
.replace('@VOICE@', str(voice)))
|
||||
|
||||
def test_notification_stop_preserves_control_tone_gap_and_dma_but_cancels_alerts(self):
|
||||
for voice in (0, 1):
|
||||
with self.subTest(voice=voice):
|
||||
self.build(NOTIFICATION_STOPS.replace('@VOICE@', str(voice)), rtttl=True)
|
||||
|
||||
def test_button_actions_report_committed_results_and_shutdown_without_blocking(self):
|
||||
mesh = (ROOT / 'examples/companion_radio/MyMesh.cpp').read_text()
|
||||
ui = (ROOT / 'examples/companion_radio/ui-orig/UITask.cpp').read_text()
|
||||
methods = method(mesh, 'bool MyMesh::setGpsEnabled(bool enabled)')
|
||||
for signature in (
|
||||
'void UITask::notify(UIEventType t)',
|
||||
'void UITask::notificationMelody(const char* text)',
|
||||
'void UITask::handleButtonAnyPress()',
|
||||
'void UITask::handleButtonShortPress()',
|
||||
'void UITask::handleButtonDoublePress()',
|
||||
'void UITask::handleButtonTriplePress()',
|
||||
'void UITask::handleButtonQuadruplePress()',
|
||||
'void UITask::handleButtonLongPress()',
|
||||
'void UITask::shutdown(bool restart)',
|
||||
'void UITask::servicePendingShutdown()',
|
||||
):
|
||||
methods += '\n' + method(ui, signature)
|
||||
self.build(UI_ACTIONS.replace('@METHODS@', methods), button=True)
|
||||
self.build(UI_ACTIONS.replace('@METHODS@', methods)
|
||||
.replace('#define ENV_INCLUDE_GPS 1', '#define ENV_INCLUDE_GPS 0'), button=True)
|
||||
loop = method(ui, 'void UITask::loop()')
|
||||
self.assertLess(loop.index('buzzer.loop()'), loop.index('servicePendingShutdown()'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,340 @@
|
||||
"""Validate the fixed prerecorded catalog without speech synthesis or hardware."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import re
|
||||
import shutil
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import wave
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
ENCODER = ROOT / "scripts/generate_button_voice.py"
|
||||
SYNTHESIZER = ROOT / "scripts/generate_button_voice.ps1"
|
||||
POWERSHELL = shutil.which("pwsh") or shutil.which("powershell")
|
||||
CATALOG = (
|
||||
("ready", "Ready"),
|
||||
("notificationCleared", "Notification cleared"),
|
||||
("advertQueued", "Advert queued"),
|
||||
("advertFailed", "Advert failed"),
|
||||
("soundOn", "Sound on"),
|
||||
("soundOff", "Sound off"),
|
||||
("actionFailed", "Action failed"),
|
||||
("usbSetup", "USB setup"),
|
||||
("shuttingDown", "Shutting down"),
|
||||
("restarting", "Restarting"),
|
||||
("alertsSoundVibration", "Sound and vibration"),
|
||||
("alertsSoundOnly", "Sound only"),
|
||||
("alertsVibrationOnly", "Vibration only"),
|
||||
("alertsSilent", "Silent"),
|
||||
)
|
||||
|
||||
# Approved Microsoft Zira Desktop, rate -1 / compressed / peak-0.12 / 8 kHz.
|
||||
# Fingerprints were derived from the freshly synthesized WAVs, then checked
|
||||
# against the selected header. They must not be computed from that header at
|
||||
# test runtime: a Zira default/label does not establish the recordings' identity.
|
||||
ZIRA_RECORDINGS = {
|
||||
'ready': ('1b7823a41160abedaebb87d185a60c53bd11aba167797210c1dc37486e7c2fe0', 3147),
|
||||
'notificationCleared': ('86ef9cdaaeee5e56254fef71512fe0de11119f732b2ab3125d2efda1c6dd538d', 10984),
|
||||
'advertQueued': ('93db629d81e9d029a46f49df068dc0d8b8182687b348ec6123b43b8910ab2abb', 7062),
|
||||
'advertFailed': ('2465649d7259fed3283915e5e56d23ae9f43772f10a419a84d654ab0360c778e', 7429),
|
||||
'soundOn': ('a644478dbe1ef01d126de862b2153b077b468acaa4e452dd26b12ec4878faf1e', 6229),
|
||||
'soundOff': ('43565c13fab68fa5e0ca20c55a7213e10109e6289e4fa35dc7396acdda905f78', 5393),
|
||||
'actionFailed': ('971c92c5150931ffe63504573996ee931d77d77c2a888dfe35f8ba389a8c32d8', 7470),
|
||||
'usbSetup': ('f42ae082f7eab15bc7e2bd7b25f1ed50c6ed264099e5b7814897828d5b8ef051', 8957),
|
||||
'shuttingDown': ('973104cd1e48c6f584ec1e9eb3169bfa78bedc9399dbede88e364ef5571c91bb', 7461),
|
||||
'restarting': ('49425018482bdee20b8140cd2c33419778b591ba93e0d1137f06a0ab18a3f035', 5866),
|
||||
'alertsSoundVibration': ('8fedaa6d711c8623f67719214bc4d040ad43ad17736bcac82a516b8fc9c5aa93', 10915),
|
||||
'alertsSoundOnly': ('6f5d4f043d53c9ff40537a13df600f7c0c71abb462ddc97f357fceda8e5fd565', 7108),
|
||||
'alertsVibrationOnly': ('bd2e5d34d79655c721774db8a6e76aaf26c54b8e075fea3ddd21a427ac6f3f2e', 8723),
|
||||
'alertsSilent': ('fcdef5047e616f6454aae42c90bb238303654b04e21fc9e5378693d91233e2a8', 5717),
|
||||
}
|
||||
|
||||
|
||||
def write_wav(path, samples, *, rate=8000, channels=1, width=2):
|
||||
with wave.open(str(path), "wb") as wav:
|
||||
wav.setnchannels(channels)
|
||||
wav.setsampwidth(width)
|
||||
wav.setframerate(rate)
|
||||
values = samples * channels
|
||||
payload = (struct.pack("<" + "h" * len(values), *values)
|
||||
if width == 2 else bytes(len(values)))
|
||||
wav.writeframes(payload)
|
||||
|
||||
|
||||
def parse_header(source):
|
||||
arrays = {
|
||||
name: bytes(int(value, 16) for value in re.findall(r"0x([0-9a-fA-F]{2})", body))
|
||||
for name, body in re.findall(
|
||||
r"static const uint8_t (\w+)Data\[\] = \{(.*?)\};", source, re.S)
|
||||
}
|
||||
clips = {
|
||||
name: (data, size, int(samples), int(rate))
|
||||
for name, data, size, samples, rate in re.findall(
|
||||
r"static constexpr VoiceClip (\w+)Clip = \{\s*"
|
||||
r"(\w+)Data, sizeof\((\w+)Data\), (\d+), (\d+)\s*\};", source)
|
||||
}
|
||||
return arrays, clips
|
||||
|
||||
|
||||
class EncoderTests(unittest.TestCase):
|
||||
def fixtures(self, directory):
|
||||
samples = {}
|
||||
for index, (name, _) in enumerate(CATALOG):
|
||||
# This known prefix encodes to 00 91 a1 b3 from predictor/index 0.
|
||||
# Odd and even lengths exercise the padded final nibble separately.
|
||||
values = [0, 0, 1, -1, 2, -2, 3, -3]
|
||||
values += [((offset * 997 + index * 1733) % 20001) - 10000
|
||||
for offset in range(9 + index * 7)]
|
||||
write_wav(directory / (name + ".wav"), values)
|
||||
samples[name] = values
|
||||
return samples
|
||||
|
||||
def generate(self, directory, output, *arguments):
|
||||
return subprocess.run(
|
||||
[sys.executable, str(ENCODER), "--directory", str(directory),
|
||||
"--output", str(output), *arguments], cwd=ROOT, capture_output=True,
|
||||
text=True, timeout=30,
|
||||
)
|
||||
|
||||
def test_fixed_catalog_sizes_independent_streams_and_reproducibility(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
samples = self.fixtures(directory)
|
||||
first, second = directory / "first.h", directory / "second.h"
|
||||
result = self.generate(directory, first)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
repeated = self.generate(directory, second)
|
||||
self.assertEqual(repeated.returncode, 0, repeated.stderr)
|
||||
self.assertEqual(first.read_bytes(), second.read_bytes())
|
||||
self.assertEqual(result.stdout, repeated.stdout)
|
||||
source = first.read_text(encoding="utf-8")
|
||||
self.assertNotIn('// Voice:', source)
|
||||
self.assert_x1_only_recordings_are_guarded(source)
|
||||
arrays, clips = parse_header(source)
|
||||
self.assertEqual(tuple(arrays), tuple(name for name, _ in CATALOG))
|
||||
self.assertEqual(tuple(clips), tuple(arrays))
|
||||
for name, phrase in CATALOG:
|
||||
with self.subTest(phrase=phrase):
|
||||
count = len(samples[name])
|
||||
self.assertEqual(clips[name], (name, name, count, 8000))
|
||||
self.assertEqual(len(arrays[name]), (count + 1) // 2)
|
||||
self.assertEqual(arrays[name][:4], bytes.fromhex("00 91 a1 b3"))
|
||||
if count & 1:
|
||||
self.assertEqual(arrays[name][-1] >> 4, 0)
|
||||
self.assertIn('// "' + phrase + '"', source)
|
||||
self.assertIn(f"{phrase}: {count / 8000:.3f}s", result.stdout)
|
||||
self.assertIn(
|
||||
f"Button confirmations: {sum(len(data) for data in arrays.values())} audio bytes",
|
||||
result.stdout,
|
||||
)
|
||||
|
||||
def test_checked_in_assets_match_fixed_catalog_and_clip_bounds(self):
|
||||
source = (ROOT / "src/helpers/ui/ButtonVoiceData.h").read_text(encoding="utf-8")
|
||||
self.assert_x1_only_recordings_are_guarded(source)
|
||||
arrays, clips = parse_header(source)
|
||||
self.assertEqual(tuple(arrays), tuple(name for name, _ in CATALOG))
|
||||
self.assertEqual(tuple(clips), tuple(arrays))
|
||||
for name, phrase in CATALOG:
|
||||
with self.subTest(phrase=phrase):
|
||||
data_name, size_name, count, rate = clips[name]
|
||||
self.assertEqual((data_name, size_name, rate), (name, name, 8000))
|
||||
self.assertGreater(count, 0)
|
||||
self.assertLessEqual(count, 32000)
|
||||
self.assertEqual(len(arrays[name]), (count + 1) // 2)
|
||||
self.assertTrue(any(arrays[name]))
|
||||
if count & 1:
|
||||
self.assertEqual(arrays[name][-1] >> 4, 0)
|
||||
self.assertIn('// "' + phrase + '"', source)
|
||||
|
||||
def test_optional_voice_metadata_does_not_change_encoded_fixture_bytes(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
self.fixtures(directory)
|
||||
plain, selected = directory / 'plain.h', directory / 'zira.h'
|
||||
baseline = self.generate(directory, plain)
|
||||
voiced = self.generate(directory, selected, '--voice', 'Microsoft Zira Desktop')
|
||||
self.assertEqual(baseline.returncode, 0, baseline.stderr)
|
||||
self.assertEqual(voiced.returncode, 0, voiced.stderr)
|
||||
source = selected.read_text(encoding='utf-8')
|
||||
self.assertIn('// Voice: Microsoft Zira Desktop\n', source)
|
||||
self.assertEqual(parse_header(source), parse_header(plain.read_text(encoding='utf-8')))
|
||||
|
||||
def test_selected_production_recordings_are_the_approved_zira_catalog_not_just_zira_labels(self):
|
||||
source = (ROOT / 'src/helpers/ui/ButtonVoiceData.h').read_text(encoding='utf-8')
|
||||
self.assertEqual([line for line in source.splitlines() if line.startswith('// Voice:')],
|
||||
['// Voice: Microsoft Zira Desktop'])
|
||||
arrays, clips = parse_header(source)
|
||||
self.assertEqual(tuple(arrays), tuple(ZIRA_RECORDINGS))
|
||||
self.assertEqual(tuple(clips), tuple(ZIRA_RECORDINGS))
|
||||
for name, (fingerprint, samples) in ZIRA_RECORDINGS.items():
|
||||
with self.subTest(recording=name):
|
||||
self.assertEqual(hashlib.sha256(arrays[name]).hexdigest(), fingerprint)
|
||||
self.assertEqual(clips[name], (name, name, samples, 8000))
|
||||
|
||||
def assert_x1_only_recordings_are_guarded(self, source):
|
||||
start = source.index('#ifdef HAS_DRV2605')
|
||||
end = source.index('#endif', start)
|
||||
self.assertLess(source.index('restartingClip'), start)
|
||||
for name, _ in CATALOG[10:]:
|
||||
self.assertLess(start, source.index(name+'Data'))
|
||||
self.assertLess(source.index(name+'Clip'), end)
|
||||
|
||||
def test_changed_source_wav_replaces_only_its_matching_clip(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
self.fixtures(directory)
|
||||
output = directory / "selected.h"
|
||||
result = self.generate(directory, output)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
previous, previous_clips = parse_header(output.read_text(encoding="utf-8"))
|
||||
write_wav(directory / "ready.wav", [1000, -1000] * 16)
|
||||
result = self.generate(directory, output)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
current, current_clips = parse_header(output.read_text(encoding="utf-8"))
|
||||
self.assertNotEqual(current["ready"], previous["ready"])
|
||||
self.assertEqual(current_clips["ready"], ("ready", "ready", 32, 8000))
|
||||
for name, _ in CATALOG[1:]:
|
||||
self.assertEqual(current[name], previous[name])
|
||||
self.assertEqual(current_clips[name], previous_clips[name])
|
||||
|
||||
def test_empty_and_overlong_clips_do_not_replace_existing_header(self):
|
||||
for count in (0, 32001):
|
||||
with self.subTest(samples=count), tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
self.fixtures(directory)
|
||||
# A late failure must not leave a partially regenerated catalog.
|
||||
write_wav(directory / (CATALOG[-1][0] + ".wav"), [0] * count)
|
||||
output = directory / "selected.h"
|
||||
output.write_bytes(b"existing selected header\n")
|
||||
result = self.generate(directory, output)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("nonempty clip under four seconds", result.stderr)
|
||||
self.assertEqual(output.read_bytes(), b"existing selected header\n")
|
||||
|
||||
def test_four_second_boundary_is_accepted(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
self.fixtures(directory)
|
||||
write_wav(directory / "restarting.wav", [0] * 32000)
|
||||
output = directory / "boundary.h"
|
||||
result = self.generate(directory, output)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
arrays, clips = parse_header(output.read_text(encoding="utf-8"))
|
||||
self.assertEqual(len(arrays["restarting"]), 16000)
|
||||
self.assertEqual(clips["restarting"][2:], (32000, 8000))
|
||||
|
||||
def test_wrong_wav_formats_and_missing_catalog_clip_preserve_header(self):
|
||||
for format_options in ({"rate": 16000}, {"channels": 2}, {"width": 1}, None):
|
||||
with self.subTest(format=format_options), tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
self.fixtures(directory)
|
||||
wav = directory / "restarting.wav"
|
||||
if format_options is None:
|
||||
wav.unlink()
|
||||
else:
|
||||
write_wav(wav, [0] * 32, **format_options)
|
||||
output = directory / "selected.h"
|
||||
output.write_bytes(b"selected header\n")
|
||||
result = self.generate(directory, output)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
if format_options is not None:
|
||||
self.assertIn("Expected mono 16-bit PCM at 8000 Hz", result.stderr)
|
||||
self.assertEqual(output.read_bytes(), b"selected header\n")
|
||||
|
||||
def test_powershell_and_encoder_have_the_same_fixed_phrase_catalog(self):
|
||||
source = SYNTHESIZER.read_text(encoding="utf-8")
|
||||
body = source.split("$buttonPhrases = [ordered]@{", 1)[1].split("}", 1)[0]
|
||||
self.assertEqual(tuple(re.findall(r"(\w+) = '([^']+)'", body)), CATALOG)
|
||||
self.assertIn("[string]$Voice = 'Microsoft Zira Desktop'", source)
|
||||
self.assertIn("$buttonVoice.SelectVoice($Voice)", source)
|
||||
invocation = next(line for line in source.splitlines()
|
||||
if line.startswith('& python $buttonEncoder '))
|
||||
self.assertIn('--voice $Voice', invocation)
|
||||
self.assertIn("$buttonVoices -notcontains $Voice", source)
|
||||
self.assertIn("$buttonVoice.Rate = -1", source)
|
||||
self.assertIn("acompressor=threshold=0.08:ratio=6", source)
|
||||
self.assertIn("aresample=8000,alimiter=limit=0.12:level=disabled", source)
|
||||
|
||||
|
||||
@unittest.skipUnless(POWERSHELL, "PowerShell is needed for synthesis plan tests")
|
||||
class PlanTests(unittest.TestCase):
|
||||
def plan(self, directory=None, header=None, *arguments):
|
||||
targets = []
|
||||
if directory is not None:
|
||||
targets += ["-OutputDirectory", str(directory)]
|
||||
if header is not None:
|
||||
targets += ["-OutputHeader", str(header)]
|
||||
return subprocess.run(
|
||||
[POWERSHELL, "-NoProfile", "-NonInteractive", "-File", str(SYNTHESIZER),
|
||||
*targets, *arguments, "-WhatIf", "-Verbose"], cwd=ROOT, capture_output=True,
|
||||
text=True, timeout=30,
|
||||
)
|
||||
|
||||
def test_defaults_keep_zira_and_the_selected_production_header(self):
|
||||
result = self.plan()
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn("Synthesize and encode Microsoft Zira Desktop button confirmations", result.stdout)
|
||||
self.assertIn(str(ROOT / "src/helpers/ui/ButtonVoiceData.h"), result.stdout)
|
||||
|
||||
def test_whatif_creates_neither_audio_directory_nor_header_directory(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary) / "audio"
|
||||
header = Path(temporary) / "headers" / "button.h"
|
||||
result = self.plan(directory, header)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn("Synthesize and encode Microsoft Zira Desktop button confirmations", result.stdout)
|
||||
self.assertIn(str(header), result.stdout)
|
||||
self.assertFalse(directory.exists())
|
||||
self.assertFalse(header.parent.exists())
|
||||
|
||||
def test_whatif_does_not_overwrite_existing_header(self):
|
||||
for voice in ("Microsoft Mark", "Microsoft Zira Desktop"):
|
||||
with self.subTest(voice=voice), tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary) / "audio"
|
||||
header = Path(temporary) / "button.h"
|
||||
header.write_bytes(b"selected prerecorded catalog\n")
|
||||
result = self.plan(directory, header, "-Voice", voice)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn(f"Synthesize and encode {voice} button confirmations", result.stdout)
|
||||
self.assertEqual(header.read_bytes(), b"selected prerecorded catalog\n")
|
||||
self.assertFalse(directory.exists())
|
||||
|
||||
def test_onlymissing_whatif_preserves_existing_recordings_and_header(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
header = directory / "selected.h"
|
||||
recording = directory / "soundOff.wav"
|
||||
header.write_bytes(b"selected prerecorded catalog\n")
|
||||
write_wav(recording, [0, 1, -1, 2, -2])
|
||||
original = recording.read_bytes()
|
||||
result = self.plan(directory, header, "-OnlyMissing")
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(recording.read_bytes(), original)
|
||||
self.assertEqual(header.read_bytes(), b"selected prerecorded catalog\n")
|
||||
self.assertFalse((directory / "alertsSilent.wav").exists())
|
||||
|
||||
def test_mark_variant_with_explicit_header_plans_without_writes(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary) / "mark"
|
||||
header = Path(temporary) / "headers" / "mark.h"
|
||||
result = self.plan(directory, header, "-Voice", "Microsoft Mark")
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn("Synthesize and encode Microsoft Mark button confirmations", result.stdout)
|
||||
self.assertIn(str(header), result.stdout)
|
||||
self.assertFalse(directory.exists())
|
||||
self.assertFalse(header.parent.exists())
|
||||
|
||||
def test_non_default_voice_requires_an_explicit_header(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary) / "mark"
|
||||
result = self.plan(directory, None, "-Voice", "Microsoft Mark")
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("Voice variants require an explicit -OutputHeader", result.stderr)
|
||||
self.assertFalse(directory.exists())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,199 @@
|
||||
"""Run the production laboratory audio-preview dispatch without any hardware actions."""
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from test_radio_receive_contract import method
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
COMPILER = shutil.which("g++")
|
||||
SIGNATURE = "bool UITask::handleButtonAudioTest(const char* command, char* reply, size_t size)"
|
||||
|
||||
STUBS = r'''
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <helpers/ui/ButtonVoice.h>
|
||||
#define PIN_USER_BTN 6
|
||||
struct Button {
|
||||
unsigned calls=0;
|
||||
bool injectPresses(uint8_t,uint32_t){++calls;return true;}
|
||||
};
|
||||
struct Buzzer {
|
||||
bool quiet=true,playing=true,available=true;
|
||||
unsigned calls=0,status_calls=0,gain_calls=0;
|
||||
ButtonVoicePrompt last=ButtonVoicePrompt::Ready;
|
||||
bool allow_quiet=false;
|
||||
bool speakButton(ButtonVoicePrompt prompt,bool allowQuiet=false) {
|
||||
++calls;last=prompt;allow_quiet=allowQuiet;
|
||||
if(!available)return false;
|
||||
playing=true;return true;
|
||||
}
|
||||
bool voiceGain(unsigned){++gain_calls;return true;}
|
||||
void voiceStatus(char* reply,size_t size){++status_calls;snprintf(reply,size,"voice stub");}
|
||||
};
|
||||
struct UITask {
|
||||
Button button;
|
||||
Button* _userButton=&button;
|
||||
#ifdef PIN_BUZZER
|
||||
Buzzer buzzer;
|
||||
#endif
|
||||
#if defined(PIN_BUZZER) && MESH_GPS_VOICE
|
||||
bool _shutdown_pending=false;
|
||||
#endif
|
||||
// No button/action/persistence APIs exist in this fixture: preview code must
|
||||
// compile and execute without calling any of those real-world operations.
|
||||
unsigned settings_marker=12345;
|
||||
#ifdef MESH_BUTTON_AUDIO_HIL
|
||||
bool handleButtonAudioTest(const char* command,char* reply,size_t size);
|
||||
#endif
|
||||
};
|
||||
'''
|
||||
|
||||
ENABLED_MAIN = r'''
|
||||
int main(){
|
||||
UITask ui;char reply[180];
|
||||
struct Mapping {const char* name;ButtonVoicePrompt prompt;};
|
||||
const Mapping mappings[]={
|
||||
{"ready",ButtonVoicePrompt::Ready},
|
||||
{"notificationCleared",ButtonVoicePrompt::NotificationCleared},
|
||||
{"advertQueued",ButtonVoicePrompt::AdvertQueued},
|
||||
{"advertFailed",ButtonVoicePrompt::AdvertFailed},
|
||||
{"soundOn",ButtonVoicePrompt::SoundOn},
|
||||
{"soundOff",ButtonVoicePrompt::SoundOff},
|
||||
{"gpsOn",ButtonVoicePrompt::GpsOn},
|
||||
{"gpsOff",ButtonVoicePrompt::GpsOff},
|
||||
{"actionFailed",ButtonVoicePrompt::ActionFailed},
|
||||
{"usbSetup",ButtonVoicePrompt::UsbSetup},
|
||||
{"shuttingDown",ButtonVoicePrompt::ShuttingDown},
|
||||
{"restarting",ButtonVoicePrompt::Restarting},
|
||||
#ifdef HAS_DRV2605
|
||||
{"alertsSoundVibration",ButtonVoicePrompt::AlertsSoundVibration},
|
||||
{"alertsSoundOnly",ButtonVoicePrompt::AlertsSoundOnly},
|
||||
{"alertsVibrationOnly",ButtonVoicePrompt::AlertsVibrationOnly},
|
||||
{"alertsSilent",ButtonVoicePrompt::AlertsSilent},
|
||||
#endif
|
||||
};
|
||||
for(const auto& mapping:mappings){
|
||||
auto calls=ui.buzzer.calls;
|
||||
std::string command=std::string("hil voice play ")+mapping.name;
|
||||
assert(ui.handleButtonAudioTest(command.c_str(),reply,sizeof(reply)));
|
||||
assert(std::string(reply)==std::string("OK - preview only: ")+mapping.name);
|
||||
assert(ui.buzzer.calls==calls+1&&ui.buzzer.last==mapping.prompt);
|
||||
assert(ui.buzzer.allow_quiet&&ui.buzzer.quiet&&ui.buzzer.playing);
|
||||
assert(!ui._shutdown_pending&&ui.settings_marker==12345&&ui.button.calls==0);
|
||||
}
|
||||
#ifndef HAS_DRV2605
|
||||
// Other screenless boards omit the X1-only recordings and reject their
|
||||
// preview names before changing any currently playing confirmation.
|
||||
for(const char* name:{"alertsSoundVibration","alertsSoundOnly","alertsVibrationOnly","alertsSilent"}){
|
||||
auto calls=ui.buzzer.calls;auto last=ui.buzzer.last;
|
||||
std::string command=std::string("hil voice play ")+name;
|
||||
assert(ui.handleButtonAudioTest(command.c_str(),reply,sizeof(reply)));
|
||||
assert(std::string(reply)=="Error: unknown voice preview name");
|
||||
assert(ui.buzzer.calls==calls&&ui.buzzer.last==last&&ui.buzzer.playing);
|
||||
}
|
||||
#endif
|
||||
// Unknown/case-mismatched/extended names may not preempt active playback.
|
||||
for(const char* name:{"","unknown","Ready","soundOn extra","shuttingdown"}){
|
||||
auto calls=ui.buzzer.calls;auto last=ui.buzzer.last;
|
||||
std::string command=std::string("hil voice play ")+name;
|
||||
assert(ui.handleButtonAudioTest(command.c_str(),reply,sizeof(reply)));
|
||||
assert(std::string(reply)=="Error: unknown voice preview name");
|
||||
assert(ui.buzzer.calls==calls&&ui.buzzer.last==last&&ui.buzzer.playing);
|
||||
}
|
||||
ui._shutdown_pending=true;
|
||||
for(const auto& mapping:mappings){
|
||||
auto calls=ui.buzzer.calls;auto last=ui.buzzer.last;
|
||||
std::string command=std::string("hil voice play ")+mapping.name;
|
||||
assert(ui.handleButtonAudioTest(command.c_str(),reply,sizeof(reply)));
|
||||
assert(std::string(reply)=="Error: shutdown pending; preview refused");
|
||||
assert(ui.buzzer.calls==calls&&ui.buzzer.last==last&&ui.buzzer.playing);
|
||||
assert(ui._shutdown_pending&&ui.settings_marker==12345&&ui.button.calls==0);
|
||||
}
|
||||
ui._shutdown_pending=false;ui.buzzer.available=false;
|
||||
assert(ui.handleButtonAudioTest("hil voice play ready",reply,sizeof(reply)));
|
||||
assert(std::string(reply)=="Error: voice preview unavailable");
|
||||
assert(ui.buzzer.quiet&&!ui._shutdown_pending&&ui.settings_marker==12345);
|
||||
ui.buzzer.available=true;
|
||||
char tiny[12];memset(tiny,'x',sizeof(tiny));
|
||||
assert(ui.handleButtonAudioTest("hil voice play restarting",tiny,9));
|
||||
assert(tiny[8]==0&&tiny[9]=='x'&&tiny[10]=='x'&&tiny[11]=='x');
|
||||
char zero='x';
|
||||
assert(ui.handleButtonAudioTest("hil voice play ready",&zero,0)&&zero=='x');
|
||||
// Existing laboratory commands and unrelated command routing stay intact.
|
||||
assert(ui.handleButtonAudioTest("hil voice gain 8",reply,sizeof(reply)));
|
||||
assert(ui.buzzer.gain_calls==1&&std::string(reply)=="OK - speech gain 8");
|
||||
assert(ui.handleButtonAudioTest("hil voice status",reply,sizeof(reply)));
|
||||
assert(ui.buzzer.status_calls==1&&std::string(reply)=="voice stub");
|
||||
assert(!ui.handleButtonAudioTest("get gps",reply,sizeof(reply)));
|
||||
}
|
||||
'''
|
||||
|
||||
DISABLED_MAIN = r'''
|
||||
int main(){
|
||||
UITask ui;char reply[180];
|
||||
assert(ui.handleButtonAudioTest("hil voice play shuttingDown",reply,sizeof(reply)));
|
||||
assert(std::string(reply)=="Error: voice preview unsupported");
|
||||
assert(ui.settings_marker==12345&&ui.button.calls==0);
|
||||
#ifdef PIN_BUZZER
|
||||
assert(ui.buzzer.calls==0&&ui.buzzer.quiet&&ui.buzzer.playing);
|
||||
#endif
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
@unittest.skipUnless(COMPILER, "A native C++ compiler is needed for preview dispatch tests")
|
||||
class Tests(unittest.TestCase):
|
||||
def build(self, flags, main):
|
||||
source = (ROOT / "examples/companion_radio/ui-orig/UITask.cpp").read_text()
|
||||
handler = method(source, SIGNATURE)
|
||||
# Keep the actual production method's outer laboratory-only gate.
|
||||
start = source.index(SIGNATURE)
|
||||
self.assertEqual(source[:start].rstrip().splitlines()[-1], "#ifdef MESH_BUTTON_AUDIO_HIL")
|
||||
end = start + len(handler)
|
||||
self.assertTrue(source[end:].lstrip().startswith("#endif"))
|
||||
unit = (flags + STUBS + "\n#ifdef MESH_BUTTON_AUDIO_HIL\n"
|
||||
+ handler + "\n#endif\n" + main)
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
path = directory / "preview.cpp"
|
||||
binary = directory / "preview"
|
||||
path.write_text(unit)
|
||||
subprocess.run(
|
||||
[COMPILER, "-std=c++17", "-Wall", "-Wextra", "-Werror",
|
||||
"-I" + str(ROOT / "src"), str(path), "-o", str(binary)],
|
||||
check=True, timeout=30,
|
||||
)
|
||||
subprocess.run([str(binary)], check=True, timeout=30)
|
||||
|
||||
def test_all_prompt_previews_are_courtesy_audio_only_and_reject_preemption(self):
|
||||
self.build(
|
||||
"#include <initializer_list>\n#define MESH_BUTTON_AUDIO_HIL 1\n"
|
||||
"#define PIN_BUZZER 25\n#define HAS_DRV2605 1\n#define MESH_GPS_VOICE 1\n", ENABLED_MAIN)
|
||||
|
||||
def test_non_vibrating_board_omits_and_rejects_x1_only_mode_previews(self):
|
||||
self.build(
|
||||
"#include <initializer_list>\n#define MESH_BUTTON_AUDIO_HIL 1\n"
|
||||
"#define PIN_BUZZER 21\n#define MESH_GPS_VOICE 1\n", ENABLED_MAIN)
|
||||
|
||||
def test_voice_disabled_build_rejects_preview_without_preempting(self):
|
||||
self.build(
|
||||
"#define MESH_BUTTON_AUDIO_HIL 1\n#define PIN_BUZZER 25\n"
|
||||
"#define MESH_GPS_VOICE 0\n", DISABLED_MAIN)
|
||||
|
||||
def test_no_buzzer_build_rejects_preview(self):
|
||||
self.build("#define MESH_BUTTON_AUDIO_HIL 1\n#define MESH_GPS_VOICE 0\n", DISABLED_MAIN)
|
||||
|
||||
def test_production_build_has_no_preview_handler(self):
|
||||
self.build(
|
||||
"#define PIN_BUZZER 25\n#define MESH_GPS_VOICE 1\n",
|
||||
"int main(){UITask ui;assert(ui.settings_marker==12345);}\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,294 @@
|
||||
"""Exercise opt-in G.726 speech against independent FFmpeg MSB-packed vectors."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import struct
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import test_gps_voice_buttons as shared
|
||||
from test_button_voice_generator import ZIRA_RECORDINGS
|
||||
from test_gps_voice_generator import ZIRA_GPS_RECORDINGS
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
CC = shutil.which('gcc')
|
||||
CXX = shutil.which('g++')
|
||||
DECODER = ROOT / 'src/helpers/ui/g726/g726_decoder.c'
|
||||
SANITIZERS = (['-fsanitize=address,undefined', '-fno-omit-frame-pointer']
|
||||
if os.environ.get('MESH_G726_TEST_SANITIZERS') == '1' else [])
|
||||
|
||||
# FFmpeg 7.1 g726 encoder/decoder, 8 kHz mono, continuous MSB-first packing.
|
||||
# Input: 149 samples of int(23000*sin(i*.43)+7000*sin(i*1.97)). The reference
|
||||
# PCM below is pinned, not computed with the decoder being tested. Odd sample
|
||||
# counts exercise both cross-byte extraction and ignored final padding bits.
|
||||
VECTORS = {
|
||||
16: (
|
||||
'1555aaae557fafd05c2fa3d41cebf7170be8f4133aedc41ffaf1d70ee83113caf9c402fa3d00',
|
||||
(12,60,68,80,100,120,144,192,-152,-260,-460,-808,-1348,-2240,-1496,-3228,
|
||||
2668,6388,11088,18032,28296,3608,-2328,-5448,-17708,-30576,-21068,-16732,
|
||||
-13524,7960,9392,10368,19852,31136,7272,9872,9056,-11444,-11928,-10604,
|
||||
-19392,-31324,-7528,-9496,-9344,11660,29504,21868,17484,28932,6588,6040,
|
||||
-2032,-15800,-30028,-23620,-19428,-15560,8012,1476,7584,18856,30580,8036,
|
||||
11692,10804,-11724,-14448,-12284,-20856,32136,-8856,-9784,-9688,12472,
|
||||
15444,12360,21112,18280,4004,3612,-1752,-11740,-20788,-16104,-24696,
|
||||
-20612,7188,-204,8240,23980,20804,14996,23660,8108,-3212,-8576,-10660,
|
||||
-18848,-25496,-18976,-15376,-5852,10232,7664,20152,-32364,13088,10528,
|
||||
10836,-900,-16984,-15196,-22620,28652,-15884,1424,-152,8760,23344,17788,
|
||||
21364,20676,8416,-2200,-2692,-13772,-24704,-19472,-14280,-21680,4836,
|
||||
4692,9024,25744,25352,17892,15096,11768,-7900,-14896,-14800,-21052,
|
||||
-29392,-11948,-6336,-6580,11280,18152),
|
||||
),
|
||||
24: (
|
||||
'edb6db92493e6d25ef976a976b93679bfcd7677f2fb972d7467d37a512cf3a6d39a9f2bd367d4aed72adf29d93e96e65f6afdae8dda5f732',
|
||||
(0,60,76,92,108,132,180,252,-272,-476,-908,-1840,-3640,-7076,-1780,-3756,
|
||||
6724,16012,19764,21560,22432,8192,-8500,-3184,-18772,-24144,-17696,
|
||||
-14340,-18324,4024,13468,6724,19724,25136,11348,10740,9836,-5588,
|
||||
-19216,-9292,-28780,-23492,-10576,-4544,-6324,13428,24408,12108,27792,
|
||||
23912,2564,-912,-1384,-18568,-27700,-13868,-18952,-17316,3560,5296,
|
||||
7024,18520,25224,12844,15316,13484,-10176,-10292,-11676,-26980,-26004,
|
||||
-12020,-16696,-4148,14284,17648,15116,22948,21032,8440,5108,-2084,
|
||||
-17480,-21536,-18780,-25992,-16528,2392,-3592,9136,29948,21828,17336,
|
||||
23512,13388,-9504,-7892,-12828,-27144,-19100,-13100,-17900,-5200,
|
||||
11896,11460,20468,30592,19264,10800,12696,-3676,-18696,-14372,-20972,
|
||||
-30060,-11752,-3936,-5604,8180,25072,17120,19576,26832,9028,-3872,
|
||||
-1548,-15656,-28576,-16560,-15880,-21400,204,9884,6276,17700,27396,
|
||||
14016,12568,13016,-5332,-15028,-13156,-20244,-25892,-13184,-9964,
|
||||
-9684,11280,23016),
|
||||
),
|
||||
}
|
||||
|
||||
PREAMBLE = r'''
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <initializer_list>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
#include <helpers/ui/GpsVoice.h>
|
||||
#define PIN_BUZZER 25
|
||||
#include <helpers/ui/nrf52/GpsVoicePlayer.h>
|
||||
uint32_t now_ms=0;
|
||||
using namespace mesh::audio;
|
||||
'''
|
||||
|
||||
DECODE_MAIN = r'''
|
||||
int main(){
|
||||
constexpr auto codec=VoiceCodec::G726@RATE@;
|
||||
constexpr unsigned bits=@BITS@;
|
||||
const uint8_t data[]={@DATA@};
|
||||
const int16_t expected[]={@PCM@};
|
||||
constexpr unsigned count=sizeof(expected)/sizeof(expected[0]);
|
||||
const VoiceClip full{data,sizeof(data),count,8000,codec};
|
||||
assert(full.valid()&&full.bits()==bits);
|
||||
assert(full.requiredBytes(count)==sizeof(data));
|
||||
VoiceDecoder decoder;
|
||||
auto check=[&](VoiceClip clip,unsigned samples){
|
||||
decoder.begin(clip);assert(decoder.position()==0);
|
||||
for(unsigned i=0;i<samples;++i){assert(!decoder.done());assert(decoder.next()==expected[i]);}
|
||||
assert(decoder.done()&&decoder.position()==samples);
|
||||
for(unsigned i=0;i<8;++i)assert(decoder.next()==0&&decoder.position()==samples);
|
||||
};
|
||||
// Each clip resets adaptive state, including after partial playback.
|
||||
for(unsigned repetition=0;repetition<3;++repetition){
|
||||
check(full,count);decoder.begin(full);decoder.next();check(full,count);
|
||||
}
|
||||
for(unsigned n:{1u,2u,3u,4u,5u,7u,8u,9u,31u,32u,33u,63u,64u,65u,count}){
|
||||
VoiceClip short_clip{data,full.requiredBytes(n),n,8000,codec};
|
||||
assert(short_clip.valid());check(short_clip,n);
|
||||
}
|
||||
std::vector<uint8_t> padding(data,data+sizeof(data));
|
||||
const unsigned unused=(8-(count*bits)%8)%8;
|
||||
assert(unused);padding.back()^=(1u<<unused)-1;
|
||||
check({padding.data(),padding.size(),count,8000,codec},count);
|
||||
// Truncated metadata may decode only complete codes; it never reads padding
|
||||
// or a second byte beyond the declared span when a 3-bit code straddles it.
|
||||
for(size_t bytes=0;bytes<sizeof(data);++bytes){
|
||||
std::vector<uint8_t> bounded(data,data+bytes);
|
||||
VoiceClip short_clip{bounded.data(),bytes,count,8000,codec};
|
||||
assert(!short_clip.valid());check(short_clip,static_cast<unsigned>(bytes*8/bits));
|
||||
}
|
||||
check({nullptr,sizeof(data),count,8000,codec},0);
|
||||
check({data,sizeof(data),0,8000,codec},0);
|
||||
check({data,0,count,8000,codec},0);
|
||||
VoiceClip huge{data,sizeof(data)-1,std::numeric_limits<uint32_t>::max(),8000,codec};
|
||||
assert(!huge.valid());check(huge,static_cast<unsigned>((sizeof(data)-1)*8/bits));
|
||||
VoiceClip all_bytes{data,std::numeric_limits<size_t>::max(),
|
||||
std::numeric_limits<uint32_t>::max(),8000,codec};
|
||||
assert(all_bytes.requiredBytes(all_bytes.samples)==
|
||||
(static_cast<uint64_t>(all_bytes.samples)*bits+7)/8);
|
||||
assert(all_bytes.valid()); // Validation only: actual pointer length is caller-owned.
|
||||
auto other=codec==VoiceCodec::G72616?VoiceCodec::G72624:VoiceCodec::G72616;
|
||||
for(auto invalid:{other,static_cast<VoiceCodec>(255)}){
|
||||
VoiceClip bad{data,sizeof(data),count,8000,invalid};
|
||||
assert(!bad.valid());check(bad,0);
|
||||
}
|
||||
assert(!VoiceClip(data,sizeof(data),count,16000,codec).valid());
|
||||
// IMA remains selectable in an experiment, with its original 4-argument API.
|
||||
const uint8_t ima[]={0x77};
|
||||
VoiceClip original{ima,sizeof(ima),2};assert(original.codec==VoiceCodec::Ima&&original.valid());
|
||||
decoder.begin(original);assert(decoder.next()==11&&decoder.next()==41&&decoder.done());
|
||||
check(full,count);decoder.begin(original);assert(decoder.next()==11);
|
||||
}
|
||||
'''
|
||||
|
||||
PLAYER_MAIN = r'''
|
||||
int main(){
|
||||
constexpr auto codec=VoiceCodec::G726@RATE@;
|
||||
const uint8_t data[]={@DATA@};
|
||||
const int16_t expected[]={@PCM@};
|
||||
constexpr unsigned count=sizeof(expected)/sizeof(expected[0]);
|
||||
GpsVoicePlayer player;
|
||||
assert(player.setGain(2));
|
||||
for(unsigned n:{1u,3u,31u,32u,33u,63u,64u,65u,count}){
|
||||
VoiceClip clip{data,sizeof(data),n,8000,codec};
|
||||
assert(player.start(clip)&&player.active()&&player.playing());
|
||||
assert(HwPWM3.owned&&HwPWM3.bound_pin==PIN_BUZZER&&irq_enabled);
|
||||
assert(registers.COUNTERTOP==500&®isters.SEQ[0].REFRESH==0);
|
||||
VoiceDecoder reference;reference.begin(clip);
|
||||
VoiceInterpolator reconstruction;reconstruction.begin();
|
||||
for(unsigned i=0;i<2;++i){
|
||||
auto values=reinterpret_cast<const uint16_t*>(registers.SEQ[i].PTR);
|
||||
assert(registers.SEQ[i].CNT==128);
|
||||
for(unsigned j=0;j<128;++j){
|
||||
int32_t pcm=reconstruction.next(reference)*2;
|
||||
if(pcm>32767)pcm=32767;
|
||||
if(pcm < -32768)pcm=-32768;
|
||||
assert(values[j]==(0x8000|static_cast<uint16_t>((pcm+32768)*500/65536)));
|
||||
}
|
||||
}
|
||||
unsigned sequence=0,events=0;
|
||||
while(player.playing()){
|
||||
assert(++events<100);registers.EVENTS_SEQEND[sequence]=1;player.interrupt();sequence^=1;
|
||||
}
|
||||
assert(player.played()==n&&events==(n*4+127)/128&&player.active());
|
||||
player.service();assert(!player.active()&&!HwPWM3.owned&&!HwPWM3.pin&&!irq_enabled);
|
||||
assert(!registers.ENABLE&&pin_states[PIN_BUZZER]==LOW);
|
||||
}
|
||||
assert(player.started()==9&&player.completed()==9&&player.cancelled()==0);
|
||||
VoiceClip full{data,sizeof(data),count,8000,codec};
|
||||
assert(player.start(full));player.stop();
|
||||
assert(player.cancelled()==1&&!HwPWM3.owned&&!irq_enabled);
|
||||
assert(!player.start({data,sizeof(data)-1,count,8000,codec}));
|
||||
assert(!player.start({data,sizeof(data),count,16000,codec}));
|
||||
assert(!player.start({nullptr,sizeof(data),count,8000,codec}));
|
||||
assert(!player.start({data,sizeof(data),0,8000,codec}));
|
||||
assert(!player.start({data,sizeof(data),count,8000,static_cast<VoiceCodec>(255)}));
|
||||
auto other=codec==VoiceCodec::G72616?VoiceCodec::G72624:VoiceCodec::G72616;
|
||||
assert(!player.start({data,sizeof(data),count,8000,other}));
|
||||
HwPWM3.reject=true;assert(!player.start(full));
|
||||
assert(!player.active()&&!HwPWM3.owned&&!irq_enabled&&!registers.ENABLE);
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
@unittest.skipUnless(CC and CXX, 'Native C and C++ compilers are required')
|
||||
class Tests(unittest.TestCase):
|
||||
def build(self, source, bitrate, *, run=True, expected_error=None):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory=Path(temporary)
|
||||
(directory/'Arduino.h').write_text(shared.ARDUINO)
|
||||
(directory/'HardwarePWM.h').write_text(shared.PWM)
|
||||
(directory/'NonBlockingRtttl.h').write_text(shared.RTTTL)
|
||||
path=directory/'test.cpp';path.write_text(source)
|
||||
binary=directory/'test'
|
||||
flags=[] if bitrate is None else [f'-DMESH_GPS_VOICE_G726_BITRATE={bitrate}',
|
||||
'-DMESH_BUTTON_AUDIO_HIL=1']
|
||||
if expected_error is not None:
|
||||
result=subprocess.run([CXX,'-std=c++17','-I'+str(ROOT/'src'),
|
||||
'-c',str(path),'-o',str(directory/'gate.o')],
|
||||
capture_output=True,text=True,timeout=30)
|
||||
self.assertNotEqual(result.returncode,0)
|
||||
self.assertIn(expected_error,result.stderr)
|
||||
return
|
||||
objects=[]
|
||||
if bitrate is not None:
|
||||
obj=directory/'decoder.o'
|
||||
subprocess.run([CC,'-std=c99','-Wall','-Wextra','-Werror',*SANITIZERS,*flags,
|
||||
'-I'+str(ROOT/'src'),'-c',str(DECODER),'-o',str(obj)],
|
||||
check=True,timeout=30)
|
||||
objects.append(str(obj))
|
||||
subprocess.run([CXX,'-std=c++17','-Wall','-Wextra','-Werror',*SANITIZERS,*flags,
|
||||
'-I'+str(directory),'-I'+str(ROOT/'src'),'-I'+str(ROOT),
|
||||
str(path),*objects,'-o',str(binary)],check=True,timeout=30)
|
||||
if run:subprocess.run([str(binary)],check=True,timeout=30)
|
||||
|
||||
def fixture(self, source, bitrate):
|
||||
data,pcm=VECTORS[bitrate]
|
||||
return (PREAMBLE+source.replace('@RATE@',str(bitrate))
|
||||
.replace('@BITS@',str(bitrate//8))
|
||||
.replace('@DATA@',','.join('0x'+data[i:i+2] for i in range(0,len(data),2)))
|
||||
.replace('@PCM@',','.join(map(str,pcm))))
|
||||
|
||||
def test_msb_reference_vectors_reset_padding_odd_lengths_and_bounds(self):
|
||||
for bitrate in VECTORS:
|
||||
with self.subTest(bitrate=bitrate):self.build(self.fixture(DECODE_MAIN,bitrate),bitrate)
|
||||
|
||||
def test_g726_shares_existing_pwm_interpolation_and_dma_lifecycle(self):
|
||||
for bitrate in VECTORS:
|
||||
with self.subTest(bitrate=bitrate):self.build(self.fixture(PLAYER_MAIN,bitrate),bitrate)
|
||||
|
||||
def test_invalid_bitrates_or_missing_laboratory_gate_cannot_compile(self):
|
||||
for flags,error in (
|
||||
('#define MESH_GPS_VOICE_G726_BITRATE 16\n','opt-in MESH_BUTTON_AUDIO_HIL'),
|
||||
('#define MESH_BUTTON_AUDIO_HIL 0\n#define MESH_GPS_VOICE_G726_BITRATE 24\n',
|
||||
'opt-in MESH_BUTTON_AUDIO_HIL'),
|
||||
*[(f'#define MESH_BUTTON_AUDIO_HIL 1\n#define MESH_GPS_VOICE_G726_BITRATE {rate}\n',
|
||||
'bitrate must be 16 or 24') for rate in (0,8,32,40)],
|
||||
):
|
||||
with self.subTest(flags=flags):
|
||||
self.build(flags+'#include <helpers/ui/GpsVoice.h>\n',None,expected_error=error)
|
||||
|
||||
def test_default_ima_has_no_experimental_decoder_dependency(self):
|
||||
self.build(PREAMBLE+r'''
|
||||
int main(){
|
||||
const uint8_t data[]={0x77};VoiceClip clip{data,sizeof(data),2};
|
||||
VoiceDecoder decoder;decoder.begin(clip);
|
||||
assert(decoder.next()==11&&decoder.next()==41&&decoder.done());
|
||||
}
|
||||
''',None)
|
||||
|
||||
|
||||
REFERENCE_DIR = Path(os.environ.get('G726_REFERENCE_DIR',
|
||||
str(ROOT/'out/gps-voice/g726-test')))
|
||||
|
||||
|
||||
@unittest.skipUnless(CC and CXX and (REFERENCE_DIR/'report.json').is_file(),
|
||||
'Optional independently decoded voice-catalog fixtures are unavailable')
|
||||
class LocalVoiceCatalogTests(unittest.TestCase):
|
||||
build = Tests.build
|
||||
|
||||
def test_all_32_actual_zira_g726_recordings_match_independent_ffmpeg_pcm(self):
|
||||
report=json.loads((REFERENCE_DIR/'report.json').read_text(encoding='utf-8'))
|
||||
expected_samples={name:recording[1] for name,recording in
|
||||
{**ZIRA_RECORDINGS,**ZIRA_GPS_RECORDINGS}.items()}
|
||||
self.assertEqual({clip['clip'] for clip in report['clips']}, set(expected_samples))
|
||||
for bitrate in (16,24):
|
||||
statements=[]
|
||||
for clip in report['clips']:
|
||||
name=clip['clip'];samples=clip['samples']
|
||||
self.assertEqual(samples,expected_samples[name])
|
||||
data=(REFERENCE_DIR/f'{name}.g726{bitrate}.be').read_bytes()
|
||||
pcm_bytes=(REFERENCE_DIR/f'{name}.g726{bitrate}.decoded8k.s16le').read_bytes()
|
||||
self.assertEqual(len(data),(samples*(bitrate//8)+7)//8)
|
||||
self.assertEqual(len(pcm_bytes),samples*2)
|
||||
self.assertEqual(hashlib.sha256(data).hexdigest(),
|
||||
clip['codecs'][f'g726{bitrate}']['payload_sha256'])
|
||||
pcm=struct.unpack(f'<{samples}h',pcm_bytes)
|
||||
statements.append('''{
|
||||
const uint8_t data[]={'''+','.join(map(str,data))+'''};
|
||||
const int16_t expected[]={'''+','.join(map(str,pcm))+'''};
|
||||
VoiceClip clip{data,sizeof(data),'''+str(samples)+''',8000,VoiceCodec::G726'''+str(bitrate)+'''};
|
||||
assert(clip.valid());VoiceDecoder decoder;decoder.begin(clip);
|
||||
for(unsigned i=0;i<clip.samples;++i){assert(!decoder.done());assert(decoder.next()==expected[i]);}
|
||||
assert(decoder.done()&&decoder.position()==clip.samples&&decoder.next()==0);
|
||||
}
|
||||
''')
|
||||
with self.subTest(bitrate=bitrate):
|
||||
self.build(PREAMBLE+'int main(){\n'+''.join(statements)+'}\n',bitrate)
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,199 @@
|
||||
"""Validate the experimental G.726 catalog without FFmpeg or speech synthesis."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import io
|
||||
import importlib.util
|
||||
import re
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from types import SimpleNamespace
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from test_button_voice_generator import CATALOG, ZIRA_RECORDINGS
|
||||
from test_gps_voice_generator import ZIRA_GPS_RECORDINGS
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SCRIPT = ROOT/'scripts/generate_g726_voice.py'
|
||||
sys.path.insert(0,str(ROOT/'scripts'))
|
||||
try:
|
||||
spec=importlib.util.spec_from_file_location('g726_generator_under_test',SCRIPT)
|
||||
generator=importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(generator)
|
||||
finally:
|
||||
sys.path.remove(str(ROOT/'scripts'))
|
||||
|
||||
# Independent FFmpeg reference payloads from approved Zira WAVs; fixed here
|
||||
# rather than inferred from the generated header being tested. Tuple order is
|
||||
# 16 kbps then 24 kbps, always raw MSB-first g726, not g726le.
|
||||
GOLDENS = {
|
||||
'actionFailed': ('33663298be60ec0e2add5ebde561e69e503f222a0ab8c37323498eb1d1714365', '7e5e12f8372c473055bd07e169b3438c6f816dd68f0cd1b3ef09048f6fe51afc'),
|
||||
'advertFailed': ('135d7e4ca80bcc34c02f51d72220aa17f4fc75f0d23fdac3f7eb46c53b2ecdc1', '92ce6a28b2daca7754f2b845320da0520fab447fdff46ac89ff59d283b5f28a6'),
|
||||
'advertQueued': ('6f0820ccb7823100f9ad0987f45c82db1b80eb2ab3cbefdd5ebff223e59bf94b', '776a6c07f48cae3f9038f811585d1d99da35f2c203333556ad4dd9b72b9e30da'),
|
||||
'alertsSilent': ('3392d2847dfcbdc8a3851653a777e32eedbd748b0588fbb1e8af8bbc75f78516', 'f01749532c1edba71079594f58dca6888cc37b9ac3cb9ec9ec12ffd813834a69'),
|
||||
'alertsSoundOnly': ('1488c87772a6868b621eed3144ec46e2bda551265919cd5dd881f2640628096a', '801e8c93c52d6b219557aaff305ccdbd3c59caa5dc4bce4a1f41cc90c08b5da9'),
|
||||
'alertsSoundVibration': ('90506e3b6d2626021f34c93337bb4460b77360547dbd51b821c24b23e84c2634', '4255e55a8e6be96ac8da1e8b36476896f758b27db3f88bef045f0af180f7edf8'),
|
||||
'alertsVibrationOnly': ('b4e62f14ddb4c1f6783018feeae3a732bd97e73275659d4106b4ad4eca83ac70', '9ea16e3f209a544d86bab44bc36bb811d79630134fa1ccc455a68ff06edde980'),
|
||||
'notificationCleared': ('734d1eaa542201c3138962647672f076a317bef044bf25ead2c4648797ed6550', '867ef876f2804b8d2767afddd9f7d922c129e6f47dfbe08d4ed5966ae6d3d24b'),
|
||||
'ready': ('2a266c9f56176376eb2322a2b72e4df868a35926f4b520e13acf337e792534e3', '8eaa38100aa5a482ad72504ce40995979de45843794ffd198b2d1685089e17be'),
|
||||
'restarting': ('9c204820af9bb40de30edac13bea43249884ba82753b9f6706b311abd9a93786', '2a6f1c6fcbaa26a12c9381f5ace6c7cda68f89ed7651dc506fff27d8a41aeae6'),
|
||||
'shuttingDown': ('cef5b599fa81aef97459becae5e2b8e85287f153a7b5d6c5467959ee8facc130', '11fde2f8561194d823252cf957f044dc24900ebdb0debb0dae83d043b81ee627'),
|
||||
'soundOff': ('20a8242182bead0359ea4920c99963ce324285a4e1d28bfcb3d8324d10d7e8c4', 'ccbf34a368af7d89892c96b8b8b59361e7671e717354d41c3c365c011a5a1261'),
|
||||
'soundOn': ('e346e20ea7e69b5f40f39235d57d9e5805353a4a7abbf52800f46a9670d25fd1', '4a5f531ce35dafdd1c7735bb3d67018bae73c724cce1bf8fc0dba10a15b4d201'),
|
||||
'usbSetup': ('fe99f1b81aff17db4afd6c1b9f21e70a78e983bdf1b61de99bb5ff90f01cda75', 'a714e239ebc3c2c373f246a627334db974b6d197e096e1025d10748e01f40498'),
|
||||
'gpsOff': ('2d85181600ccd769a2be90393244cbd31ca8bdc3f0a919c8f24be6ed6b1792e2', 'c7ca2f32062ce0f16531d1e11c42faba2e3486b609a96c5160d0ab7d87917587'),
|
||||
'gpsOn': ('8d198c025d6bc123e59d890a718835f27c75bf404f5c5288bbf08780e514aff0', 'fc44dccf32f0fb94a4d3b8b4b114eea19c5210e515d3b300fce847e5fc788b4a'),
|
||||
}
|
||||
|
||||
|
||||
class EncodeTests(unittest.TestCase):
|
||||
def test_encoder_uses_exact_msb_first_ffmpeg_command_pcm_and_ceil_length(self):
|
||||
for bitrate in (16,24):
|
||||
for samples in ([0,-1,1], [32767,-32768,0,127,-128,1024,-1024,7,-7]):
|
||||
with self.subTest(bitrate=bitrate,samples=len(samples)):
|
||||
size=(len(samples)*(bitrate//8)+7)//8
|
||||
payload=bytes(range(size))
|
||||
with mock.patch.object(generator.subprocess,'run',
|
||||
return_value=SimpleNamespace(stdout=payload)) as run:
|
||||
self.assertEqual(generator.encode(samples,bitrate,'chosen-ffmpeg'),payload)
|
||||
self.assertEqual(run.call_args.args[0],[
|
||||
'chosen-ffmpeg','-hide_banner','-loglevel','error','-f','s16le',
|
||||
'-ar','8000','-ac','1','-i','pipe:0','-c:a','g726',
|
||||
'-b:a',str(bitrate*1000),'-f','g726','pipe:1'])
|
||||
self.assertEqual(run.call_args.kwargs['input'],
|
||||
struct.pack('<'+'h'*len(samples),*samples))
|
||||
self.assertTrue(run.call_args.kwargs['check'])
|
||||
self.assertEqual(run.call_args.kwargs['stdout'],subprocess.PIPE)
|
||||
self.assertEqual(run.call_args.kwargs['stderr'],subprocess.PIPE)
|
||||
|
||||
def test_bad_bitrates_are_rejected_before_spawning_ffmpeg(self):
|
||||
for bitrate in (-1,0,8,32,40,None,'16'):
|
||||
with self.subTest(bitrate=bitrate), mock.patch.object(generator.subprocess,'run') as run:
|
||||
with self.assertRaisesRegex(ValueError,'bitrate must be 16 or 24'):
|
||||
generator.encode([0,1,-1],bitrate)
|
||||
run.assert_not_called()
|
||||
|
||||
def test_short_long_ffmpeg_output_and_failed_process_are_rejected(self):
|
||||
for bitrate in (16,24):
|
||||
expected=(5*(bitrate//8)+7)//8
|
||||
for length in (expected-1,expected+1):
|
||||
with self.subTest(bitrate=bitrate,length=length):
|
||||
with mock.patch.object(generator.subprocess,'run',
|
||||
return_value=SimpleNamespace(stdout=bytes(length))):
|
||||
with self.assertRaisesRegex(ValueError,f'expected {expected} bytes, got {length}'):
|
||||
generator.encode([0]*5,bitrate)
|
||||
with mock.patch.object(generator.subprocess,'run',
|
||||
side_effect=subprocess.CalledProcessError(1,['ffmpeg'])):
|
||||
with self.assertRaises(subprocess.CalledProcessError):generator.encode([0],16)
|
||||
|
||||
|
||||
class CatalogTests(unittest.TestCase):
|
||||
def test_mock_generation_emits_both_bitrate_catalogs_and_exact_source_lengths(self):
|
||||
names=tuple(name for name,_ in CATALOG)+('gpsOn','gpsOff')
|
||||
source_samples={name:[index]*((index+1)*3) for index,name in enumerate(names)}
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory=Path(temporary);output=directory/'generated.h'
|
||||
arguments=self.argv(directory,output,'Microsoft Zira Desktop')
|
||||
def read(path):
|
||||
name={'missing-on.wav':'gpsOn','missing-off.wav':'gpsOff'}.get(path.name,path.stem)
|
||||
return source_samples[name]
|
||||
def encode(samples,bitrate,ffmpeg):
|
||||
self.assertEqual(ffmpeg,'ffmpeg')
|
||||
return bytes([bitrate])*((len(samples)*(bitrate//8)+7)//8)
|
||||
with mock.patch.object(sys,'argv',arguments), mock.patch.object(generator,'read',side_effect=read), \
|
||||
mock.patch.object(generator,'encode',side_effect=encode) as encoder, \
|
||||
mock.patch.object(sys,'stdout',io.StringIO()):
|
||||
generator.main()
|
||||
self.assertEqual(encoder.call_count,32)
|
||||
source=output.read_text(encoding='utf-8')
|
||||
for bitrate in (16,24):
|
||||
body=source.split(f'#if MESH_GPS_VOICE_G726_BITRATE == {bitrate}\n',1)[1]
|
||||
body=body.split(f'#endif // {bitrate} kbps',1)[0]
|
||||
for name in names:
|
||||
count=len(source_samples[name])
|
||||
self.assertIn(f'{name}Data, sizeof({name}Data), {count}, 8000, VoiceCodec::G726{bitrate}',body)
|
||||
self.assertEqual(body.count('#ifdef HAS_DRV2605'),4)
|
||||
self.assertEqual(body.count('#endif // HAS_DRV2605'),4)
|
||||
|
||||
def test_invalid_source_lengths_preserve_existing_experimental_header(self):
|
||||
for count in (0,32001):
|
||||
with self.subTest(samples=count), tempfile.TemporaryDirectory() as temporary:
|
||||
directory=Path(temporary);output=directory/'generated.h'
|
||||
output.write_bytes(b'existing experiment\n')
|
||||
def read(path):return [0]*count if path.name=='missing-off.wav' else [0,1,-1]
|
||||
with mock.patch.object(sys,'argv',self.argv(directory,output,'Microsoft Zira Desktop')), \
|
||||
mock.patch.object(generator,'read',side_effect=read), \
|
||||
mock.patch.object(generator,'encode') as encoder:
|
||||
with self.assertRaisesRegex(ValueError,'nonempty clip under four seconds'):
|
||||
generator.main()
|
||||
encoder.assert_not_called()
|
||||
self.assertEqual(output.read_bytes(),b'existing experiment\n')
|
||||
|
||||
def test_generated_16_and_24_catalogs_match_independent_zira_reference_hashes_and_lengths(self):
|
||||
source=(ROOT/'src/helpers/ui/G726VoiceData.h').read_text(encoding='utf-8')
|
||||
self.assertIn('// Voice: Microsoft Zira Desktop. 8 kHz mono, MSB-first raw G.726',source)
|
||||
self.assertIn('EXPERIMENT ONLY',source)
|
||||
self.assertIn('#if !defined(MESH_GPS_VOICE_G726_BITRATE)',source)
|
||||
names=tuple(name for name,_ in CATALOG)+('gpsOn','gpsOff')
|
||||
samples={name:value[1] for name,value in {**ZIRA_RECORDINGS,**ZIRA_GPS_RECORDINGS}.items()}
|
||||
self.assertEqual(set(names),set(GOLDENS))
|
||||
for index,bitrate in enumerate((16,24)):
|
||||
with self.subTest(bitrate=bitrate):
|
||||
body=source.split(f'#if MESH_GPS_VOICE_G726_BITRATE == {bitrate}\n',1)[1]
|
||||
body=body.split(f'#endif // {bitrate} kbps',1)[0]
|
||||
arrays={name:bytes(int(value,16) for value in re.findall(r'0x([0-9a-fA-F]{2})',data))
|
||||
for name,data in re.findall(r'static const uint8_t (\w+)Data\[\] = \{(.*?)\};',body,re.S)}
|
||||
clips={name:(data,size,int(count),int(rate),int(codec))
|
||||
for name,data,size,count,rate,codec in re.findall(
|
||||
r'static constexpr VoiceClip (\w+)Clip = \{\s*'
|
||||
r'(\w+)Data, sizeof\((\w+)Data\), (\d+), (\d+), VoiceCodec::G726(\d+)\s*\};',body)}
|
||||
self.assertEqual(tuple(arrays),names)
|
||||
self.assertEqual(tuple(clips),names)
|
||||
for name in names:
|
||||
self.assertEqual(clips[name],(name,name,samples[name],8000,bitrate))
|
||||
self.assertEqual(len(arrays[name]),(samples[name]*(bitrate//8)+7)//8)
|
||||
self.assertEqual(hashlib.sha256(arrays[name]).hexdigest(),GOLDENS[name][index],name)
|
||||
# Each optional mode must be inside a HAS_DRV2605 guard; the
|
||||
# common twelve clips must remain outside those guards.
|
||||
guarded=False
|
||||
for line in body.splitlines():
|
||||
if line=='#ifdef HAS_DRV2605':
|
||||
self.assertFalse(guarded);guarded=True
|
||||
elif line=='#endif // HAS_DRV2605':
|
||||
self.assertTrue(guarded);guarded=False
|
||||
else:
|
||||
match=re.match(r'static const uint8_t (\w+)Data',line)
|
||||
if match:self.assertEqual(guarded,match[1].startswith('alerts'),match[1])
|
||||
self.assertFalse(guarded)
|
||||
|
||||
def test_cli_refuses_production_filenames_and_invalid_voice_without_touching_existing_files(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory=Path(temporary)
|
||||
for name in ('ButtonVoiceData.h','GpsVoiceData.h','buttonvoicedata.h','GPSVOICEDATA.H'):
|
||||
with self.subTest(name=name):
|
||||
target=directory/name;target.write_bytes(b'existing selected IMA audio\n')
|
||||
result=self.cli(directory,target,'Microsoft Zira Desktop')
|
||||
self.assertNotEqual(result.returncode,0)
|
||||
self.assertIn('must not overwrite production IMA headers',result.stderr)
|
||||
self.assertEqual(target.read_bytes(),b'existing selected IMA audio\n')
|
||||
for voice in ('',' ','name\nsecondline','name\rsecondline'):
|
||||
with self.subTest(voice=voice):
|
||||
target=directory/'experimental.h';target.write_bytes(b'existing experiment\n')
|
||||
result=self.cli(directory,target,voice)
|
||||
self.assertNotEqual(result.returncode,0)
|
||||
self.assertIn('nonempty single-line label',result.stderr)
|
||||
self.assertEqual(target.read_bytes(),b'existing experiment\n')
|
||||
|
||||
def cli(self,directory,output,voice):
|
||||
return subprocess.run([sys.executable,*self.argv(directory,output,voice)],
|
||||
capture_output=True,text=True,timeout=30)
|
||||
|
||||
def argv(self,directory,output,voice):
|
||||
return [str(SCRIPT),'--directory',str(directory/'missing-catalog'),
|
||||
'--on',str(directory/'missing-on.wav'),'--off',str(directory/'missing-off.wav'),
|
||||
'--output',str(output),'--voice',voice]
|
||||
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
@@ -0,0 +1,569 @@
|
||||
"""Exercise the production speech decoder/player and screenless button actions."""
|
||||
from pathlib import Path
|
||||
import cmath
|
||||
import math
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from test_radio_receive_contract import method
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
ARDUINO = r'''
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#define LOW 0
|
||||
#define HIGH 1
|
||||
#define OUTPUT 1
|
||||
extern uint32_t now_ms;
|
||||
inline uint32_t millis(){return now_ms;}
|
||||
inline int digitalRead(int){return LOW;}
|
||||
inline int analogRead(int){return 0;}
|
||||
inline int pin_states[64]={};
|
||||
inline unsigned pin_writes[64]={};
|
||||
inline void digitalWrite(int pin,int value){pin_states[pin]=value;++pin_writes[pin];}
|
||||
inline void pinMode(int,int){}
|
||||
'''
|
||||
|
||||
RTTTL = r'''
|
||||
#pragma once
|
||||
#include <string>
|
||||
namespace rtttl {
|
||||
static bool running=false;
|
||||
static std::string melody;
|
||||
static unsigned begins=0;
|
||||
inline void begin(int,const char* song){melody=song;running=true;++begins;}
|
||||
inline void stop(){running=false;}
|
||||
inline bool done(){return !running;}
|
||||
inline bool isPlaying(){return running;}
|
||||
inline void play(){}
|
||||
inline void finish(){running=false;}
|
||||
}
|
||||
'''
|
||||
|
||||
PWM = r'''
|
||||
#pragma once
|
||||
struct Sequence { uintptr_t PTR=0;uint32_t CNT=0,REFRESH=0,ENDDELAY=0; };
|
||||
struct Registers {
|
||||
uint32_t INTENCLR=0,SHORTS=0,ENABLE=0,MODE=0,COUNTERTOP=0,PRESCALER=0,
|
||||
DECODER=0,LOOP=0,EVENTS_STOPPED=0,EVENTS_LOOPSDONE=0,INTENSET=0;
|
||||
Sequence SEQ[2];uint32_t EVENTS_SEQEND[2]={},EVENTS_SEQSTARTED[2]={},TASKS_SEQSTART[2]={};
|
||||
};
|
||||
static Registers registers;
|
||||
#define NRF_PWM3 (®isters)
|
||||
#define PWM_MODE_UPDOWN_Up 0
|
||||
#define PWM_PRESCALER_PRESCALER_DIV_1 0
|
||||
#define PWM_DECODER_LOAD_Common 0
|
||||
#define PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk 4
|
||||
#define PWM_INTENSET_SEQEND0_Msk 1
|
||||
#define PWM_INTENSET_SEQEND1_Msk 2
|
||||
#define PWM3_IRQn 45
|
||||
static bool irq_enabled=false;
|
||||
inline void NVIC_DisableIRQ(int){irq_enabled=false;}
|
||||
inline void NVIC_EnableIRQ(int){irq_enabled=true;}
|
||||
inline void NVIC_ClearPendingIRQ(int){}
|
||||
inline void NVIC_SetPriority(int,int){}
|
||||
struct HardwarePWM {
|
||||
bool owned=false,pin=false,reject=false;
|
||||
int bound_pin=-1;
|
||||
bool takeOwnership(uint32_t){if(owned||reject)return false;return owned=true;}
|
||||
bool addPin(int value){bound_pin=value;return pin=true;}
|
||||
void removePin(int){pin=false;bound_pin=-1;}
|
||||
bool releaseOwnership(uint32_t){assert(!pin);owned=false;return true;}
|
||||
};
|
||||
static HardwarePWM HwPWM3;
|
||||
'''
|
||||
|
||||
PLAYER = r'''
|
||||
#include <cassert>
|
||||
#include <helpers/ui/GpsVoice.h>
|
||||
#define PIN_BUZZER 25
|
||||
#define MESH_BUTTON_AUDIO_HIL 1
|
||||
#include <helpers/ui/GpsVoiceData.h>
|
||||
#include <helpers/ui/nrf52/GpsVoicePlayer.h>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
using namespace mesh::audio;
|
||||
VoiceDecoder decoder;
|
||||
const uint8_t short_data[]={0x77};
|
||||
decoder.begin({short_data,1,1000});
|
||||
assert(decoder.next()==11);assert(decoder.next()==41);
|
||||
assert(decoder.done()&&decoder.next()==0);
|
||||
decoder.begin({nullptr,1,2});assert(decoder.done());
|
||||
const uint8_t negative_data[64]={0xff,0xff,0xff,0xff};
|
||||
for(auto clip:{gpsOnClip,gpsOffClip,VoiceClip{negative_data,sizeof(negative_data),128},
|
||||
VoiceClip{negative_data,sizeof(negative_data),128,16000}}){
|
||||
decoder.begin(clip);
|
||||
unsigned count=0,nonzero=0;
|
||||
while(!decoder.done()){nonzero+=decoder.next()!=0; ++count;}
|
||||
assert(count==clip.samples&&nonzero>count/2);
|
||||
}
|
||||
GpsVoicePlayer player;
|
||||
assert(player.gain()==8);
|
||||
assert(!player.setGain(0)&&!player.setGain(9));
|
||||
assert(player.setGain(2));
|
||||
for(auto clip:{gpsOnClip,gpsOffClip,VoiceClip{negative_data,sizeof(negative_data),128},
|
||||
VoiceClip{negative_data,sizeof(negative_data),128,16000}}){
|
||||
assert(player.start(clip));assert(player.active()&&irq_enabled&&HwPWM3.owned&&HwPWM3.pin);
|
||||
assert(!player.setGain(8)&&player.gain()==2);
|
||||
assert(registers.COUNTERTOP==500&®isters.SEQ[0].REFRESH==0);
|
||||
VoiceDecoder reference;reference.begin(clip);
|
||||
VoiceInterpolator reconstruction;reconstruction.begin(clip.sample_rate);
|
||||
for(unsigned i=0;i<2;++i){
|
||||
auto data=reinterpret_cast<const uint16_t*>(registers.SEQ[i].PTR);
|
||||
for(unsigned j=0;j<registers.SEQ[i].CNT;++j){
|
||||
assert((data[j]&0x8000)&&(data[j]&0x7fff)<=500);
|
||||
int32_t pcm=reconstruction.next(reference)*2;
|
||||
if(pcm>32767)pcm=32767;
|
||||
if(pcm < -32768)pcm=-32768;
|
||||
assert((data[j]&0x7fff)==static_cast<uint16_t>((pcm+32768)*500/65536));
|
||||
}
|
||||
}
|
||||
unsigned seq=0,events=0;
|
||||
while(player.playing()){
|
||||
assert(++events<1000);
|
||||
registers.EVENTS_SEQEND[seq]=1;player.interrupt();seq^=1;
|
||||
}
|
||||
assert(player.played()==clip.samples&&player.active());
|
||||
assert(events==(clip.samples*(32000/clip.sample_rate)+127)/128);
|
||||
player.service();assert(!player.active()&&!HwPWM3.owned&&!HwPWM3.pin&&!irq_enabled&&!registers.ENABLE);
|
||||
assert(pin_states[PIN_BUZZER]==LOW);
|
||||
}
|
||||
assert(player.started()==4&&player.completed()==4&&player.cancelled()==0);
|
||||
assert(player.setGain(4));
|
||||
assert(player.start(gpsOnClip));player.stop();
|
||||
assert(player.cancelled()==1&&player.completed()==4);
|
||||
HwPWM3.reject=true;assert(!player.start(gpsOnClip));assert(!irq_enabled);
|
||||
assert(!player.start({short_data,1,3}));assert(!player.playing());
|
||||
assert(!player.start({short_data,1,2,12345}));
|
||||
}
|
||||
'''
|
||||
|
||||
PLAYER_BINARY = r'''
|
||||
#include <cassert>
|
||||
#define PIN_BUZZER 25
|
||||
#define MESH_BUTTON_AUDIO_HIL 1
|
||||
#define MESH_GPS_VOICE_BINARY_DRIVE 1
|
||||
#include <helpers/ui/GpsVoiceData.h>
|
||||
#include <helpers/ui/nrf52/GpsVoicePlayer.h>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
using namespace mesh::audio;
|
||||
GpsVoicePlayer player;
|
||||
for(unsigned repetition=0;repetition<2;++repetition){
|
||||
assert(player.start(gpsOnClip));
|
||||
assert(player.gain()==8&®isters.COUNTERTOP==250&®isters.SEQ[0].REFRESH==1);
|
||||
VoiceDecoder decoder;decoder.begin(gpsOnClip);
|
||||
VoiceInterpolator interpolator;interpolator.begin();
|
||||
bool high=false;unsigned transitions=0;
|
||||
for(unsigned n=0;n<2;++n){
|
||||
auto values=reinterpret_cast<const uint16_t*>(registers.SEQ[n].PTR);
|
||||
for(unsigned i=0;i<registers.SEQ[n].CNT;++i){
|
||||
int32_t pcm=interpolator.next(decoder)*8;
|
||||
bool old=high;
|
||||
if(pcm>1024)high=true;else if(pcm < -1024)high=false;
|
||||
transitions+=old!=high;
|
||||
assert(values[i]==(0x8000|(high?250:0)));
|
||||
}
|
||||
}
|
||||
assert(transitions>0);
|
||||
player.stop();assert(!player.active()&&!registers.ENABLE&&!irq_enabled);
|
||||
}
|
||||
assert(player.cancelled()==2);
|
||||
// Encoded silence is below the hysteresis band and does not chatter.
|
||||
const uint8_t silence[64]={};
|
||||
assert(player.start({silence,sizeof(silence),128}));
|
||||
auto values=reinterpret_cast<const uint16_t*>(registers.SEQ[0].PTR);
|
||||
for(unsigned i=0;i<registers.SEQ[0].CNT;++i)assert(values[i]==0x8000);
|
||||
player.stop();
|
||||
}
|
||||
'''
|
||||
|
||||
PLAYER_PDM = r'''
|
||||
#include <cassert>
|
||||
#define PIN_BUZZER 25
|
||||
#define MESH_BUTTON_AUDIO_HIL 1
|
||||
#define MESH_GPS_VOICE_PDM_DRIVE 1
|
||||
#include <helpers/ui/GpsVoiceData.h>
|
||||
#include <helpers/ui/nrf52/GpsVoicePlayer.h>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
using namespace mesh::audio;
|
||||
GpsVoicePlayer player;
|
||||
assert(player.start(gpsOnClip));
|
||||
assert(player.gain()==8&®isters.COUNTERTOP==250&®isters.SEQ[0].REFRESH==0);
|
||||
VoiceDecoder decoder;decoder.begin(gpsOnClip);
|
||||
VoiceInterpolator interpolator;interpolator.begin();
|
||||
int32_t error=0,pcm=0;
|
||||
unsigned transitions=0;bool old=false;
|
||||
for(unsigned n=0;n<2;++n){
|
||||
auto values=reinterpret_cast<const uint16_t*>(registers.SEQ[n].PTR);
|
||||
for(unsigned i=0;i<registers.SEQ[n].CNT;++i){
|
||||
if(!(i&1))pcm=interpolator.next(decoder)*8;
|
||||
if(pcm>32767)pcm=32767;
|
||||
if(pcm < -32768)pcm=-32768;
|
||||
error+=pcm;bool high=error>=0;error-=high?32767:-32768;
|
||||
assert(error>=-32768&&error<=32768);
|
||||
assert(values[i]==(0x8000|(high?250:0)));
|
||||
transitions+=old!=high;old=high;
|
||||
}
|
||||
}
|
||||
assert(transitions>0);
|
||||
unsigned seq=0,events=0;
|
||||
while(player.playing()){
|
||||
assert(++events<1000);registers.EVENTS_SEQEND[seq]=1;player.interrupt();seq^=1;
|
||||
}
|
||||
assert(events==(gpsOnClip.samples*8+127)/128);
|
||||
assert(player.played()==gpsOnClip.samples);
|
||||
player.service();assert(!player.active()&&!registers.ENABLE&&!irq_enabled);
|
||||
}
|
||||
'''
|
||||
|
||||
BUTTON = r'''
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <initializer_list>
|
||||
#include <helpers/ui/ButtonVoice.h>
|
||||
#include "examples/companion_radio/ui-orig/Button.h"
|
||||
#define ENV_INCLUDE_GPS 1
|
||||
#define PIN_BUZZER 25
|
||||
#define MESH_DEBUG_PRINTLN(...) ((void)0)
|
||||
uint32_t now_ms=0;
|
||||
enum class UIEventType{ack};
|
||||
namespace mesh{namespace notify{enum{Sound=1};}}
|
||||
struct CompanionNodePrefs{uint8_t gps_enabled=0,buzzer_quiet=1;};
|
||||
struct SensorManager{
|
||||
bool enabled=false;
|
||||
bool available=true;
|
||||
bool setSettingValue(const char*,const char* value){if(!available)return false;enabled=value[0]=='1';return true;}
|
||||
const char* getSettingByKey(const char*){return available?(enabled?"1":"0"):nullptr;}
|
||||
};
|
||||
static SensorManager sensors;
|
||||
struct MyMesh{
|
||||
CompanionNodePrefs _prefs; bool save_ok=true;unsigned saves=0,adverts=0;
|
||||
bool savePrefs(){++saves;return save_ok;}
|
||||
template<class T> bool savePreference(T& p,T v){T old=p;p=v;if(savePrefs())return true;p=old;return false;}
|
||||
void applyGpsPrefs(){sensors.setSettingValue("gps",_prefs.gps_enabled?"1":"0");}
|
||||
bool setGpsEnabled(bool);
|
||||
bool advert(){++adverts;return true;}
|
||||
void setNotificationOutputMute(int,int){}
|
||||
};
|
||||
static MyMesh the_mesh;
|
||||
struct Buzzer{
|
||||
bool muted=true;unsigned spoken=0;bool last=false;
|
||||
bool speakGps(bool value){if(!muted){++spoken;last=value;}return true;}
|
||||
bool speakButton(ButtonVoicePrompt prompt,bool=false){
|
||||
if(prompt==ButtonVoicePrompt::GpsOn||prompt==ButtonVoicePrompt::GpsOff)
|
||||
return speakGps(prompt==ButtonVoicePrompt::GpsOn);
|
||||
return true;
|
||||
}
|
||||
bool isQuiet(){return muted;}
|
||||
void quiet(bool q){muted=q;}
|
||||
};
|
||||
struct UITask{
|
||||
SensorManager* _sensors=&sensors;CompanionNodePrefs* _node_prefs=&the_mesh._prefs;
|
||||
Buzzer buzzer;char _alert[80]={};bool _need_refresh=false;unsigned acks=0;
|
||||
void notify(UIEventType){++acks;}
|
||||
void handleButtonDoublePress();void handleButtonTriplePress();void handleButtonQuadruplePress();
|
||||
};
|
||||
@METHODS@
|
||||
int main(){
|
||||
UITask ui;Button button(6,HIGH);button.begin();
|
||||
unsigned singles=0;
|
||||
button.onShortPress([&]{++singles;});
|
||||
button.onDoublePress([&]{ui.handleButtonDoublePress();});
|
||||
button.onTriplePress([&]{ui.handleButtonTriplePress();});
|
||||
button.onQuadruplePress([&]{ui.handleButtonQuadruplePress();});
|
||||
auto run=[&](unsigned count){
|
||||
assert(button.injectPresses(count));
|
||||
assert(!button.injectPresses(count));
|
||||
uint32_t start=now_ms;
|
||||
while(now_ms-start<3000){now_ms+=10;button.update();}
|
||||
};
|
||||
run(1);assert(singles==1&&the_mesh.adverts==0&&the_mesh._prefs.gps_enabled==0);
|
||||
run(2);assert(the_mesh.adverts==1&&the_mesh._prefs.gps_enabled==0);
|
||||
// Multi-click actions do not turn an overlong held press into short clicks.
|
||||
unsigned held=0;button.onLongPress([&]{++held;});
|
||||
assert(button.injectPresses(1,3500));
|
||||
for(unsigned i=0;i<500;++i){now_ms+=10;button.update();}
|
||||
assert(held==1&&singles==1&&the_mesh.adverts==1);
|
||||
run(3);assert(!ui.buzzer.isQuiet()&&!the_mesh._prefs.buzzer_quiet);
|
||||
run(4);assert(sensors.enabled&&the_mesh._prefs.gps_enabled==1&&ui.buzzer.last);
|
||||
run(4);assert(!sensors.enabled&&the_mesh._prefs.gps_enabled==0&&!ui.buzzer.last);
|
||||
assert(ui.buzzer.spoken==2);
|
||||
the_mesh.save_ok=false;
|
||||
run(4);assert(!sensors.enabled&&the_mesh._prefs.gps_enabled==0);
|
||||
assert(ui.buzzer.spoken==2&&strstr(ui._alert,"failed"));
|
||||
the_mesh.save_ok=true;sensors.available=false;
|
||||
run(4);assert(ui.buzzer.spoken==2);
|
||||
}
|
||||
'''
|
||||
|
||||
BUZZER_SEQUENCE = r'''
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#define PIN_BUZZER 25
|
||||
#define PIN_BUZZER_EN 37
|
||||
#define MESH_BUTTON_AUDIO_HIL 1
|
||||
#define MESH_GPS_VOICE 1
|
||||
#include <helpers/ui/buzzer.cpp>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
genericBuzzer buzzer;buzzer.begin();
|
||||
char status[180];
|
||||
auto check=[&](const char* expected){buzzer.voiceStatus(status,sizeof(status));assert(strstr(status,expected));};
|
||||
auto finish_tone=[&]{
|
||||
rtttl::finish();buzzer.loop();assert(buzzer.isPlaying());
|
||||
now_ms+=99;buzzer.loop();assert(!registers.ENABLE);
|
||||
++now_ms;buzzer.loop();
|
||||
};
|
||||
auto finish_speech=[&]{
|
||||
unsigned seq=0,events=0;
|
||||
while(registers.ENABLE){assert(++events<1000);registers.EVENTS_SEQEND[seq]=1;PWM3_IRQHandler();seq^=1;}
|
||||
assert(buzzer.isPlaying());buzzer.loop();assert(!buzzer.isPlaying());
|
||||
};
|
||||
for(bool enabled:{true,false}){
|
||||
assert(buzzer.speakGps(enabled));assert(buzzer.isPlaying());
|
||||
assert(rtttl::melody==(enabled?"Startup:d=4,o=5,b=160:16c6,16e6,8g6":"Shutdown:d=4,o=5,b=100:8g5,16e5,16c5"));
|
||||
assert(!registers.ENABLE);check("pending=1 tone=1");
|
||||
assert(!buzzer.voiceGain(8));
|
||||
now_ms+=500;buzzer.loop();assert(!registers.ENABLE);
|
||||
finish_tone();assert(registers.ENABLE);check("pending=0 tone=0");
|
||||
finish_speech();
|
||||
}
|
||||
check("started=2 completed=2 cancelled=0");
|
||||
// Muting cancels a tone, a queued pause, and active speech without restarting.
|
||||
assert(buzzer.speakGps(true));buzzer.quiet(true);assert(!buzzer.isPlaying());
|
||||
now_ms+=1000;buzzer.loop();check("started=2 completed=2 cancelled=0");
|
||||
auto before=rtttl::begins;assert(buzzer.speakGps(false));assert(rtttl::begins==before);
|
||||
buzzer.quiet(false);assert(buzzer.speakGps(false));rtttl::finish();buzzer.loop();
|
||||
buzzer.quiet(true);now_ms+=1000;buzzer.loop();assert(!buzzer.isPlaying());
|
||||
buzzer.quiet(false);assert(buzzer.speakGps(true));
|
||||
buzzer.playNotification("Alert:d=4,o=5,b=120:c");rtttl::finish();
|
||||
now_ms+=1000;buzzer.loop();assert(!buzzer.isPlaying());check("started=2 completed=2 cancelled=0");
|
||||
assert(buzzer.speakGps(true));finish_tone();buzzer.quiet(true);
|
||||
assert(!buzzer.isPlaying());check("started=3 completed=2 cancelled=1");
|
||||
buzzer.quiet(false);
|
||||
// The pause handles the millisecond counter wrapping and a busy PWM gracefully.
|
||||
now_ms=0xfffffff0;assert(buzzer.speakGps(false));finish_tone();assert(registers.ENABLE);
|
||||
finish_speech();check("started=4 completed=3 cancelled=1");
|
||||
HwPWM3.reject=true;assert(buzzer.speakGps(true));finish_tone();assert(!buzzer.isPlaying());
|
||||
check("started=4 completed=3 cancelled=1");
|
||||
}
|
||||
'''
|
||||
|
||||
BUZZER_TONES = r'''
|
||||
#include <cassert>
|
||||
#define PIN_BUZZER 25
|
||||
#define MESH_GPS_VOICE 0
|
||||
#include <helpers/ui/buzzer.cpp>
|
||||
uint32_t now_ms=0;
|
||||
int main(){
|
||||
genericBuzzer buzzer;buzzer.begin();
|
||||
assert(buzzer.speakGps(true));assert(buzzer.isPlaying());
|
||||
assert(rtttl::melody=="Startup:d=4,o=5,b=160:16c6,16e6,8g6");
|
||||
rtttl::finish();buzzer.loop();assert(!buzzer.isPlaying());
|
||||
assert(buzzer.speakGps(false));
|
||||
assert(rtttl::melody=="Shutdown:d=4,o=5,b=100:8g5,16e5,16c5");
|
||||
buzzer.quiet(true);assert(!buzzer.isPlaying());
|
||||
unsigned before=rtttl::begins;assert(buzzer.speakGps(true));assert(rtttl::begins==before);
|
||||
buzzer.quiet(false);
|
||||
for(auto prompt:{ButtonVoicePrompt::Ready,ButtonVoicePrompt::NotificationCleared,
|
||||
ButtonVoicePrompt::AdvertQueued,ButtonVoicePrompt::AdvertFailed,
|
||||
ButtonVoicePrompt::SoundOn,ButtonVoicePrompt::SoundOff,
|
||||
ButtonVoicePrompt::ActionFailed,ButtonVoicePrompt::UsbSetup,
|
||||
ButtonVoicePrompt::AlertsSoundVibration,ButtonVoicePrompt::AlertsSoundOnly,
|
||||
ButtonVoicePrompt::AlertsVibrationOnly,ButtonVoicePrompt::AlertsSilent}){
|
||||
assert(buzzer.speakButton(prompt));assert(!buzzer.isPlaying()&&rtttl::begins==before);
|
||||
}
|
||||
assert(buzzer.speakGps(true));before=rtttl::begins;
|
||||
assert(!buzzer.speakButton(static_cast<ButtonVoicePrompt>(255)));
|
||||
assert(buzzer.isPlaying()&&rtttl::begins==before);
|
||||
}
|
||||
'''
|
||||
|
||||
class Tests(unittest.TestCase):
|
||||
def test_reconstruction_suppresses_audible_sampling_images(self):
|
||||
source=(ROOT/'src/helpers/ui/GpsVoice.h').read_text()
|
||||
body=source.split('coefficients[4][16] = {',1)[1].split('};',1)[0]
|
||||
rows=[[int(value) for value in row.split(',')]
|
||||
for row in re.findall(r'\{([^{}]+)\}',body)]
|
||||
self.assertEqual(len(rows),4)
|
||||
for row in rows:
|
||||
self.assertEqual(len(row),16)
|
||||
self.assertEqual(sum(row),16384)
|
||||
self.assertLess(32768*sum(abs(value) for value in row),2**31)
|
||||
taps=[rows[phase][index] for index in range(16) for phase in range(4)]
|
||||
def response(frequency):
|
||||
value=sum(tap*cmath.exp(-2j*math.pi*frequency*i/32000)
|
||||
for i,tap in enumerate(taps))/65536
|
||||
return 20*math.log10(abs(value))
|
||||
self.assertAlmostEqual(response(700),0,delta=0.02)
|
||||
self.assertLess(response(4700),-65)
|
||||
self.assertLess(response(7300),-65)
|
||||
|
||||
def test_wideband_reconstruction_bounds_and_consonant_band(self):
|
||||
source=(ROOT/'src/helpers/ui/GpsVoice.h').read_text()
|
||||
body=source.split('wide_coefficients[2][16] = {',1)[1].split('};',1)[0]
|
||||
rows=[[int(value) for value in row.split(',')]
|
||||
for row in re.findall(r'\{([^{}]+)\}',body)]
|
||||
self.assertEqual(len(rows),2)
|
||||
for row in rows:
|
||||
self.assertEqual(len(row),16)
|
||||
self.assertEqual(sum(row),16384)
|
||||
self.assertLess(32768*sum(abs(value) for value in row),2**31)
|
||||
taps=[rows[phase][index] for index in range(16) for phase in range(2)]
|
||||
def response(frequency):
|
||||
value=sum(tap*cmath.exp(-2j*math.pi*frequency*i/32000)
|
||||
for i,tap in enumerate(taps))/32768
|
||||
return 20*math.log10(abs(value))
|
||||
self.assertAlmostEqual(response(3000),0,delta=0.02)
|
||||
self.assertGreater(response(6500),-2)
|
||||
self.assertLess(response(10000),-45)
|
||||
|
||||
def build(self, source, *, button=False, rtttl=False):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
path=Path(temp)
|
||||
(path/'Arduino.h').write_text(ARDUINO)
|
||||
(path/'HardwarePWM.h').write_text(PWM)
|
||||
(path/'NonBlockingRtttl.h').write_text(RTTTL if rtttl else '#pragma once\n')
|
||||
(path/'test.cpp').write_text(source)
|
||||
binary=path/'test'
|
||||
cmd=['g++','-std=c++17','-Wall','-Wextra','-Werror',
|
||||
'-I'+str(path),'-I'+str(ROOT/'src'),'-I'+str(ROOT),
|
||||
str(path/'test.cpp'),'-o',str(binary)]
|
||||
if button:
|
||||
cmd+=['-DMESH_BUTTON_AUDIO_HIL=1',str(ROOT/'examples/companion_radio/ui-orig/Button.cpp')]
|
||||
subprocess.run(cmd,check=True)
|
||||
subprocess.run([str(binary)],check=True)
|
||||
|
||||
def test_decoder_and_dma_lifecycle(self):
|
||||
self.build(PLAYER.replace('#include <cassert>','#include <cassert>\n#include <initializer_list>'))
|
||||
|
||||
def test_binary_acoustic_driver_hysteresis_and_reset(self):
|
||||
self.build(PLAYER_BINARY)
|
||||
|
||||
def test_density_acoustic_driver_bounds_and_sample_rate(self):
|
||||
self.build(PLAYER_PDM)
|
||||
source=PLAYER_PDM.replace('gpsOnClip', 'clip')
|
||||
source=source.replace('GpsVoicePlayer player;',
|
||||
'GpsVoicePlayer player; VoiceClip clip{gpsOnClip.data,gpsOnClip.bytes,gpsOnClip.samples,16000};')
|
||||
source=source.replace('interpolator.begin();','interpolator.begin(clip.sample_rate);')
|
||||
source=source.replace('clip.samples*8','clip.samples*4')
|
||||
self.build(source)
|
||||
|
||||
def test_lower_carrier_acoustic_driver_preserves_sample_rate(self):
|
||||
source=PLAYER.replace('#define MESH_BUTTON_AUDIO_HIL 1',
|
||||
'#define MESH_BUTTON_AUDIO_HIL 1\n#define MESH_GPS_VOICE_PCM32_DRIVE 1')
|
||||
self.build(source.replace('#include <cassert>','#include <cassert>\n#include <initializer_list>'))
|
||||
|
||||
def test_hil_can_compare_the_previous_carrier_without_changing_output_rate(self):
|
||||
source=PLAYER.replace('#define MESH_BUTTON_AUDIO_HIL 1',
|
||||
'#define MESH_BUTTON_AUDIO_HIL 1\n#define MESH_GPS_VOICE_PCM32_DRIVE 0')
|
||||
source=source.replace('COUNTERTOP==500&®isters.SEQ[0].REFRESH==0',
|
||||
'COUNTERTOP==250&®isters.SEQ[0].REFRESH==1')
|
||||
source=source.replace('<=500','<=250').replace('pcm+32768)*500','pcm+32768)*250')
|
||||
self.build(source.replace('#include <cassert>','#include <cassert>\n#include <initializer_list>'))
|
||||
|
||||
def test_experimental_drive_flags_do_not_change_non_test_firmware(self):
|
||||
source=PLAYER.replace('#define MESH_BUTTON_AUDIO_HIL 1', '@FLAGS@')
|
||||
# The lab gain control is absent in non-test firmware. Keep the same
|
||||
# waveform assertions at its default gain instead.
|
||||
source=source.replace('assert(!player.setGain(0)&&!player.setGain(9));','')
|
||||
source=source.replace('assert(player.setGain(2));','')
|
||||
source=source.replace('assert(!player.setGain(8)&&player.gain()==2);','')
|
||||
source=source.replace('reconstruction.next(reference)*2','reconstruction.next(reference)*8')
|
||||
source=source.replace('assert(player.setGain(4));','')
|
||||
source=source.replace('#include <cassert>','#include <cassert>\n#include <initializer_list>')
|
||||
for flags in (
|
||||
'#define MESH_GPS_VOICE_BINARY_DRIVE 1',
|
||||
'#define MESH_GPS_VOICE_PDM_DRIVE 1',
|
||||
'#define MESH_GPS_VOICE_PCM32_DRIVE 0',
|
||||
'#define MESH_GPS_VOICE_BINARY_DRIVE 1\n#define MESH_GPS_VOICE_PDM_DRIVE 1\n#define MESH_GPS_VOICE_PCM32_DRIVE 0',
|
||||
):
|
||||
with self.subTest(flags=flags):
|
||||
self.build(source.replace('@FLAGS@', flags))
|
||||
|
||||
def test_direction_tones_finish_before_speech_and_cancellation(self):
|
||||
self.build(BUZZER_SEQUENCE,rtttl=True)
|
||||
|
||||
def test_direction_tones_without_speech(self):
|
||||
self.build(BUZZER_TONES.replace('#include <cassert>',
|
||||
'#include <cassert>\n#include <initializer_list>'),rtttl=True)
|
||||
|
||||
def assert_voice_policy(self, flags, expected):
|
||||
self.build(flags+'#include <helpers/ui/buzzer.h>\n'
|
||||
+f'static_assert(MESH_GPS_VOICE=={expected},"speech gating");\nint main(){{}}\n')
|
||||
|
||||
def test_speech_defaults_to_all_screenless_nrf52_full_companions_only(self):
|
||||
eligible = ('T1000_E', 'RAK_WISMESH_TAG', 'MESH_TRACKER_X1',
|
||||
'R1Neo', 'THINKNODE_M3')
|
||||
full = '#define NRF52_PLATFORM\n#define COMPANION_RADIO_FULL 1\n#define PIN_BUZZER 25\n'
|
||||
for board in eligible:
|
||||
for laboratory in ('', '#define MESH_BUTTON_AUDIO_HIL\n'):
|
||||
with self.subTest(board=board, laboratory=bool(laboratory)):
|
||||
self.assert_voice_policy(full+f'#define {board}\n'+laboratory, 1)
|
||||
# A buzzer on another board is not sufficient: screened boards and all
|
||||
# Wio profiles retain their existing tones, even in a Full Companion.
|
||||
for board in ('HELTEC_T1', 'MESHTINY', 'NANO_G2_ULTRA',
|
||||
'LILYGO_TECHO_CARD', 'THINKNODE_M1', 'THINKNODE_M8',
|
||||
'THINKNODE_M4',
|
||||
'WIO_TRACKER_L1', 'WIO_TRACKER_L1_1W', 'WIO_TRACKER_L1_EINK',
|
||||
'RAK_4631', 'UNKNOWN_BOARD'):
|
||||
with self.subTest(excluded_board=board):
|
||||
self.assert_voice_policy(full+f'#define {board}\n', 0)
|
||||
self.assert_voice_policy(full, 0)
|
||||
|
||||
def test_r1_neo_qspi_conflict_does_not_enable_voice_and_m4_copied_pins_are_removed(self):
|
||||
self.assert_voice_policy('#define NRF52_PLATFORM\n#define COMPANION_RADIO_FULL 1\n'
|
||||
'#define PIN_BUZZER 3\n#define R1Neo\n#define QSPIFLASH\n', 0)
|
||||
m4 = (ROOT / 'variants/thinknode_m4/platformio.ini').read_text()
|
||||
active = '\n'.join(line.strip() for line in m4.splitlines()
|
||||
if not line.lstrip().startswith(';'))
|
||||
self.assertNotRegex(active, r'-D\s+PIN_BUZZER=23\b')
|
||||
self.assertNotRegex(active, r'-D\s+PIN_BUZZER_EN=36\b')
|
||||
|
||||
def test_speech_requires_full_companion_nrf52_and_fitted_buzzer_and_allows_opt_out(self):
|
||||
for board in ('T1000_E', 'RAK_WISMESH_TAG', 'MESH_TRACKER_X1',
|
||||
'R1Neo', 'THINKNODE_M3'):
|
||||
base = f'#define {board}\n'
|
||||
for case, flags in (
|
||||
('no_nrf52', '#define COMPANION_RADIO_FULL 1\n#define PIN_BUZZER 25\n'),
|
||||
('full_disabled', '#define NRF52_PLATFORM\n#define COMPANION_RADIO_FULL 0\n#define PIN_BUZZER 25\n'),
|
||||
('non_companion', '#define NRF52_PLATFORM\n#define PIN_BUZZER 25\n'),
|
||||
('no_buzzer', '#define NRF52_PLATFORM\n#define COMPANION_RADIO_FULL 1\n'),
|
||||
('explicit_opt_out', '#define NRF52_PLATFORM\n#define COMPANION_RADIO_FULL 1\n#define PIN_BUZZER 25\n#define MESH_GPS_VOICE 0\n'),
|
||||
):
|
||||
with self.subTest(board=board, excluded_profile=case):
|
||||
self.assert_voice_policy(base+flags, 0)
|
||||
|
||||
def test_unsafe_audio_profiles_retain_tones_and_explicit_voice_override(self):
|
||||
full = '#define NRF52_PLATFORM\n#define COMPANION_RADIO_FULL 1\n'
|
||||
profiles = (
|
||||
# The M4's previous buzzer configuration overlaps its I2C SDA
|
||||
# and battery-status LED, not a verified speaker connection.
|
||||
'#define THINKNODE_M4\n#define PIN_BUZZER 23\n#define PIN_BUZZER_EN 36\n',
|
||||
# R1 Neo's dummy QSPI clock is the same pin as its buzzer.
|
||||
'#define R1Neo\n#define PIN_BUZZER 3\n#define QSPIFLASH 1\n',
|
||||
)
|
||||
for profile in profiles:
|
||||
with self.subTest(profile=profile):
|
||||
self.assert_voice_policy(full+profile, 0)
|
||||
self.assert_voice_policy(full+profile+'#define MESH_GPS_VOICE 1\n', 1)
|
||||
|
||||
def test_buttons_gps_persistence_and_failed_save(self):
|
||||
mesh=(ROOT/'examples/companion_radio/MyMesh.cpp').read_text()
|
||||
ui=(ROOT/'examples/companion_radio/ui-orig/UITask.cpp').read_text()
|
||||
methods=method(mesh,'bool MyMesh::setGpsEnabled(bool enabled)')
|
||||
for signature in ('void UITask::handleButtonDoublePress()',
|
||||
'void UITask::handleButtonTriplePress()',
|
||||
'void UITask::handleButtonQuadruplePress()'):
|
||||
methods+='\n'+method(ui,signature)
|
||||
self.build(BUTTON.replace('@METHODS@',methods),button=True)
|
||||
|
||||
if __name__=='__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,155 @@
|
||||
"""Validate speech-generation plans, fixed audio identity, and fixture encoding."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from test_button_voice_generator import parse_header, write_wav
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
POWERSHELL = shutil.which("pwsh") or shutil.which("powershell")
|
||||
BASELINE_FILTER = (
|
||||
"highpass=f=350,lowpass=f=3400,"
|
||||
"silenceremove=start_periods=1:start_threshold=-45dB,areverse,"
|
||||
"silenceremove=start_periods=1:start_threshold=-45dB,areverse,"
|
||||
"volume=1.4,alimiter=limit=0.8:level=disabled,apad=pad_dur=0.05"
|
||||
)
|
||||
SELECTED_FILTER = (
|
||||
"highpass=f=350,lowpass=f=3400,"
|
||||
"silenceremove=start_periods=1:start_threshold=-45dB,areverse,"
|
||||
"silenceremove=start_periods=1:start_threshold=-45dB,areverse,"
|
||||
"acompressor=threshold=0.08:ratio=6:attack=5:release=70:makeup=4:knee=4:detection=rms,"
|
||||
"volume=1.4,aresample=8000,alimiter=limit=0.12:level=disabled,apad=pad_dur=0.05"
|
||||
)
|
||||
|
||||
# Independently pinned from approved Zira WAVs (rate -1 / compressed / peak
|
||||
# 0.12 / 8 kHz), not from the header being tested or its voice-name metadata.
|
||||
ZIRA_GPS_RECORDINGS = {
|
||||
'gpsOn': ('8bb2571a94245c9df307857a072f5e8900e72976c81536dc02c25251da42ca7a', 9683),
|
||||
'gpsOff': ('4dd8519110914aba97d84d2d1b72a20dec8bb8ed573aa167551d8e092af8ffcb', 9237),
|
||||
}
|
||||
|
||||
|
||||
class AssetTests(unittest.TestCase):
|
||||
def test_production_gps_recordings_are_the_approved_zira_audio_and_metadata(self):
|
||||
source = (ROOT / 'src/helpers/ui/GpsVoiceData.h').read_text(encoding='utf-8')
|
||||
self.assertEqual([line for line in source.splitlines() if line.startswith('// Voice:')],
|
||||
['// Voice: Microsoft Zira Desktop'])
|
||||
arrays, clips = parse_header(source)
|
||||
self.assertEqual(tuple(arrays), tuple(ZIRA_GPS_RECORDINGS))
|
||||
self.assertEqual(tuple(clips), tuple(ZIRA_GPS_RECORDINGS))
|
||||
for name, (fingerprint, samples) in ZIRA_GPS_RECORDINGS.items():
|
||||
with self.subTest(recording=name):
|
||||
self.assertEqual(hashlib.sha256(arrays[name]).hexdigest(), fingerprint)
|
||||
self.assertEqual(clips[name], (name, name, samples, 8000))
|
||||
|
||||
def test_optional_voice_metadata_preserves_generic_pcm_fixture_encoding(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary)
|
||||
on, off = directory / 'on.wav', directory / 'off.wav'
|
||||
write_wav(on, [0, 0, 1, -1, 2, -2, 3, -3, 1000])
|
||||
write_wav(off, [0, 1, -1, 2, -2, 3, -3, -1000])
|
||||
outputs = []
|
||||
for arguments in ((), ('--voice', 'Microsoft Zira Desktop')):
|
||||
target = directory / ('selected.h' if arguments else 'plain.h')
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(ROOT / 'scripts/generate_gps_voice.py'),
|
||||
'--on', str(on), '--off', str(off), '--output', str(target), *arguments],
|
||||
capture_output=True, text=True, timeout=30,
|
||||
)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
outputs.append(target.read_text(encoding='utf-8'))
|
||||
self.assertNotIn('// Voice:', outputs[0])
|
||||
self.assertIn('// Voice: Microsoft Zira Desktop\n', outputs[1])
|
||||
self.assertEqual(parse_header(outputs[0]), parse_header(outputs[1]))
|
||||
|
||||
def test_powershell_forwards_selected_voice_to_encoder_metadata(self):
|
||||
source = (ROOT / 'scripts/generate_gps_voice.ps1').read_text(encoding='utf-8')
|
||||
invocation = next(line for line in source.splitlines()
|
||||
if line.startswith('& python $gpsEncoder '))
|
||||
self.assertIn('--voice $Voice', invocation)
|
||||
|
||||
|
||||
@unittest.skipUnless(POWERSHELL, "PowerShell is needed for generator plan tests")
|
||||
class Tests(unittest.TestCase):
|
||||
def plan(self, *arguments):
|
||||
return subprocess.run(
|
||||
[POWERSHELL, "-NoProfile", "-NonInteractive", "-File",
|
||||
str(ROOT / "scripts/generate_gps_voice.ps1"),
|
||||
*arguments, "-WhatIf", "-Verbose"],
|
||||
cwd=ROOT, capture_output=True, text=True, timeout=30,
|
||||
)
|
||||
|
||||
def test_selected_defaults_and_original_profile(self):
|
||||
result = self.plan()
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn(SELECTED_FILTER, result.stdout)
|
||||
self.assertIn("Microsoft Zira Desktop; rate: -1", result.stdout)
|
||||
self.assertIn(str(ROOT / "src/helpers/ui/GpsVoiceData.h"), result.stdout)
|
||||
result = self.plan(
|
||||
"-Voice", "Microsoft Zira Desktop", "-Compress:$false", "-PeakLimit", "0.8",
|
||||
"-OutputHeader", "out/gps-voice/original-zira.h",
|
||||
)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn(BASELINE_FILTER, result.stdout)
|
||||
self.assertIn("Microsoft Zira Desktop; rate: -1", result.stdout)
|
||||
self.assertNotIn("acompressor=", result.stdout)
|
||||
|
||||
def test_compressed_variant_is_planned_without_writes(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
directory = Path(temporary) / "preview"
|
||||
header = Path(temporary) / "headers/mark.h"
|
||||
result = self.plan(
|
||||
"-Voice", "Microsoft Mark", "-Rate", "0", "-Compress",
|
||||
"-PeakLimit", "0.10", "-OutputDirectory", str(directory),
|
||||
"-OutputHeader", str(header),
|
||||
)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn("Microsoft Mark; rate: 0", result.stdout)
|
||||
self.assertIn("acompressor=threshold=0.08:ratio=6", result.stdout)
|
||||
self.assertIn("makeup=4:knee=4:detection=rms", result.stdout)
|
||||
self.assertIn("aresample=8000,alimiter=limit=0.1:level=disabled", result.stdout)
|
||||
self.assertIn(str(header), result.stdout)
|
||||
self.assertFalse(directory.exists())
|
||||
self.assertFalse(header.parent.exists())
|
||||
|
||||
def test_variants_require_an_explicit_header(self):
|
||||
for arguments in (("-Compress:$false",), ("-Voice", "Microsoft Mark"),
|
||||
("-Rate", "0"), ("-PeakLimit", "0.10")):
|
||||
with self.subTest(arguments=arguments):
|
||||
result = self.plan(*arguments)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("explicit -OutputHeader", result.stderr)
|
||||
|
||||
def test_invalid_header_extension_is_rejected(self):
|
||||
result = self.plan("-OutputHeader", "out/gps-voice/test.wav")
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("must name a .h file", result.stderr)
|
||||
|
||||
def test_file_directory_collisions_are_rejected(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
path = Path(temporary)
|
||||
file = path / "existing-file"
|
||||
file.touch()
|
||||
result = self.plan("-OutputDirectory", str(file))
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("names an existing file", result.stderr)
|
||||
directory = path / "existing-directory.h"
|
||||
directory.mkdir()
|
||||
result = self.plan("-OutputHeader", str(directory))
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("names an existing directory", result.stderr)
|
||||
|
||||
def test_rate_and_peak_ranges_are_rejected(self):
|
||||
for arguments in (("-Rate", "11"), ("-Rate", "-11"),
|
||||
("-PeakLimit", "0.01"), ("-PeakLimit", "1.1")):
|
||||
with self.subTest(arguments=arguments):
|
||||
result = self.plan("-OutputHeader", "out/gps-voice/test.h", *arguments)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn(arguments[0][1:], result.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -82,8 +82,7 @@ build_flags = ${ThinkNode_M4.build_flags}
|
||||
; -D MESH_DEBUG=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-D PIN_BUZZER=23
|
||||
-D PIN_BUZZER_EN=36
|
||||
; No verified onboard buzzer: GPIO23 is I2C SDA and GPIO36 is battery LED4.
|
||||
-D ENABLE_USB_INTERFACE
|
||||
build_src_filter = ${ThinkNode_M4.build_src_filter}
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
@@ -109,8 +108,7 @@ build_flags = ${ThinkNode_M4.build_flags}
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-D PIN_BUZZER=23
|
||||
-D PIN_BUZZER_EN=36
|
||||
; Keep I2C SDA / battery LED4 reserved; do not copy M3 buzzer wiring here.
|
||||
build_src_filter = ${ThinkNode_M4.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
|
||||
Reference in new issue
Block a user