successful temperature reading

This commit is contained in:
Jakob Meier 2020-12-14 09:46:59 +01:00
parent 551a8f021b
commit c88bc6508d
3 changed files with 15 additions and 7 deletions

View File

@ -59,7 +59,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF *cookie) {
uint8_t cspAddress = cspCookie->getCspAddress();
uint16_t maxReplyLength = cspCookie->getMaxReplyLength();
if(cspDeviceMap.find(cspAddress) != cspDeviceMap.end()){
if(cspDeviceMap.find(cspAddress) == cspDeviceMap.end()){
/* Insert device information in CSP map */
cspDeviceMap.emplace(cspAddress, vectorBuffer(maxReplyLength));
}
@ -145,14 +145,19 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort,
const uint8_t* cmdBuffer, int cmdBufferLen, uint16_t querySize) {
uint32_t timeout_ms = 1000;
uint8_t* replyBuffer = cspDeviceMap[cspAddress].data();
vectorBufferIter iter = cspDeviceMap.find(cspAddress);
if(iter == cspDeviceMap.end()){
sif::error << "CSP device with address " << cspAddress << " no found in"
<< " device map" << std::endl;
}
uint8_t* replyBuffer = iter->second.data();
uint8_t tmpCmdBuffer[cmdBufferLen];
memcpy(tmpCmdBuffer, cmdBuffer, cmdBufferLen);
csp_conn_t * conn = csp_connect(CSP_PRIO_HIGH, cspAddress, cspPort, 0,
CSP_O_NONE);
querySize = 12;
querySize = 14;
int receivedBytes = csp_transaction_persistent(conn, timeout_ms,
tmpCmdBuffer, cmdBufferLen, replyBuffer, querySize);
if(receivedBytes != querySize){

View File

@ -43,14 +43,15 @@ ReturnValue_t P60DockHandler::buildCommandFromCommand(
/* Unpack the received action message */
GetParamMessageUnpacker getParamMessage(commandData, commandDataLen);
uint8_t tableId = getParamMessage.getTableId();
uint16_t address = getParamMessage.getAddress();
uint16_t address = EndianConverter::convertLittleEndian<uint16_t>(
getParamMessage.getAddress());
uint16_t length = EndianConverter::convertLittleEndian<uint16_t>(
sizeof(address));
uint16_t checksum = GOMSPACE::IGNORE_CHECKSUM;
uint16_t seq = 0;
uint16_t total = 0;
uint16_t querySize = getParamMessage.getQuerySize();
uint16_t querySize = getParamMessage.getQuerySize()
+ CspGetParamCommand::GS_HDR_LENGTH;
/* Generate the CSP command to send to the P60 Dock */
CspGetParamCommand getParamCmd(querySize, PARAM_GET, tableId, length,
checksum, seq, total, address);

View File

@ -6,7 +6,7 @@
#include "fsfw/serialize/SerialLinkedListAdapter.h"
namespace GOMSPACE{
static const uint16_t IGNORE_CHECKSUM = 0x0bb0;
static const uint16_t IGNORE_CHECKSUM = 0xb00b;
/* CSP port to ping gomspace devices. */
static const uint8_t PING_PORT = 1;
static const uint8_t REBOOT_PORT = 4;
@ -111,6 +111,8 @@ private:
*/
class CspGetParamCommand : public SerialLinkedListAdapter<SerializeIF> {
public:
/* The size of the header of a gomspace CSP packet. */
static const uint8_t GS_HDR_LENGTH = 12;
CspGetParamCommand(uint16_t querySize_, uint8_t action_, uint8_t tableId_,
uint16_t addresslength_, uint16_t checksum_, uint16_t seq_,