Errors to be solved in data reading and controller operations.
This commit is contained in:
parent
8c80e9f7c0
commit
868a461acb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -692,9 +692,9 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData,
|
||||
receivedData += foundLen;
|
||||
if (remainingLength > foundLen) {
|
||||
remainingLength -= foundLen;
|
||||
sif::debug<<" DH_base: debug3"<<std::endl;
|
||||
sif::debug<<"DH_base: debug3"<<std::endl;
|
||||
} else {
|
||||
sif::debug<<" DH_base: debug4"<<std::endl;
|
||||
sif::debug<<"DH_base: debug4"<<std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <mission/Controller/tcs_data_config.h>
|
||||
|
||||
ThermalController::ThermalController(object_id_t objectId, object_id_t powerSwitcher, size_t commandQueueDepth):
|
||||
ControllerBase(objectId, NULL, commandQueueDepth), mode(MODE_ON), submode(HEATER_REDUNDANCY),
|
||||
ControllerBase(objectId, 0, commandQueueDepth),
|
||||
powerSwitcherId(powerSwitcher), TempValueVec(datapool::Temperature_value, &TCSData, PoolVariableIF::VAR_READ),
|
||||
TEMPERATURE_SENSOR_CH1(objects::TCS_SENSOR_CH1, &TempValueVec[0], &TempValueVec, 0, TEMPERATURE_SENSOR_CONFIG, datapool::TEMP_SENSOR_CH1, &TCSData, NULL),
|
||||
TEMPERATURE_SENSOR_CH2(objects::TCS_SENSOR_CH2, &TempValueVec[1], &TempValueVec, 1, TEMPERATURE_SENSOR_CONFIG, datapool::TEMP_SENSOR_CH2, &TCSData, NULL),
|
||||
@ -63,6 +63,9 @@ ReturnValue_t ThermalController::initialize() {
|
||||
}*/
|
||||
/* ************************ */
|
||||
|
||||
mode = MODE_NORMAL;
|
||||
submode = HEATER_REDUNDANCY;
|
||||
|
||||
sif::debug<<"\nDEBUG_TCS: Start initialization"<<std::endl;
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
@ -83,7 +86,7 @@ ReturnValue_t ThermalController::handleCommandMessage(CommandMessage *message) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t ThermalController::performOperation() {
|
||||
ReturnValue_t ThermalController::performOperation(uint8_t opCode) {
|
||||
|
||||
sif::debug<<"\nDEBUG_TCS: Start of controller operations"<<std::endl;
|
||||
std::cout << "\nDEBUG_TCS: Start of controller operations" << std::endl;
|
||||
@ -91,8 +94,10 @@ ReturnValue_t ThermalController::performOperation() {
|
||||
for (std::list<ArduinoTCSTemperatureSensor>::iterator iter = sensors.begin(); iter != sensors.end(); iter++) {
|
||||
iter->performHealthOp();
|
||||
}
|
||||
sif::debug<<"\nDEBUG_TCS: Health ops"<<std::endl;
|
||||
|
||||
ControllerBase::performOperation(0);
|
||||
sif::debug<<"\nDEBUG_TCS: Controller ops"<<std::endl;
|
||||
|
||||
if (mode == MODE_OFF) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
@ -103,6 +108,7 @@ ReturnValue_t ThermalController::performOperation() {
|
||||
iter->performOperation(0);
|
||||
}
|
||||
TCSData.commit();
|
||||
sif::debug<<"\nDEBUG_TCS: Sensor ops"<<std::endl;
|
||||
|
||||
TCSData.read(); // ?check the read, separate dataset
|
||||
//calculateStrategy(true, true);
|
||||
@ -112,6 +118,7 @@ ReturnValue_t ThermalController::performOperation() {
|
||||
//request = iter->performOperation(0, ThermalComponentIF::SAFE, true, false);
|
||||
}
|
||||
TCSData.commit();
|
||||
sif::debug<<"\nDEBUG_TCS: Component ops"<<std::endl;
|
||||
std::cout << "\nDEBUG_TCS: End of controller operations" << std::endl;
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
@ -132,9 +139,9 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode
|
||||
msToReachTheMode = 0;
|
||||
switch (mode) {
|
||||
case MODE_OFF:
|
||||
startTransition(mode, NULL);
|
||||
startTransition(mode, 0);
|
||||
break;
|
||||
case MODE_ON:
|
||||
case MODE_NORMAL:
|
||||
if (submode == NO_REDUNDANCY) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
@ -149,13 +156,11 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode
|
||||
void ThermalController::startTransition(Mode_t mode, Submode_t submode){
|
||||
switch (mode) {
|
||||
case MODE_OFF:
|
||||
mode = MODE_ON;
|
||||
mode = MODE_NORMAL;
|
||||
break;
|
||||
case MODE_ON:
|
||||
case MODE_NORMAL:
|
||||
mode = MODE_OFF;
|
||||
break;
|
||||
case NULL:
|
||||
break;
|
||||
default:
|
||||
mode = MODE_OFF;
|
||||
break;
|
||||
@ -167,7 +172,7 @@ void ThermalController::startTransition(Mode_t mode, Submode_t submode){
|
||||
case HEATER_REDUNDANCY:
|
||||
submode = NO_REDUNDANCY;
|
||||
break;
|
||||
case NULL:
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
submode = NO_REDUNDANCY;
|
||||
|
@ -23,8 +23,8 @@
|
||||
class ThermalController: public ControllerBase {
|
||||
public:
|
||||
|
||||
static const Mode_t MODE_ON = 1;
|
||||
static const Mode_t MODE_OFF = 2;
|
||||
//static const Mode_t MODE_ON = 1;
|
||||
//static const Mode_t MODE_OFF = 2;
|
||||
static const Submode_t NO_REDUNDANCY = 1;
|
||||
static const Submode_t HEATER_REDUNDANCY = 2;
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
virtual~ ThermalController();
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
ReturnValue_t performOperation();
|
||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||
//virtual MessageQueueId_t getCommandQueue() const;
|
||||
|
||||
private:
|
||||
@ -85,8 +85,8 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
Mode_t mode;
|
||||
Submode_t submode;
|
||||
//Mode_t mode;
|
||||
//Submode_t submode;
|
||||
|
||||
/* Extended Controller Base overrides */
|
||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
ArduinoDH::ArduinoDH(object_id_t objectId, object_id_t comIF, CookieIF *cookie) :
|
||||
DeviceHandlerBase(objectId, comIF, cookie) {
|
||||
DeviceHandlerBase(objectId, comIF, cookie)/*, foundId(&bufferId), foundLen(&bufferLen)*/ {
|
||||
mode = _MODE_START_UP;
|
||||
}
|
||||
|
||||
@ -77,7 +77,6 @@ void ArduinoDH::fillCommandAndReplyMap() {
|
||||
|
||||
ReturnValue_t ArduinoDH::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
//using namespace testdevice;
|
||||
|
||||
/* Unless a command was sent explicitely, we don't expect any replies and ignore
|
||||
the packet. On a real device, there might be replies which are sent without a previous
|
||||
@ -89,25 +88,23 @@ ReturnValue_t ArduinoDH::scanForReply(const uint8_t *start, size_t len,
|
||||
} else {
|
||||
commandSent = false;
|
||||
}*/
|
||||
|
||||
/*len = 2034;
|
||||
start = *buffer;*/
|
||||
|
||||
foundId = &bufferID;
|
||||
foundLen = &len;
|
||||
|
||||
// start character: '['
|
||||
if (*start == 91 ){
|
||||
// buffer length: 2034 bytes
|
||||
if (*foundLen == len){
|
||||
return APERIODIC_REPLY;
|
||||
}
|
||||
else{
|
||||
//foundId = &bufferID;
|
||||
//foundLen = &foundLen;
|
||||
|
||||
*foundLen = 2034;
|
||||
|
||||
// check validity
|
||||
if (len == *foundLen){
|
||||
// start character: '['
|
||||
if (*start == 91 ){
|
||||
return APERIODIC_REPLY;
|
||||
} else{
|
||||
return DeviceHandlerIF::LENGTH_MISSMATCH;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return RETURN_FAILED;
|
||||
} else {
|
||||
return IGNORE_REPLY_DATA;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,10 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
DeviceCommandId_t bufferID = 0x01;
|
||||
/*DeviceCommandId_t bufferId = 0x01;
|
||||
size_t bufferLen = 2034;
|
||||
DeviceCommandId_t *foundId;
|
||||
size_t *foundLen;*/
|
||||
|
||||
//testdevice::TestDataSet dataset;
|
||||
//! This is used to reset the dataset after a commanded change has been made.
|
||||
|
Loading…
x
Reference in New Issue
Block a user