Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify sensor initialize function #317

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions common/service/sensor/sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ static bool sensor_poll_enable_flag = true;

static bool is_sensor_ready_flag = false;

const int negative_ten_power[16] = { 1, 1, 1, 1, 1, 1,
1, 1000000000, 100000000, 10000000, 1000000, 100000,
10000, 1000, 100, 10 };
const int negative_ten_power[16] = { 1, 1, 1, 1, 1, 1,
1, 1000000000, 100000000, 10000000, 1000000, 100000,
10000, 1000, 100, 10 };

sensor_cfg *sensor_config;
uint8_t sensor_config_num;
Expand Down Expand Up @@ -284,22 +284,22 @@ __weak void pal_fix_sensor_config(void)
return;
}

bool stby_access(uint8_t sensor_number)
bool stby_access(uint8_t sensor_num)
{
return true;
}

bool dc_access(uint8_t sensor_number)
bool dc_access(uint8_t sensor_num)
{
return get_DC_on_delayed_status();
}

bool post_access(uint8_t sensor_number)
bool post_access(uint8_t sensor_num)
{
return get_post_status();
}

bool me_access(uint8_t sensor_number)
bool me_access(uint8_t sensor_num)
{
if (get_me_mode() == ME_NORMAL_MODE) {
return get_post_status();
Expand Down Expand Up @@ -364,6 +364,13 @@ static void drive_init(void)
sensor_cfg *p = sensor_config + i;
for (j = 0; j < drive_num; j++) {
if (p->type == sensor_drive_tbl[j].dev) {
if (p->pre_sensor_read_hook) {
if (p->pre_sensor_read_hook(
p->num, p->pre_sensor_read_args) == false) {
printk("[%s] sensor %d pre sensor read failed!\n",
__func__, p->num);
}
}
ret = sensor_drive_tbl[j].init(p->num);
if (ret != SENSOR_INIT_SUCCESS)
printf("sensor num %d initial fail, ret %d\n", p->num, ret);
Expand Down