I have noticed that everytime I reboot my Pi, the firmware is reset to Tinker.
Here is what I find in particle-agent logs
:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): resolve: Host not found (non-authoritative), try again later
Firmware exited with status pid 879 SIGABRT (signal 6)
Quitting firmware gracefully
Entering safe mode because firmware exited too many times in a row. Reverting to Tinker
This was happening with this code which uses stream to write to a file:
#include "Particle.h"
#include <iostream>
#include <fstream>
using namespace std;
ofstream myfile;
#define FILENAME "/home/pi/log.txt"
int writeToFile(String message)
{
message.concat("\n");
myfile.open(FILENAME, ios::app);
char * cstr = new char [message.length()+1];
std::strcpy (cstr, message.c_str());
myfile << cstr;
myfile.close();
return 0;
}
void setup()
{
Particle.function("write", writeToFile);
}
void loop()
{
}
As well as this code which uses Process control to call a python script:
#include "Particle.h"
void setup()
{
}
void loop() {
Process proc = Process::run("/home/pi/bitcoin.py");
proc.wait();
String price = proc.out().readStringUntil('\n');
Particle.publish("price", price);
delay(5000);
}
Even something as simple as this crashes with the same error and gets replaced by tinker on reboot:
#include "Particle.h"
void setup() // Put setup code here to run once
{
pinMode(GPIO18, OUTPUT);
digitalWrite(GPIO18, HIGH);
}
void loop() // Put code here to loop forever
{
}
@jvanier are you experiencing this?