successful change of endian swapping in p60dock param set

This commit is contained in:
Jakob Meier 2020-12-16 11:02:49 +01:00
parent f778292d8e
commit 380543756d

View File

@ -40,8 +40,7 @@ ReturnValue_t P60DockHandler::buildCommandFromCommand(
SetParamMessageUnpacker setParamMessageUnpacker(commandData,
commandDataLen);
uint8_t tableId = setParamMessageUnpacker.getTableId();
uint16_t address = EndianConverter::convertLittleEndian<uint16_t>(
setParamMessageUnpacker.getAddress());
uint16_t address = setParamMessageUnpacker.getAddress();
uint16_t checksum = GOMSPACE::IGNORE_CHECKSUM;
uint16_t seq = 0;
uint16_t total = 0;
@ -49,26 +48,9 @@ ReturnValue_t P60DockHandler::buildCommandFromCommand(
uint16_t querySize = 1;
const uint8_t* parameterPtr = setParamMessageUnpacker.getParameter();
uint8_t parameterSize = setParamMessageUnpacker.getParameterSize();
uint32_t parameter;
parameter = *parameterPtr;
switch(parameterSize) {
case(sizeof(uint16_t)): {
parameter = EndianConverter::convertLittleEndian<uint16_t>(
(uint16_t)parameter);
break;
}
case(sizeof(uint32_t)): {
parameter = EndianConverter::convertLittleEndian<uint32_t>(
parameter);
break;
}
default:
break;
}
uint16_t payloadlength = EndianConverter::convertLittleEndian<uint16_t>(
sizeof(address) + parameterSize);
uint16_t payloadlength = sizeof(address) + parameterSize;
CspSetParamCommand setParamCmd(querySize, PARAM_SET, tableId, payloadlength,
checksum, seq, total, address, (uint8_t*) &parameter,
checksum, seq, total, address, parameterPtr,
parameterSize);
size_t cspPacketLen = 0;
uint8_t* buffer = cspPacket;