@@ -162,10 +162,12 @@ int breatheintensity = 1;
162
162
#define LED_SAFE_MODE 7 // Magenta breath
163
163
#define LED_FIRMWARE_DFU 8 // Yellow
164
164
#define LED_ERROR 9 // Red
165
+ #define LED_ORANGE 10 // Orange
165
166
166
167
// --------------------------------------------------------------------------------------------
167
168
// Buzzer Alarm
168
- void EarthquakeAlarm ();
169
+ bool bStopEarthquakeAlarm = false ;
170
+ void EarthquakeAlarm ( int );
169
171
void AlarmBuzzer ();
170
172
int freq = 4000 ;
171
173
int channel = 0 ;
@@ -242,8 +244,22 @@ void callback(char* topic, byte* payload, unsigned int length) {
242
244
} else {
243
245
JsonObject cmdData = jsonMQTTReceiveDoc.as <JsonObject>();
244
246
if ( strcmp (topic, MQTT_TOPIC_ALARM) == 0 ) {
245
- // Sound the Buzzer & Blink the LED
246
- EarthquakeAlarm ();
247
+ // {Alarm:[true|test|false]}
248
+ String AlarmType = cmdData[" Alarm" ].as <String>() ;
249
+ Serial.println ( " Alarm received: " + AlarmType );
250
+ if ( AlarmType.equalsIgnoreCase (" true" ) ) {
251
+ // Sound the Buzzer & Blink the LED RED
252
+ bStopEarthquakeAlarm = false ;
253
+ EarthquakeAlarm ( LED_ERROR);
254
+ bStopEarthquakeAlarm = false ;
255
+ } else if ( AlarmType.equalsIgnoreCase (" test" ) ) {
256
+ // Sound the Buzzer & Blink the LED ORANGE
257
+ bStopEarthquakeAlarm = false ;
258
+ EarthquakeAlarm ( LED_ORANGE );
259
+ bStopEarthquakeAlarm = false ;
260
+ }else if ( AlarmType.equalsIgnoreCase (" false" ) ) {
261
+ bStopEarthquakeAlarm = true ;
262
+ }
247
263
} else if ( strcmp (topic, MQTT_TOPIC_FWCHECK) == 0 ) {
248
264
// Remote message received to check for new firmware
249
265
// If a device is running for many months it might fall behind on the version of the
@@ -1254,6 +1270,10 @@ void NeoPixelStatus( int status ) {
1254
1270
strip.fill ( strip.Color (255 ,255 ,0 ), 0 , 3 ); // Yellow
1255
1271
Serial.println (" LED_FIRMWARE_DFU - Yellow" );
1256
1272
break ;
1273
+ case LED_ORANGE :
1274
+ strip.fill ( strip.Color (255 ,165 ,0 ), 0 , 3 ); // Red
1275
+ Serial.println (" LED_ORANGE - Orange" );
1276
+ break ;
1257
1277
case LED_ERROR :
1258
1278
strip.fill ( strip.Color (255 ,0 ,0 ), 0 , 3 ); // Red
1259
1279
Serial.println (" LED_ERROR - Red" );
0 commit comments