Meshtastic-Apple icon indicating copy to clipboard operation
Meshtastic-Apple copied to clipboard

Nag Cycle timeout as entered on the IOS app is 1000x where it should be🐞 [Bug]:

Open DSCustoms opened this issue 9 months ago • 0 comments

Firmware Version

2.3.8 / all

What did you do?

Trying to use Nag Cycle Timeout to limit ringtone replay doesn't work when set from the IOS app. Options are Unset, One Second, Two Seconds, etc. Just having this on anything besides Unset will cause endless ringtone looping.

First I was having issues with longer RTTTL ringtones playing too long, then set it so the tone was a single beep. The beep will repeat for minutes even if nag timeout is set to one second, because of the following.

Expected Behavior

Setting nag timeout should limit the replay of ringtone cycles, but it doesn't.

Current Behavior

Ok, had a long discussion with Tropho on the discord last night about this. Error behavior on the ios app can't be replicated on other devices. The config setting for nagTimeout in meshtastic is taking the entered field from the config screens and multiplying it by 1000, then converting back to milliseconds when determining the timeout wait.

If you enter this on the web client, or android, it is entered in seconds. If you enter it on IOS, the options are given in seconds, but the code sends the following to the firmware.

https://github.com/meshtastic/Meshtastic-Apple/blob/34ff1f3fce04a3f709bae63e8fa2aab6aac2e619/Meshtastic/Enums/IntervalEnums.swift#L30

`enum OutputIntervals: Int, CaseIterable, Identifiable {

case unset = 0
case oneSecond = 1000
case twoSeconds = 2000
case threeSeconds = 3000
case fourSeconds = 4000
case fiveSeconds = 5000
case tenSeconds = 10000
case fifteenSeconds = 15000
case thirtySeconds = 30000
case oneMinute = 60000

`

These need to be set to 1,2,3,4 etc instead of 1000,2000,3000 to work like the other versions.

From this https://github.com/meshtastic/firmware/blob/75dc8cccecd52da78f1d69eeb4eb017fbc68f26c/src/modules/ExternalNotificationModule.cpp

` if (moduleConfig.external_notification.alert_bell) { if (containsBell) { LOG_INFO("externalNotificationModule - Notification Bell\n"); isNagging = true; setExternalOn(0); if (moduleConfig.external_notification.nag_timeout) { nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000; } else { nagCycleCutoff = millis() + moduleConfig.external_notification.output_ms; } } }

        if (moduleConfig.external_notification.alert_bell_vibra) {
            if (containsBell) {
                LOG_INFO("externalNotificationModule - Notification Bell (Vibra)\n");
                isNagging = true;
                setExternalOn(1);
                if (moduleConfig.external_notification.nag_timeout) {
                    nagCycleCutoff = millis() + moduleConfig.external_notification.nag_timeout * 1000;
                } else {
                    nagCycleCutoff = millis() + moduleConfig.external_notification.output_ms;
                }
            }
        }

`

The *1000 is why the issue occurs.

Results in

"externalNotification": { "enabled": true, "outputMs": 5000, "active": true, "alertMessage": true, "alertBell": true, "usePwm": true, "outputBuzzer": 21, "nagTimeout": 10000, "output": 0, "outputVibra": 0, "alertMessageVibra": false, "alertMessageBuzzer": false, "alertBellVibra": false, "alertBellBuzzer": false, "useI2sAsBuzzer": false },

But if entered on android or web config that nagTimeout would just be the value in seconds.

Thanks!

Participation

  • [ ] I am willing to submit a pull request for this issue.

Additional comments

No response

DSCustoms avatar May 09 '24 13:05 DSCustoms