some more bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
c248cdb876
commit
02eff4a26f
@ -977,7 +977,7 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
|||||||
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = verifyPacket(data, supv::SIZE_BOOT_STATUS_REPORT);
|
result = verifyPacket(data, tmReader.getFullPacketLen());
|
||||||
|
|
||||||
if (result == result::CRC_FAILURE) {
|
if (result == result::CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
||||||
@ -986,28 +986,31 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t offset = supv::PAYLOAD_OFFSET;
|
const uint8_t* payloadStart = tmReader.getPayloadStart();
|
||||||
bootStatusReport.socState = *(data + offset);
|
uint16_t offset = 0;
|
||||||
|
bootStatusReport.socState = payloadStart[0];
|
||||||
offset += 1;
|
offset += 1;
|
||||||
bootStatusReport.powerCycles = *(data + offset);
|
bootStatusReport.powerCycles = payloadStart[1];
|
||||||
offset += 1;
|
offset += 1;
|
||||||
bootStatusReport.bootAfterMs = *(data + offset) << 24 | *(data + offset + 1) << 16 |
|
bootStatusReport.bootAfterMs = *(payloadStart + offset) << 24 |
|
||||||
*(data + offset + 2) << 8 | *(data + offset + 3);
|
*(payloadStart + offset + 1) << 16 |
|
||||||
|
*(payloadStart + offset + 2) << 8 | *(payloadStart + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
bootStatusReport.bootTimeoutMs = *(data + offset) << 24 | *(data + offset + 1) << 16 |
|
bootStatusReport.bootTimeoutMs = *(payloadStart + offset) << 24 |
|
||||||
*(data + offset + 2) << 8 | *(data + offset + 3);
|
*(payloadStart + offset + 1) << 16 |
|
||||||
|
*(payloadStart + offset + 2) << 8 | *(payloadStart + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
bootStatusReport.activeNvm = *(data + offset);
|
bootStatusReport.activeNvm = *(payloadStart + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
bootStatusReport.bp0State = *(data + offset);
|
bootStatusReport.bp0State = *(payloadStart + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
bootStatusReport.bp1State = *(data + offset);
|
bootStatusReport.bp1State = *(payloadStart + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
bootStatusReport.bp2State = *(data + offset);
|
bootStatusReport.bp2State = *(payloadStart + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
bootStatusReport.bootState = *(data + offset);
|
bootStatusReport.bootState = *(payloadStart + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
bootStatusReport.bootCycles = *(data + offset);
|
bootStatusReport.bootCycles = *(payloadStart + offset);
|
||||||
|
|
||||||
nextReplyId = supv::EXE_REPORT;
|
nextReplyId = supv::EXE_REPORT;
|
||||||
bootStatusReport.setValidity(true, true);
|
bootStatusReport.setValidity(true, true);
|
||||||
@ -1043,7 +1046,7 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
|
|||||||
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = verifyPacket(data, supv::SIZE_LATCHUP_STATUS_REPORT);
|
result = verifyPacket(data, tmReader.getFullPacketLen());
|
||||||
|
|
||||||
if (result == result::CRC_FAILURE) {
|
if (result == result::CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleLatchupStatusReport: Latchup status report has "
|
sif::error << "PlocSupervisorHandler::handleLatchupStatusReport: Latchup status report has "
|
||||||
@ -1051,38 +1054,39 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t offset = supv::PAYLOAD_OFFSET;
|
const uint8_t* payloadData = tmReader.getPayloadStart();
|
||||||
latchupStatusReport.id = *(data + offset);
|
uint16_t offset = 0;
|
||||||
|
latchupStatusReport.id = *(payloadData + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
latchupStatusReport.cnt0 = *(data + offset) << 8 | *(data + offset + 1);
|
latchupStatusReport.cnt0 = *(payloadData + offset) << 8 | *(payloadData + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
latchupStatusReport.cnt1 = *(data + offset) << 8 | *(data + offset + 1);
|
latchupStatusReport.cnt1 = *(payloadData + offset) << 8 | *(payloadData + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
latchupStatusReport.cnt2 = *(data + offset) << 8 | *(data + offset + 1);
|
latchupStatusReport.cnt2 = *(payloadData + offset) << 8 | *(payloadData + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
latchupStatusReport.cnt3 = *(data + offset) << 8 | *(data + offset + 1);
|
latchupStatusReport.cnt3 = *(payloadData + offset) << 8 | *(payloadData + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
latchupStatusReport.cnt4 = *(data + offset) << 8 | *(data + offset + 1);
|
latchupStatusReport.cnt4 = *(payloadData + offset) << 8 | *(payloadData + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
latchupStatusReport.cnt5 = *(data + offset) << 8 | *(data + offset + 1);
|
latchupStatusReport.cnt5 = *(payloadData + offset) << 8 | *(payloadData + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
latchupStatusReport.cnt6 = *(data + offset) << 8 | *(data + offset + 1);
|
latchupStatusReport.cnt6 = *(payloadData + offset) << 8 | *(data + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
uint16_t msec = *(data + offset) << 8 | *(data + offset + 1);
|
uint16_t msec = *(payloadData + offset) << 8 | *(payloadData + offset + 1);
|
||||||
latchupStatusReport.isSet = msec >> supv::LatchupStatusReport::IS_SET_BIT_POS;
|
latchupStatusReport.isSet = msec >> supv::LatchupStatusReport::IS_SET_BIT_POS;
|
||||||
latchupStatusReport.timeMsec = msec & (~(1 << latchupStatusReport.IS_SET_BIT_POS));
|
latchupStatusReport.timeMsec = msec & (~(1 << latchupStatusReport.IS_SET_BIT_POS));
|
||||||
offset += 2;
|
offset += 2;
|
||||||
latchupStatusReport.timeSec = *(data + offset);
|
latchupStatusReport.timeSec = *(payloadData + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
latchupStatusReport.timeMin = *(data + offset);
|
latchupStatusReport.timeMin = *(payloadData + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
latchupStatusReport.timeHour = *(data + offset);
|
latchupStatusReport.timeHour = *(payloadData + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
latchupStatusReport.timeDay = *(data + offset);
|
latchupStatusReport.timeDay = *(payloadData + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
latchupStatusReport.timeMon = *(data + offset);
|
latchupStatusReport.timeMon = *(payloadData + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
latchupStatusReport.timeYear = *(data + offset);
|
latchupStatusReport.timeYear = *(payloadData + offset);
|
||||||
|
|
||||||
nextReplyId = supv::EXE_REPORT;
|
nextReplyId = supv::EXE_REPORT;
|
||||||
|
|
||||||
|
@ -1152,7 +1152,6 @@ int PlocSupvUartManager::removeHdlcFramingWithCrcCheck(const uint8_t* src, size_
|
|||||||
if (calcCrc != crc) {
|
if (calcCrc != crc) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// This does not work because the CRC is little endian
|
|
||||||
// if(calc_crc16_buff_reflected(dst, tlen) != 0) {
|
// if(calc_crc16_buff_reflected(dst, tlen) != 0) {
|
||||||
// return 1;
|
// return 1;
|
||||||
// }
|
// }
|
||||||
|
3
thirdparty/tas/hdlc.c
vendored
3
thirdparty/tas/hdlc.c
vendored
@ -80,8 +80,7 @@ int hdlc_remove_framing_with_crc_check(const uint8_t *src, size_t slen, uint8_t
|
|||||||
dst[tlen++] = bt;
|
dst[tlen++] = bt;
|
||||||
}
|
}
|
||||||
// calc crc16
|
// calc crc16
|
||||||
// TODO: Warning: This does not work because the CRC16 is little endian
|
if(calc_crc16_buff_reflected( dst, tlen ) != 0x0f47) {
|
||||||
if(calc_crc16_buff_reflected( dst, tlen ) != 0) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*dlen = tlen - 2;
|
*dlen = tlen - 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user