File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
utilities/BMM150-Sensor-API Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -60,21 +60,23 @@ int BoschSensorClass::begin() {
6060 mag_dev_info._wire = _wire;
6161 mag_dev_info.dev_addr = bmm1.chip_id ;
6262
63- int8_t rslt = bmi270_init (&bmi2);
64- print_rslt (rslt );
63+ int8_t bmi270InitResult = bmi270_init (&bmi2);
64+ print_rslt (bmi270InitResult );
6565
66- rslt = configure_sensor (&bmi2);
67- print_rslt (rslt );
66+ int8_t bmi270ConfigResult = configure_sensor (&bmi2);
67+ print_rslt (bmi270ConfigResult );
6868
69- rslt = bmm150_init (&bmm1);
70- print_rslt (rslt );
69+ int8_t bmm150InitResult = bmm150_init (&bmm1);
70+ print_rslt (bmm150InitResult );
7171
72- rslt = configure_sensor (&bmm1);
73- print_rslt (rslt );
72+ int8_t bmm150ConfigResult = configure_sensor (&bmm1);
73+ print_rslt (bmm150ConfigResult );
7474
75- _initialized = true ;
75+ bool success = bmi270InitResult == BMI2_OK && bmi270ConfigResult == BMI2_OK &&
76+ bmm150InitResult == BMM150_OK && bmm150ConfigResult == BMM150_OK;
77+ _initialized = success;
7678
77- return 1 ;
79+ return success ;
7880}
7981
8082
Original file line number Diff line number Diff line change @@ -593,6 +593,8 @@ int8_t bmm150_init(struct bmm150_dev *dev)
593593
594594 /* Function to update trim values */
595595 rslt = read_trim_registers (dev );
596+ } else {
597+ rslt = BMM150_E_DEV_NOT_FOUND ;
596598 }
597599 }
598600 }
You can’t perform that action at this time.
0 commit comments