提交 6bf1d56e 编写于 作者: honorifica's avatar honorifica

应该解决了图传

上级 ff8530ef
......@@ -281,7 +281,7 @@ void picture_ctrl_start(void)//heart help -> picture
lv_obj_add_event_cb(btn_return, ui_dev_ctrl_page_return_click_cb, LV_EVENT_CLICKED, page);//return event
//image display
lv_obj_t *img = lv_img_create(page);
const char *file_name_with_path = "S:/spiffs/picture.jpg";
const char *file_name_with_path = "S:/spiffs/picture.png";
if (NULL != file_name_with_path)
{
lv_img_set_src(img, file_name_with_path);
......
......@@ -129,24 +129,25 @@ void * aedSocketMonitorFunc(void* args){
// recv(emergencyReponseSocket, imageByte, size, 0);
//文件接收的
imageByte=(uint8_t*)malloc(200);
FILE * image = fopen("/spiffs/picture.jpg","r");
FILE * image = fopen("/spiffs/picture.png","r");
fclose(image);
int left=size;
image = fopen("picture.png","wb+");//
while(left>0) {
image = fopen("/spiffs/picture.jpg","wb+");//
printf("剩余%d\n",left);
int recvLen=200<left?200:left;
left-=recvLen;
if(0 >= recv(emergencyReponseSocket, imageByte, recvLen, 0)){
printf("接收失败或者对端关闭连接!\n");
return 0;
}
fwrite(imageByte,1,recvLen,image);
fclose(image);
fwrite(imageByte,sizeof(uint8_t),recvLen,image);
fflush(image);
}
send(emergencyReponseSocket, flag, 1, 0);
recv(emergencyReponseSocket, flag, 1, 0);
//======================
printf("图片存储完成\n")
printf("图片存储完成\n");
gpio_set_direction(41, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_NUM_41, 1);//1为高电平,0为低电平
recv_warning_flag=1; //to stimulate the text shown in the text box(information)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册