# resetReason() value decoder

**URL:** <https://community.particle.io/t/resetreason-value-decoder/53317>\
**Category:** Firmware\
**Created:** [November 15, 2019, 10:46pm UTC](https://community.particle.io/t/resetreason-value-decoder/53317 "2019-11-15T22:46:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adb](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adb](https://community.particle.io/u/adb)\
**Post date:** [November 15, 2019, 10:46pm UTC](https://community.particle.io/t/resetreason-value-decoder/53317/1 "2019-11-15T22:46:13Z")

</div>

I feel like this must be obvious to others, but where can I find the decoder to turn resetReason() numerical outputs into the text string that’s shown on the reference page?

For example, when I use a statement like `String(System.resetReason());` I just get an integer. What step am I missing?

Maybe there’s an ENUM list in particle.h? But where can I find particle.h? It’s not coming up in the library search in the online IDE.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [November 16, 2019, 4:16am UTC](https://community.particle.io/t/resetreason-value-decoder/53317/2 "2019-11-16T04:16:20Z")

</div>

In C/C++ `enum`s cannot be translated into clear text that simple.

But you can find `Particle.h` at [https://https](https://https)://github.com/particle-iot/device-os.  
However, `Particle.h` is only a collection of more `#include` statements and the `enum` you are looking for can be found here

> <https://github.com/particle-iot/device-os/blob/89a565058a6831c8cf8a81d5f5c0d51e08aa31fe/hal/inc/core_hal.h#L61>

---

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [November 16, 2019, 3:16pm UTC](https://community.particle.io/t/resetreason-value-decoder/53317/3 "2019-11-16T15:16:42Z")

</div>

Alternatively, if searching the device-os source code isn’t your thing you can write a little program to print them out to serial. For example:

```auto
STARTUP(System.enableFeature(FEATURE_RESET_INFO));

void setup()
{
Serial.begin();
while (!Serial.available()) Particle.process();
Serial.printlnf("Reset button or reset pin %i", RESET_REASON_PIN_RESET);
Serial.printlnf("Low-power management reset %i", RESET_REASON_POWER_MANAGEMENT);
Serial.printlnf("Power-down reset %i", RESET_REASON_POWER_DOWN);
Serial.printlnf("Brownout reset %i", RESET_REASON_POWER_BROWNOUT);
Serial.printlnf("Hardware watchdog reset %i", RESET_REASON_WATCHDOG);
Serial.printlnf("Successful firmware update %i", RESET_REASON_UPDATE);
Serial.printlnf("Firmware update timeout %i", RESET_REASON_UPDATE_TIMEOUT);
Serial.printlnf("Factory reset requested %i", RESET_REASON_FACTORY_RESET);
Serial.printlnf("Safe mode requested %i", RESET_REASON_SAFE_MODE);
Serial.printlnf("DFU mode requested %i", RESET_REASON_DFU_MODE);
Serial.printlnf("System panic %i", RESET_REASON_PANIC);
Serial.printlnf("User-requested reset %i", RESET_REASON_USER);
Serial.printlnf("Unspecified reset reason %i", RESET_REASON_UNKNOWN);
Serial.printlnf("Information is not available %i", RESET_REASON_NONE);
}

void loop()
{
}

```

---

<div class="post-metadata">

**Author:** ![adb](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adb](https://community.particle.io/u/adb)\
**Post date:** [December 5, 2019, 3:39pm UTC](https://community.particle.io/t/resetreason-value-decoder/53317/4 "2019-12-05T15:39:59Z")

</div>

Thanks, this is helpful. I’m trying to create a reviewable log of reset events (and other status info) and thought it would be nice to have the reason code intelligible to folks not as familiar with the Particle documentation. I was considering making the translation to text on the device, but it seems more efficient to publish the codes to a Google sheet and then do the translation there.

It’s always interesting to see how much of a project ends up being stuff related to robustness and crash handling, versus the actual task you wanted to perform.
