|
@@ -462,7 +462,6 @@ node.restore()
|
|
|
node.restart() -- ensure the restored settings take effect
|
|
|
```
|
|
|
|
|
|
-
|
|
|
## node.setcpufreq()
|
|
|
|
|
|
Change the working CPU Frequency.
|
|
@@ -481,6 +480,32 @@ target CPU frequency (number)
|
|
|
node.setcpufreq(node.CPU80MHZ)
|
|
|
```
|
|
|
|
|
|
+## node.setonerror()
|
|
|
+
|
|
|
+Use this to override the default "always restart" action if wanted; for example to write an error to a logfile or to a network syslog before restarting.
|
|
|
+
|
|
|
+!!! attention
|
|
|
+
|
|
|
+ It is strongly advised to ensure that the callback ends with a restart. Something has gone quite wrong and it is probably not safe to just wait for the next event (e.g., timer tick) and hope everything works out.
|
|
|
+
|
|
|
+#### Syntax
|
|
|
+`node.setonerror(function)`
|
|
|
+
|
|
|
+#### Parameters
|
|
|
+`function` a callback function to be executed when an error occurs, gets the error string as an argument, remember to **trigger a restart** at the end of the callback
|
|
|
+
|
|
|
+#### Returns
|
|
|
+`nil`
|
|
|
+
|
|
|
+#### Example
|
|
|
+```lua
|
|
|
+node.setonerror(function(s)
|
|
|
+ print("Error: "..s)
|
|
|
+ node.restart()
|
|
|
+ end)
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
## node.setpartitiontable()
|
|
|
|
|
|
Sets the current LFS and / or SPIFFS partition information.
|