TMTC updated #7

Merged
meierj merged 28 commits from mueller/tmtc-update into develop 2020-12-27 15:22:46 +01:00
3 changed files with 20 additions and 7 deletions
Showing only changes of commit 48386a8e3f - Show all commits

View File

@ -3,7 +3,8 @@
MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId,
object_id_t deviceCommunication, CookieIF* comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie) {
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this) {
#if OBSW_ENHANCED_PRINTOUT == 1
debugDivider = new PeriodicOperationDivider(10);
#endif
@ -253,6 +254,13 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
sif::info << "Z: " << mgmZ << " \xC2\xB5T" << std::endl;
}
#endif
ReturnValue_t result = dataset.read(20);
if(result == HasReturnvaluesIF::RETURN_OK) {
dataset.fieldStrengthX = mgmX;
dataset.fieldStrengthY = mgmY;
dataset.fieldStrengthZ = mgmZ;
dataset.commit(20);
}
break;
}
@ -266,6 +274,11 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
<< std::endl;
}
#endif
ReturnValue_t result = dataset.read(20);
if(result == HasReturnvaluesIF::RETURN_OK) {
dataset.temperature = tempValue;
dataset.commit(20);
}
break;
}
@ -371,7 +384,7 @@ void MGMHandlerLIS3MDL::fillCommandAndReplyMap() {
* We dont read single registers, we just expect special
* reply from he Readall_MGM
*/
insertInCommandAndReplyMap(MGMLIS3MDL::READ_CONFIG_AND_DATA, 1);
insertInCommandAndReplyMap(MGMLIS3MDL::READ_CONFIG_AND_DATA, 1, &dataset);
insertInCommandAndReplyMap(MGMLIS3MDL::READ_TEMPERATURE, 1);
insertInCommandAndReplyMap(MGMLIS3MDL::SETUP_MGM, 1);
insertInCommandAndReplyMap(MGMLIS3MDL::IDENTIFY_DEVICE, 1);

View File

@ -18,7 +18,6 @@
*/
class MGMHandlerLIS3MDL: public DeviceHandlerBase {
public:
enum class CommunicationStep {
DATA,
TEMPERATURE
@ -59,6 +58,7 @@ protected:
private:
MGMLIS3MDL::MgmPrimaryDataset dataset;
/*------------------------------------------------------------------------*/
/* Device specific commands and variables */

View File

@ -130,7 +130,7 @@ static const uint8_t BDU = 6; //Block data update
static const uint8_t FAST_READ = 7; //Fast read enabled = 1
static const uint8_t CTRL_REG5_DEFAULT = 0;
static const uint32_t MGM_DATA_SET_ID = 0;
static const uint32_t MGM_DATA_SET_ID = READ_CONFIG_AND_DATA;
enum MgmPoolIds: lp_id_t {
FIELD_STRENGTH_X,
@ -147,11 +147,11 @@ public:
MgmPrimaryDataset(object_id_t mgmId):
StaticLocalDataSet(sid_t(mgmId, MGM_DATA_SET_ID)) {}
lp_var_t<float> angVelocityX = lp_var_t<float>(sid.objectId,
lp_var_t<float> fieldStrengthX = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_X, this);
lp_var_t<float> angVelocityY = lp_var_t<float>(sid.objectId,
lp_var_t<float> fieldStrengthY = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_Y, this);
lp_var_t<float> angVelocityZ = lp_var_t<float>(sid.objectId,
lp_var_t<float> fieldStrengthZ = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_Z, this);
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId,
TEMPERATURE_CELCIUS, this);