Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
Diff: ak7451ctrl.cpp
- Revision:
- 14:21e177fc308a
- Parent:
- 13:d008249f0359
- Child:
- 16:d85be9bafb80
diff -r d008249f0359 -r 21e177fc308a ak7451ctrl.cpp --- a/ak7451ctrl.cpp Fri Aug 12 00:04:48 2016 +0000 +++ b/ak7451ctrl.cpp Mon Sep 12 17:24:11 2016 +0000 @@ -116,22 +116,12 @@ case Message::CMD_ANGLE_ZERO_RESET: { AK7451::Status st; - if( Ak7451Ctrl::stopSensor() != AkmSensor::SUCCESS ){ - MSG("#Error stop sensor\r\n"); - status = AkmSensor::ERROR; - } st = ak7451->setOperationMode(AK7451::AK7451_USER_MODE); if( st != AK7451::SUCCESS ){ MSG("#Error when set user mode\r\n"); status = AkmSensor::ERROR; } - char temp[2] = {0x00,0x00}; - st = ak7451->writeRegister(0x06,temp); - if( st != AK7451::SUCCESS ){ - MSG("#Error temp read: code=%d\r\n",st); - status = AkmSensor::ERROR; - } st = ak7451->setAngleZero(); // reset ZP data if( st != AK7451::SUCCESS ){ MSG("#Error setAngleZero: code=%d\r\n",st); @@ -142,10 +132,7 @@ MSG("#Error when set normal mode\r\n"); status = AkmSensor::ERROR; } - if( Ak7451Ctrl::startSensor(interval) != AkmSensor::SUCCESS ){ - MSG("#Error start sensor\r\n"); - status = AkmSensor::ERROR; - } + if( status == AkmSensor::ERROR ){ out->setArgument(0,1); }else{