How do I enable the reset reason feature?

I am running in “Semi Automatic” system mode and have system thread enabled.

Thanks.

You mean you are searching this
https://docs.particle.io/reference/firmware/photon/#reset-reason

This came up when using the search term reset reason via the search feature in the docs - this feature is actually open and meant for public use :wink:

1 Like

I am aware of the doc but I don’t see any info on how to use it in “Semi Automatic” system mode. It does not work for me in that mode.

STARTUP(System.enableFeature(FEATURE_RESET_INFO));
SYSTEM_THREAD(ENABLED); 
SYSTEM_MODE(SEMI_AUTOMATIC);

I wouldn’t see why the system mode would impact this feature :confused:

@rickkas7, an ideas?

I use this in all my apps. Works fine for me in all the MODES.

void resetReason(void)
{

	Serial.printf("Reset Reson is: ");

	switch( System.resetReason() )
	{
		case RESET_REASON_PIN_RESET:		Serial.printf("PIN_RESET"); break;
		case RESET_REASON_POWER_MANAGEMENT:	Serial.printf("POWER_MANAGEMENT");	break;
		case RESET_REASON_POWER_DOWN:		Serial.printf("POWER_DOWN"); break;
		case RESET_REASON_POWER_BROWNOUT:	Serial.printf("POWER_BROWNOUT"); break;
		case RESET_REASON_WATCHDOG:		Serial.printf("WATCHDOG"); break;
		case RESET_REASON_UPDATE:		Serial.printf("UPDATE"); break;
		case RESET_REASON_UPDATE_TIMEOUT:	Serial.printf("UPDATE_TIMEOUT"); break;
		case RESET_REASON_FACTORY_RESET:	Serial.printf("FACTORY_RESET"); break;
		case RESET_REASON_DFU_MODE:		Serial.printf("DFU_MODE"); break;
		case RESET_REASON_PANIC:		Serial.printf("PANIC"); break;
		case RESET_REASON_USER:			Serial.printf("USER"); break;
		case RESET_REASON_UNKNOWN:		Serial.printf("UNKNOWN"); break;
		case RESET_REASON_NONE:		 	Serial.printf("NONE"); break;
	}

	Serial.printf("\r\n");

}


void setup()
{
	// Show why we reset
	resetReason();


}
2 Likes