35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
|
#include "statusmonitor.h"
|
||
|
|
||
|
PowerOffData power_off_data;
|
||
|
|
||
|
char ptz_power_off_data_save(unsigned short int add)
|
||
|
{
|
||
|
PowerOffData power_off_data_b;
|
||
|
|
||
|
int i;
|
||
|
|
||
|
memcpy(&power_off_data.hori_as5047d, &g_ptz.hori_as5047d, sizeof(g_ptz.hori_as5047d));
|
||
|
memcpy(&power_off_data.vert_as5047d, &g_ptz.vert_as5047d, sizeof(g_ptz.vert_as5047d));
|
||
|
|
||
|
power_off_data.vert_angle = g_ptz.vert_angle_actual;
|
||
|
power_off_data.hori_angle = g_ptz.hori_angle_actual;
|
||
|
|
||
|
|
||
|
for(i = 0; i < PTZ_POWER_OFF_DATA_SAVE_NUM; i++)
|
||
|
{
|
||
|
memset(&power_off_data_b, 0, sizeof(power_off_data_b));
|
||
|
mb85rc64_write_read(add, (unsigned char *)&power_off_data, sizeof(power_off_data), PAGE_WRITE);
|
||
|
mb85rc64_write_read(add, (unsigned char *)&power_off_data_b, sizeof(power_off_data_b), ADDR_READ);
|
||
|
|
||
|
// mb85rc64_page_write(add, (unsigned char *)&power_off_data, sizeof(power_off_data));
|
||
|
// mb85rc64_add_read(add, (unsigned char *)&power_off_data_b, sizeof(power_off_data_b));
|
||
|
if(memcmp(&power_off_data_b, &power_off_data, sizeof(power_off_data)) == 0)//判断擦除数据是否正确
|
||
|
{
|
||
|
BSP_OS_SemPost(&ptz_power_off_mutex);
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
BSP_OS_SemPost(&ptz_power_off_mutex);
|
||
|
return 0;
|
||
|
}
|