A59 -V1.1版本提交
This commit is contained in:
@ -580,6 +580,33 @@ static void usb_read_thread(void *para)
|
||||
status = usb_wait_stor_dev_pluged(portMAX_DELAY);
|
||||
if (status == USB_DEV_PLUGED) {
|
||||
printf("usb dev inserted.\n");
|
||||
FF_FILE *fp = ff_fopen("/usb/update.bin", "rb");
|
||||
if (fp) {
|
||||
UpFileHeader header;
|
||||
SysInfo *sysinfo = GetSysInfo();
|
||||
if (ff_fread(&header, 1, sizeof(header), fp) == sizeof(header)) {
|
||||
if (header.magic != MKTAG('U', 'P', 'D', 'F')) {
|
||||
printf("Wrong update file, don't update.\n");
|
||||
} else {
|
||||
if (header.checksum != sysinfo->app_checksum) {
|
||||
printf("found different update file(0x%x-0x%x), update...\n",
|
||||
header.checksum, sysinfo->app_checksum);
|
||||
sysinfo->update_media_type = UPDATE_MEDIA_USB;
|
||||
sysinfo->update_status = UPDATE_STATUS_START;
|
||||
SaveSysInfo();
|
||||
hub_usb_dev_reset();
|
||||
vTaskDelay(500);
|
||||
wdt_cpu_reboot();
|
||||
} else {
|
||||
printf("the update file version is same, don't update.\n");
|
||||
}
|
||||
}
|
||||
};
|
||||
ff_fclose(fp);
|
||||
} else {
|
||||
printf("open update.bin fail.\n");
|
||||
}
|
||||
/*printf("usb dev inserted.\n");
|
||||
#ifdef OTA_UPDATE_SUPPORT
|
||||
FF_FILE *fp = ff_fopen("/usb/update.bin", "rb");
|
||||
if (fp) {
|
||||
@ -635,7 +662,7 @@ static void usb_read_thread(void *para)
|
||||
} else {
|
||||
printf("open update.bin fail.\n");
|
||||
}
|
||||
#endif
|
||||
#endif*/
|
||||
} else if (status == USB_DEV_UNPLUGED) {
|
||||
printf("usb removed.\n");
|
||||
}
|
||||
@ -710,7 +737,7 @@ void awtk_thread(void *data)
|
||||
|
||||
|
||||
/* can demo */
|
||||
//can_demo();
|
||||
can_demo();
|
||||
|
||||
/* read sd card demo */
|
||||
#ifdef SDMMC_SUPPORT
|
||||
@ -785,13 +812,15 @@ void awtk_thread(void *data)
|
||||
extern int gui_app_start(int lcd_w, int lcd_h);
|
||||
gui_app_start (OSD_WIDTH, OSD_HEIGHT);
|
||||
#endif
|
||||
|
||||
// float cell = 0;
|
||||
// static float cell_value = 0;
|
||||
// static uint8_t cell_count = 0;
|
||||
|
||||
while(1) {
|
||||
|
||||
#ifdef TASK_STATUS_MONITOR
|
||||
static uint32_t idletick = 0;
|
||||
uint8_t CPU_RunInfo[1024];
|
||||
|
||||
if (xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 10) {
|
||||
memset(CPU_RunInfo,0,1024);
|
||||
vTaskList((char *)&CPU_RunInfo); //获取任务运行时间信息
|
||||
@ -807,6 +836,25 @@ void awtk_thread(void *data)
|
||||
idletick = xTaskGetTickCount();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*if ((xTaskGetTickCount() - idletick > configTICK_RATE_HZ*3) && (Get_sys_power_on_self_test() == 100)) {
|
||||
adc_light = adc_get_channel_value(ADC_CH_AUX2);//光感
|
||||
adc_voltage = adc_get_channel_value(ADC_CH_AUX3);//电压
|
||||
// DEBUG_PRINT("adc_light = %d ,adc_voltage = %d . ",adc_light,adc_voltage);
|
||||
idletick = xTaskGetTickCount();
|
||||
cell = adc_voltage_calculation();
|
||||
// DEBUG_PRINT("cell %lf .\r\n",cell);
|
||||
// cell_value += cell;
|
||||
// cell_count++;
|
||||
// if(cell_count>=8){
|
||||
// cell_value = cell_value/cell_count;
|
||||
// Set_sys_voltage(cell_value);
|
||||
// cell_value = 0;
|
||||
// cell_count = 0;
|
||||
// }
|
||||
Set_sys_voltage(cell);
|
||||
|
||||
}*/
|
||||
vTaskDelay(pdMS_TO_TICKS(10)); /*Just to let the system breath*/
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user