2018-12-18, 02:27 PM
Well after some more testing I have an issue?
When the device is powered via USB it will run for days.
But when i use 12V power it crashes after about 12 hrs.
I checked the power supply, buck converter all seem well in spec range.
I turned debug on in the Arduino IDE and I am getting this error. every time i use the getLight function.
setting the timeout has no effect.
0x1006 is defined as
I dont know if this is my issue but it is the only error coming out of Debug.
The request is working and i get data back.
Here is the code i use.
When the device is powered via USB it will run for days.
But when i use 12V power it crashes after about 12 hrs.
I checked the power supply, buck converter all seem well in spec range.
I turned debug on in the Arduino IDE and I am getting this error. every time i use the getLight function.
setting the timeout has no effect.
Code:
[E][WiFiClient.cpp:236] setSocketOption(): 1006 : 9
Code:
#define SO_RCVTIMEO 0x1006 /* receive timeout */
The request is working and i get data back.
Here is the code i use.
Code:
void getlight()
{
uint16_t time = millis();
static uint16_t last_time;
uint16_t dt = time - last_time;
if (dt >= 1000) { // output every 1s
last_time += 1000;
if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
HTTPClient http;
//http.setTimeout(10000);
http.begin("http://192.168.1.7:3000/signalk/v1/api/vessels/self/sensors/anchorLight"); //Specify the URL
int httpCode = http.GET();
//Make the request
if (httpCode > 0) { //Check for the returning code
String payload = http.getString();
StaticJsonBuffer<500> jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(payload);
int code = root["value"];
http.end(); //Free the resources
if (code == 1) {
digitalWrite (ALT_PIN, HIGH); // turn on the LED
} else if (code == 0) {
digitalWrite (ALT_PIN, LOW); // turn off the LED
} else {
Serial.println("Fail");
}
return;
} else {
Serial.println("get http failed");
}
} else {
Serial.println("Error on HTTP request");
}
}
}