mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 22:52:07 +00:00
potential bugfix for nag cutoff
This commit is contained in:
parent
34f9324766
commit
6f6ca64cfd
@ -4,7 +4,6 @@
|
||||
#include "concurrency/OSThread.h"
|
||||
#include "configuration.h"
|
||||
#include "graphics/Screen.h"
|
||||
#include "modules/ExternalNotificationModule.h"
|
||||
#include "power.h"
|
||||
#include <OneButton.h>
|
||||
|
||||
@ -116,10 +115,6 @@ class ButtonThread : public concurrency::OSThread
|
||||
{
|
||||
// DEBUG_MSG("press!\n");
|
||||
#ifdef BUTTON_PIN
|
||||
// If a nag notification is running, stop it
|
||||
if (externalNotificationModule->nagCycleCutoff != UINT32_MAX) {
|
||||
externalNotificationModule->nagCycleCutoff = 0;
|
||||
}
|
||||
if ((BUTTON_PIN != moduleConfig.canned_message.inputbroker_pin_press) ||
|
||||
!moduleConfig.canned_message.enabled) {
|
||||
powerFSM.trigger(EVENT_PRESS);
|
||||
|
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "mesh/Channels.h"
|
||||
#include "mesh/generated/deviceonly.pb.h"
|
||||
#include "modules/TextMessageModule.h"
|
||||
#include "modules/ExternalNotificationModule.h"
|
||||
#include "sleep.h"
|
||||
#include "target_specific.h"
|
||||
#include "utils.h"
|
||||
@ -1070,6 +1071,10 @@ int32_t Screen::runOnce()
|
||||
handleSetOn(false);
|
||||
break;
|
||||
case Cmd::ON_PRESS:
|
||||
// If a nag notification is running, stop it
|
||||
if (externalNotificationModule->nagCycleCutoff != UINT32_MAX) {
|
||||
externalNotificationModule->nagCycleCutoff = 0;
|
||||
}
|
||||
handleOnPress();
|
||||
break;
|
||||
case Cmd::START_BLUETOOTH_PIN_SCREEN:
|
||||
|
@ -38,6 +38,20 @@ int32_t ExternalNotificationModule::runOnce()
|
||||
return INT32_MAX; // we don't need this thread here...
|
||||
} else {
|
||||
|
||||
if (nagCycleCutoff < millis()) {
|
||||
nagCycleCutoff = UINT32_MAX;
|
||||
DEBUG_MSG("Turning off external notification: ");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (getExternal(i)) {
|
||||
setExternalOff(i);
|
||||
externalTurnedOn[i] = 0;
|
||||
DEBUG_MSG("%d ", i);
|
||||
}
|
||||
}
|
||||
DEBUG_MSG("\n");
|
||||
return INT32_MAX; // save cycles till we're needed again
|
||||
}
|
||||
|
||||
// If the output is turned on, turn it back off after the given period of time.
|
||||
if (nagCycleCutoff != UINT32_MAX) {
|
||||
if (externalTurnedOn[0] + (moduleConfig.external_notification.output_ms
|
||||
@ -56,20 +70,6 @@ int32_t ExternalNotificationModule::runOnce()
|
||||
getExternal(2) ? setExternalOff(2) : setExternalOn(2);
|
||||
}
|
||||
}
|
||||
|
||||
if (nagCycleCutoff < millis()) {
|
||||
nagCycleCutoff = UINT32_MAX;
|
||||
DEBUG_MSG("Turning off external notification: ");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (getExternal(i)) {
|
||||
setExternalOff(i);
|
||||
externalTurnedOn[i] = 0;
|
||||
DEBUG_MSG("%d ", i);
|
||||
}
|
||||
}
|
||||
DEBUG_MSG("\n");
|
||||
return INT32_MAX; // save cycles till we're needed again
|
||||
}
|
||||
return 25;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user