 			break;
 
 		case ERROR_MODE:
+			if (oldFsmState != fsmState)
+			{	
+				display.writeMessage("ERRO");
+				Serial.println("Error detected, disabling buttons.");
+				Serial.println("Error detected, disabling RTC alarm.");
+				disableRtcAlarm();
+			}
+			break;
+
 		default:
 			break;
 	}

				disableRtcAlarm();
				for (int i = 0; i < N; i++)
					display.disableDecimalPoint(i);
			} else 
			{
				enableRtcAlarm();
				for (int i = 0; i < N; i++)
					display.enableDecimalPoint(i);
			}
			break;


	// save alarm setting to parts of SRAM, easier retrieval
	RTC.sramWrite(ALARM_H_ADDR, hour);
	RTC.sramWrite(ALARM_M_ADDR, minute);
}

// Debug statements, print new alarm / status to serial port.
void printAlarmStatus()
{
	byte h, m, rtcOn;
	Serial.print("New alarm time: ");
	h = RTC.sramRead(ALARM_H_ADDR);
	Serial.print(h);
	Serial.print(":");
	m = RTC.sramRead(ALARM_M_ADDR);
	Serial.print(m);
	rtcOn = isRtcAlarmOn();
	if (rtcOn)
		Serial.println(" -- ON");
	else
		Serial.println(" -- OFF");
}

// ---------------------- //
