change sending data to connect
parent
d03f41bd64
commit
532ed3e46f
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
Board configuration in the arduino IDE 2.3.2
|
Board configuration in the arduino IDE 2.3.2
|
||||||
Tools -> Board -> ESP32 Arduino -> AI Thinker ESP32
|
Tools -> Board -> ESP32 Arduino -> AI Thinker ESP32
|
||||||
|
Tools -> CPU Frequency -> 240MHz (WiFi/BT)
|
||||||
|
Tools -> Core debug level -> None
|
||||||
Tools -> Flash frequency -> 80MHz
|
Tools -> Flash frequency -> 80MHz
|
||||||
Tools -> Flash Mode -> DIO
|
Tools -> Flash Mode -> DIO
|
||||||
Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||||
|
|
@ -103,6 +105,7 @@ void setup() {
|
||||||
/* init camera interface */
|
/* init camera interface */
|
||||||
SystemCamera.Init();
|
SystemCamera.Init();
|
||||||
SystemCamera.CapturePhoto();
|
SystemCamera.CapturePhoto();
|
||||||
|
SystemCamera.CaptureReturnFrameBuffer();
|
||||||
|
|
||||||
/* init WEB server */
|
/* init WEB server */
|
||||||
Server_InitWebServer();
|
Server_InitWebServer();
|
||||||
|
|
@ -113,7 +116,7 @@ void setup() {
|
||||||
/* init tasks */
|
/* init tasks */
|
||||||
SystemLog.AddEvent(LogLevel_Info, F("Start tasks"));
|
SystemLog.AddEvent(LogLevel_Info, F("Start tasks"));
|
||||||
xTaskCreatePinnedToCore(System_TaskMain, "SystemNtpOtaUpdate", 8000, NULL, 1, &Task_SystemMain, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskMain, "SystemNtpOtaUpdate", 8000, NULL, 1, &Task_SystemMain, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskCaptureAndSendPhoto, "CaptureAndSendPhoto", 6000, NULL, 2, &Task_CapturePhotoAndSend, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskCaptureAndSendPhoto, "CaptureAndSendPhoto", 8000, NULL, 2, &Task_CapturePhotoAndSend, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskWifiManagement, "WiFiManagement", 3800, NULL, 3, &Task_WiFiManagement, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskWifiManagement, "WiFiManagement", 3800, NULL, 3, &Task_WiFiManagement, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskSdCardCheck, "CheckMicroSdCard", 3300, NULL, 4, &Task_SdCardCheck, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSdCardCheck, "CheckMicroSdCard", 3300, NULL, 4, &Task_SdCardCheck, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 3300, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 3300, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,10 @@ void Camera::InitCameraModule() {
|
||||||
FRAMESIZE_UXGA (1600 x 1200)
|
FRAMESIZE_UXGA (1600 x 1200)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CameraConfig.frame_size = TFrameSize; /* FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA */
|
CameraConfig.frame_size = TFrameSize; /* FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA */
|
||||||
CameraConfig.jpeg_quality = PhotoQuality; /* 10-63 lower number means higher quality */
|
CameraConfig.jpeg_quality = PhotoQuality; /* 10-63 lower number means higher quality */
|
||||||
CameraConfig.fb_count = 1; /* picture frame buffer alocation */
|
CameraConfig.fb_count = 1; /* picture frame buffer alocation */
|
||||||
CameraConfig.grab_mode = CAMERA_GRAB_LATEST; /* CAMERA_GRAB_WHEN_EMPTY or CAMERA_GRAB_LATEST */
|
CameraConfig.grab_mode = CAMERA_GRAB_LATEST; /* CAMERA_GRAB_WHEN_EMPTY or CAMERA_GRAB_LATEST */
|
||||||
|
|
||||||
if (CameraConfig.fb_location == CAMERA_FB_IN_DRAM) {
|
if (CameraConfig.fb_location == CAMERA_FB_IN_DRAM) {
|
||||||
log->AddEvent(LogLevel_Verbose, F("Camera frame buffer location: DRAM"));
|
log->AddEvent(LogLevel_Verbose, F("Camera frame buffer location: DRAM"));
|
||||||
|
|
@ -173,7 +173,7 @@ framesize_t Camera::TransformFrameSizeDataType(uint8_t i_data) {
|
||||||
ret = FRAMESIZE_QVGA;
|
ret = FRAMESIZE_QVGA;
|
||||||
log->AddEvent(LogLevel_Warning, "Bad frame size. Set default value. " + String(i_data));
|
log->AddEvent(LogLevel_Warning, "Bad frame size. Set default value. " + String(i_data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -272,12 +272,20 @@ void Camera::CapturePhoto() {
|
||||||
delay(CameraFlashTime);
|
delay(CameraFlashTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Capturing a training photo. Without this sequence, the camera will not obtain the current photo but photo from the previous cycle. */
|
||||||
|
FrameBuffer = esp_camera_fb_get();
|
||||||
|
if (FrameBuffer) {
|
||||||
|
esp_camera_fb_return(FrameBuffer);
|
||||||
|
} else {
|
||||||
|
log->AddEvent(LogLevel_Error, F("Camera capture failed training photo"));
|
||||||
|
}
|
||||||
|
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
const int maxAttempts = 5;
|
const int maxAttempts = 5;
|
||||||
do {
|
do {
|
||||||
log->AddEvent(LogLevel_Info, F("Taking photo..."));
|
log->AddEvent(LogLevel_Info, F("Taking photo..."));
|
||||||
|
|
||||||
delay(5); // delay for camera stabilization. test it
|
delay(5); // delay for camera stabilization. test it
|
||||||
FrameBuffer = esp_camera_fb_get();
|
FrameBuffer = esp_camera_fb_get();
|
||||||
if (!FrameBuffer) {
|
if (!FrameBuffer) {
|
||||||
log->AddEvent(LogLevel_Error, F("Camera capture failed! photo"));
|
log->AddEvent(LogLevel_Error, F("Camera capture failed! photo"));
|
||||||
|
|
@ -297,8 +305,6 @@ void Camera::CapturePhoto() {
|
||||||
log->AddEvent(LogLevel_Info, "Photo OK! " + String(ControlFlag, HEX));
|
log->AddEvent(LogLevel_Info, "Photo OK! " + String(ControlFlag, HEX));
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_camera_fb_return(FrameBuffer);
|
|
||||||
|
|
||||||
attempts++;
|
attempts++;
|
||||||
if (attempts >= maxAttempts) {
|
if (attempts >= maxAttempts) {
|
||||||
log->AddEvent(LogLevel_Error, F("Failed to capture a valid photo after max attempts"));
|
log->AddEvent(LogLevel_Error, F("Failed to capture a valid photo after max attempts"));
|
||||||
|
|
@ -464,11 +470,24 @@ void Camera::CopyPhoto(String* i_data) {
|
||||||
* @param i_to - end index
|
* @param i_to - end index
|
||||||
*/
|
*/
|
||||||
void Camera::CopyPhoto(String* i_data, int i_from, int i_to) {
|
void Camera::CopyPhoto(String* i_data, int i_from, int i_to) {
|
||||||
Photo = "";
|
*i_data = "";
|
||||||
for (size_t i = i_from; i < i_to; i++) {
|
|
||||||
Photo += (char)FrameBuffer->buf[i];
|
for (int i = i_from; i < i_to; i++) {
|
||||||
|
*i_data += (char)FrameBuffer->buf[i];
|
||||||
}
|
}
|
||||||
*i_data = Photo;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy photo from frame buffer to char array with range
|
||||||
|
*
|
||||||
|
* @param i_data - pointer to char array
|
||||||
|
* @param i_from - start index
|
||||||
|
* @param i_to - end index
|
||||||
|
*/
|
||||||
|
void Camera::CopyPhoto(char* i_data, int i_from, int i_to) {
|
||||||
|
int length = i_to - i_from;
|
||||||
|
memcpy(i_data, FrameBuffer->buf + i_from, length);
|
||||||
|
i_data[length + 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -478,7 +497,7 @@ void Camera::CopyPhoto(String* i_data, int i_from, int i_to) {
|
||||||
*/
|
*/
|
||||||
int Camera::GetPhotoSize() {
|
int Camera::GetPhotoSize() {
|
||||||
log->AddEvent(LogLevel_Verbose, "Photo size: " + String(FrameBuffer->len));
|
log->AddEvent(LogLevel_Verbose, "Photo size: " + String(FrameBuffer->len));
|
||||||
return (int) FrameBuffer->len;
|
return (int)FrameBuffer->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -754,35 +773,35 @@ uint8_t Camera::GetFrameSize() {
|
||||||
* @return uint16_t
|
* @return uint16_t
|
||||||
*/
|
*/
|
||||||
uint16_t Camera::GetFrameSizeWidth() {
|
uint16_t Camera::GetFrameSizeWidth() {
|
||||||
uint16_t ret = 0;
|
uint16_t ret = 0;
|
||||||
|
|
||||||
switch (FrameSize) {
|
switch (FrameSize) {
|
||||||
case 0:
|
case 0:
|
||||||
ret = 320;
|
ret = 320;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ret = 352;
|
ret = 352;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ret = 640;
|
ret = 640;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ret = 800;
|
ret = 800;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
ret = 1024;
|
ret = 1024;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ret = 1280;
|
ret = 1280;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
ret = 1600;
|
ret = 1600;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = 320;
|
ret = 320;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -820,7 +839,7 @@ uint16_t Camera::GetFrameSizeHeight() {
|
||||||
case 5:
|
case 5:
|
||||||
ret = 1024;
|
ret = 1024;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
ret = 1200;
|
ret = 1200;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -1011,4 +1030,4 @@ uint16_t Camera::GetCameraFlashTime() {
|
||||||
return CameraFlashTime;
|
return CameraFlashTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
@ -88,6 +88,7 @@ public:
|
||||||
void CopyPhoto(camera_fb_t *);
|
void CopyPhoto(camera_fb_t *);
|
||||||
void CopyPhoto(String*);
|
void CopyPhoto(String*);
|
||||||
void CopyPhoto(String*, int, int);
|
void CopyPhoto(String*, int, int);
|
||||||
|
void CopyPhoto(char*, int, int);
|
||||||
int GetPhotoSize();
|
int GetPhotoSize();
|
||||||
String GetPhoto();
|
String GetPhoto();
|
||||||
camera_fb_t *GetPhotoFb();
|
camera_fb_t *GetPhotoFb();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ PrusaConnect::PrusaConnect(Configuration *i_conf, Logs *i_log, Camera *i_camera)
|
||||||
*/
|
*/
|
||||||
void PrusaConnect::Init() {
|
void PrusaConnect::Init() {
|
||||||
log->AddEvent(LogLevel_Info, F("Init PrusaConnect lib"));
|
log->AddEvent(LogLevel_Info, F("Init PrusaConnect lib"));
|
||||||
TakePicture();
|
//camera->CapturePhoto();
|
||||||
|
//camera->CaptureReturnFrameBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -83,7 +84,10 @@ bool PrusaConnect::SendDataToBackend(String *i_data, int i_data_length, String i
|
||||||
/* check fingerprint and token length */
|
/* check fingerprint and token length */
|
||||||
if ((Fingerprint.length() > 0) && (Token.length() > 0)) {
|
if ((Fingerprint.length() > 0) && (Token.length() > 0)) {
|
||||||
client.setCACert(root_CAs);
|
client.setCACert(root_CAs);
|
||||||
|
//client.setInsecure();
|
||||||
client.setTimeout(1000);
|
client.setTimeout(1000);
|
||||||
|
client.setNoDelay(true);
|
||||||
|
|
||||||
log->AddEvent(LogLevel_Verbose, F("Connecting to server..."));
|
log->AddEvent(LogLevel_Verbose, F("Connecting to server..."));
|
||||||
|
|
||||||
/* connecting to server */
|
/* connecting to server */
|
||||||
|
|
@ -102,7 +106,7 @@ bool PrusaConnect::SendDataToBackend(String *i_data, int i_data_length, String i
|
||||||
} else {
|
} else {
|
||||||
/* send data to server */
|
/* send data to server */
|
||||||
log->AddEvent(LogLevel_Verbose, F("Connected to server!"));
|
log->AddEvent(LogLevel_Verbose, F("Connected to server!"));
|
||||||
client.println("PUT https://" + PrusaConnectHostname + i_url_path + " HTTP/1.0");
|
client.println("PUT https://" + PrusaConnectHostname + i_url_path + " HTTP/1.1");
|
||||||
client.println("Host: " + PrusaConnectHostname);
|
client.println("Host: " + PrusaConnectHostname);
|
||||||
client.println("User-Agent: ESP32-CAM");
|
client.println("User-Agent: ESP32-CAM");
|
||||||
client.println("Connection: close");
|
client.println("Connection: close");
|
||||||
|
|
@ -114,32 +118,36 @@ bool PrusaConnect::SendDataToBackend(String *i_data, int i_data_length, String i
|
||||||
client.println();
|
client.println();
|
||||||
|
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
|
size_t sendet_data = 0;
|
||||||
/* sending photo */
|
/* sending photo */
|
||||||
if (SendPhoto == i_data_type) {
|
if (SendPhoto == i_data_type) {
|
||||||
log->AddEvent(LogLevel_Verbose, F("Send data photo"));
|
log->AddEvent(LogLevel_Verbose, F("Send data photo"));
|
||||||
int index = 0;
|
|
||||||
/* send data in fragments */
|
/* sending photo */
|
||||||
for (index = 0; index < i_data_length; index += PHOTO_FRAGMENT_SIZE) {
|
uint8_t *fbBuf = camera->GetPhotoFb()->buf;
|
||||||
camera->CopyPhoto(i_data, index, index + PHOTO_FRAGMENT_SIZE);
|
size_t fbLen = camera->GetPhotoFb()->len;
|
||||||
client.print(*i_data);
|
for (size_t i=0; i < fbLen; i += PHOTO_FRAGMENT_SIZE) {
|
||||||
log->AddEvent(LogLevel_Verbose, String(i_data_length) + "/" + String(index));
|
if ((i + PHOTO_FRAGMENT_SIZE) < fbLen) {
|
||||||
|
sendet_data += client.write(fbBuf, PHOTO_FRAGMENT_SIZE);
|
||||||
|
fbBuf += PHOTO_FRAGMENT_SIZE;
|
||||||
|
|
||||||
|
} else if ((fbLen % PHOTO_FRAGMENT_SIZE) > 0) {
|
||||||
|
size_t remainder = fbLen % PHOTO_FRAGMENT_SIZE;
|
||||||
|
sendet_data += client.write(fbBuf, remainder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send rest of data */
|
client.println("\r\n");
|
||||||
index -= PHOTO_FRAGMENT_SIZE;
|
client.flush();
|
||||||
if ((i_data_length > index) && ((i_data_length - index) > 0)) {
|
log->AddEvent(LogLevel_Verbose, String(i_data_length) + "/" + String(sendet_data));
|
||||||
camera->CopyPhoto(i_data, index, i_data_length);
|
|
||||||
client.print(*i_data);
|
|
||||||
log->AddEvent(LogLevel_Verbose, String(i_data_length) + "/" + String(i_data_length));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sending device information */
|
/* sending device information */
|
||||||
} else if (SendInfo == i_data_type) {
|
} else if (SendInfo == i_data_type) {
|
||||||
log->AddEvent(LogLevel_Verbose, F("Send data info"));
|
log->AddEvent(LogLevel_Verbose, F("Send data info"));
|
||||||
client.print(*i_data);
|
sendet_data = client.print(*i_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
log->AddEvent(LogLevel_Info, "Send done: " + String(i_data_length) + " bytes");
|
log->AddEvent(LogLevel_Info, "Send done: " + String(sendet_data) + " bytes");
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
|
|
||||||
/* read response from server */
|
/* read response from server */
|
||||||
|
|
@ -194,7 +202,7 @@ bool PrusaConnect::SendDataToBackend(String *i_data, int i_data_length, String i
|
||||||
void PrusaConnect::SendPhotoToBackend() {
|
void PrusaConnect::SendPhotoToBackend() {
|
||||||
log->AddEvent(LogLevel_Info, F("Start sending photo to prusaconnect"));
|
log->AddEvent(LogLevel_Info, F("Start sending photo to prusaconnect"));
|
||||||
String Photo = "";
|
String Photo = "";
|
||||||
SendDataToBackend(&Photo, camera->GetPhotoSize(), "image/jpg", "Photo", HOST_URL_CAM_PATH, SendPhoto);
|
SendDataToBackend(&Photo, camera->GetPhotoFb()->len, "image/jpg", "Photo", HOST_URL_CAM_PATH, SendPhoto);
|
||||||
SystemLog.AddEvent(LogLevel_Info, "Free RAM: " + String(ESP.getFreeHeap()) + " bytes");
|
SystemLog.AddEvent(LogLevel_Info, "Free RAM: " + String(ESP.getFreeHeap()) + " bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,8 +249,9 @@ void PrusaConnect::SendInfoToBackend() {
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
void PrusaConnect::TakePictureAndSendToBackend() {
|
void PrusaConnect::TakePictureAndSendToBackend() {
|
||||||
TakePicture();
|
camera->CapturePhoto();
|
||||||
SendPhotoToBackend();
|
SendPhotoToBackend();
|
||||||
|
camera->CaptureReturnFrameBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#define _MCU_CFG_H_
|
#define _MCU_CFG_H_
|
||||||
|
|
||||||
/* ---------------- BASIC MCU CFG --------------*/
|
/* ---------------- BASIC MCU CFG --------------*/
|
||||||
#define SW_VERSION "1.0.2-rc1" ///< SW version
|
#define SW_VERSION "1.0.2-rc2" ///< SW version
|
||||||
#define SW_BUILD __DATE__ " " __TIME__ ///< build number
|
#define SW_BUILD __DATE__ " " __TIME__ ///< build number
|
||||||
#define CONSOLE_VERBOSE_DEBUG false ///< enable/disable verbose debug log level for console
|
#define CONSOLE_VERBOSE_DEBUG false ///< enable/disable verbose debug log level for console
|
||||||
#define DEVICE_HOSTNAME "Prusa-ESP32cam" ///< device hostname
|
#define DEVICE_HOSTNAME "Prusa-ESP32cam" ///< device hostname
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
#define WEB_SERVER_PORT 80 ///< WEB server port
|
#define WEB_SERVER_PORT 80 ///< WEB server port
|
||||||
#define SERIAL_PORT_SPEED 115200 ///< baud rate
|
#define SERIAL_PORT_SPEED 115200 ///< baud rate
|
||||||
#define WDG_TIMEOUT 40 ///< wdg timeout [second]
|
#define WDG_TIMEOUT 40 ///< wdg timeout [second]
|
||||||
#define PHOTO_FRAGMENT_SIZE 5000 ///< photo fragmentation size [bytes]
|
#define PHOTO_FRAGMENT_SIZE 1024 ///< photo fragmentation size [bytes]
|
||||||
#define LOOP_DELAY 100 ///< loop delay [ms]
|
#define LOOP_DELAY 100 ///< loop delay [ms]
|
||||||
#define WIFI_CLIENT_WAIT_CON false ///< wait for connecting to WiFi network
|
#define WIFI_CLIENT_WAIT_CON false ///< wait for connecting to WiFi network
|
||||||
#define DYNMIC_JSON_SIZE 1024 ///< maximum size for dynamic json [bytes]
|
#define DYNMIC_JSON_SIZE 1024 ///< maximum size for dynamic json [bytes]
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ void Server_InitWebServer() {
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, "Photo size: " + String(SystemCamera.GetPhotoFb()->len) + " bytes");
|
||||||
request->send_P(200, "image/jpg", SystemCamera.GetPhotoFb()->buf, SystemCamera.GetPhotoFb()->len);
|
request->send_P(200, "image/jpg", SystemCamera.GetPhotoFb()->buf, SystemCamera.GetPhotoFb()->len);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -667,7 +668,7 @@ void Server_InitWebServer_Sets() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* route for set prusa connect hostname */
|
/* route for set prusa connect hostname /set_hostname?hostname=*/
|
||||||
server.on("/set_hostname", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/set_hostname", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /set_hostname"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /set_hostname"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
|
|
||||||
|
|
@ -500,12 +500,14 @@ void System_TaskCaptureAndSendPhoto(void *pvParameters) {
|
||||||
Connect.SetSendingIntervalCounter(0);
|
Connect.SetSendingIntervalCounter(0);
|
||||||
/* send network information to backend */
|
/* send network information to backend */
|
||||||
if ((WL_CONNECTED == WiFi.status()) && (false == FirmwareUpdate.Processing)) {
|
if ((WL_CONNECTED == WiFi.status()) && (false == FirmwareUpdate.Processing)) {
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, F("Task photo processing. Start sending info"));
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
Connect.SendInfoToBackend();
|
Connect.SendInfoToBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send photo to backend*/
|
/* send photo to backend*/
|
||||||
if ((WL_CONNECTED == WiFi.status()) && (false == FirmwareUpdate.Processing)) {
|
if ((WL_CONNECTED == WiFi.status()) && (false == FirmwareUpdate.Processing)) {
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, F("Task photo processing. Start sending photo"));
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
Connect.TakePictureAndSendToBackend();
|
Connect.TakePictureAndSendToBackend();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue