@@ -86,6 +86,7 @@ static void alertAggregationTask(void* parameter) {
8686 update.displayId = g_activeList[g_rotateIdx];
8787 update.displayLevel = g_currentLevels[g_activeList[g_rotateIdx]];
8888 update.displayCritical = g_showingCrit;
89+ update.criticalAlertsActive = (g_currentCounts.criticalCount > 0 );
8990 update.updateEpoch = g_epoch;
9091 if (alertUIQueue) {
9192 xQueueOverwrite (alertUIQueue, &update);
@@ -99,6 +100,7 @@ static void alertAggregationTask(void* parameter) {
99100 AlertUIUpdate update;
100101 update.counts = g_currentCounts;
101102 update.showDisplay = false ;
103+ update.criticalAlertsActive = (g_currentCounts.criticalCount > 0 );
102104 update.updateEpoch = g_epoch;
103105 if (alertUIQueue) xQueueOverwrite (alertUIQueue, &update);
104106 hideSent = true ;
@@ -154,6 +156,7 @@ static void recalcCountsAndPublish() {
154156
155157 AlertUIUpdate update;
156158 update.counts = g_currentCounts;
159+ update.criticalAlertsActive = (g_currentCounts.criticalCount > 0 );
157160 update.updateEpoch = g_epoch;
158161
159162 if (g_activeList.empty ()) {
@@ -165,6 +168,9 @@ static void recalcCountsAndPublish() {
165168 update.displayCritical = g_showingCrit;
166169 }
167170
171+ USBSerial.printf (" [Alert] Sending UI update: crit=%d warn=%d critActive=%d\n " ,
172+ update.counts .criticalCount , update.counts .warningCount , update.criticalAlertsActive );
173+
168174 if (alertUIQueue) {
169175 xQueueOverwrite (alertUIQueue, &update);
170176 }
@@ -187,25 +193,16 @@ static void recalcCountsAndPublish() {
187193
188194/* *
189195 * Handle vibration alerts based on state transitions
196+ * Note: This now only handles one-shot vibration patterns.
197+ * Critical alert border/vibration is handled by UI task based on criticalAlertsActive flag.
190198 */
191199static void handleAlertVibration (const AlertCounts& newCounts, const AlertCounts& previousCounts) {
192- if (newCounts.criticalCount > 0 ) {
193- // Use the new synchronized alert service
194- if (!isCriticalAlertActive ()) {
195- startCriticalAlerts ();
196- }
197- } else {
198- // Stop synchronized alerts if no critical alerts remain
199- if (isCriticalAlertActive ()) {
200- stopCriticalAlerts ();
201- }
202-
203- // Handle warning transitions (only when no critical alerts)
204- if (previousCounts.warningCount == 0 && newCounts.warningCount > 0 ) {
205- // Short delay to sync with UI
206- vTaskDelay (pdMS_TO_TICKS (250 ));
207- // Transition from 0 warnings to >0 warnings - trigger double pulse
208- executeVibePattern (VIBE_DOUBLE_PULSE);
209- }
200+ // Handle warning transitions (only when no critical alerts)
201+ if (newCounts.criticalCount == 0 &&
202+ previousCounts.warningCount == 0 && newCounts.warningCount > 0 ) {
203+ // Short delay to sync with UI
204+ vTaskDelay (pdMS_TO_TICKS (100 ));
205+ // Transition from 0 warnings to >0 warnings - trigger double pulse
206+ executeVibePattern (VIBE_DOUBLE_PULSE);
210207 }
211208}
0 commit comments