various fixes and improvements
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
parent
003d37c490
commit
2c223712ff
@ -60,7 +60,7 @@ static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400;
|
||||
static constexpr UartBaudRate SCEX_BAUD = UartBaudRate::RATE_115200;
|
||||
static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600;
|
||||
static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200;
|
||||
static constexpr UartBaudRate PLOC_SUPV_BAUD = UartBaudRate::RATE_115200;
|
||||
static constexpr UartBaudRate PLOC_SUPV_BAUD = UartBaudRate::RATE_921600;
|
||||
static constexpr UartBaudRate STAR_TRACKER_BAUD = UartBaudRate::RATE_921600;
|
||||
|
||||
} // namespace uart
|
||||
|
@ -122,6 +122,7 @@ static const DeviceCommandId_t RESET_PL = 58;
|
||||
static const DeviceCommandId_t ENABLE_NVMS = 59;
|
||||
static const DeviceCommandId_t CONTINUE_UPDATE = 60;
|
||||
static const DeviceCommandId_t MEMORY_CHECK_WITH_FILE = 61;
|
||||
static constexpr DeviceCommandId_t MEMORY_CHECK = 62;
|
||||
|
||||
/** Reply IDs */
|
||||
enum ReplyId : DeviceCommandId_t {
|
||||
|
@ -411,6 +411,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
insertInCommandMap(SET_GPIO);
|
||||
insertInCommandMap(READ_GPIO);
|
||||
insertInCommandMap(FACTORY_RESET);
|
||||
insertInCommandMap(MEMORY_CHECK);
|
||||
insertInCommandMap(SET_SHUTDOWN_TIMEOUT);
|
||||
insertInCommandMap(FACTORY_FLASH);
|
||||
insertInCommandMap(SET_ADC_ENABLED_CHANNELS);
|
||||
@ -421,6 +422,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
// ACK replies, use countdown for them
|
||||
insertInReplyMap(ACK_REPORT, 0, nullptr, SIZE_ACK_REPORT, false, &acknowledgementReportTimeout);
|
||||
insertInReplyMap(EXE_REPORT, 0, nullptr, SIZE_EXE_REPORT, false, &executionReportTimeout);
|
||||
insertInReplyMap(MEMORY_CHECK, 5, nullptr, 0, false);
|
||||
|
||||
// TM replies
|
||||
insertInReplyMap(HK_REPORT, 3, &hkset, SIZE_HK_REPORT);
|
||||
@ -507,6 +509,16 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MEMORY_CHECK: {
|
||||
enabledReplies = 3;
|
||||
result =
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, MEMORY_CHECK);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << MEMORY_CHECK
|
||||
<< " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case START_MPSOC:
|
||||
case SHUTDOWN_MPSOC:
|
||||
case SEL_MPSOC_BOOT_IMAGE:
|
||||
@ -625,10 +637,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
static_cast<uint8_t>(supv::tm::MemManId::UPDATE_STATUS_REPORT)) {
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = ReplyId::UPDATE_STATUS_REPORT;
|
||||
// TODO: I think this will be handled by the uart manager?
|
||||
// Actually, this is a bit tricky. Maybe the lower level will have two separate ring
|
||||
// buffers, one for internally handled packets and one for packets which are handled
|
||||
// here?
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -667,6 +676,10 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
result = handleExecutionReport(packet);
|
||||
break;
|
||||
}
|
||||
case (UPDATE_STATUS_REPORT): {
|
||||
// TODO: handle status report here
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id"
|
||||
<< std::endl;
|
||||
|
@ -116,7 +116,9 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||
break;
|
||||
}
|
||||
case InternalState::DEDICATED_REQUEST: {
|
||||
updateVtime(1);
|
||||
handleRunningLongerRequest();
|
||||
updateVtime(2);
|
||||
MutexGuard mg(lock);
|
||||
state = InternalState::DEFAULT;
|
||||
break;
|
||||
@ -380,9 +382,9 @@ ReturnValue_t PlocSupvUartManager::writeUpdatePackets() {
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint8_t tempData[supv::WriteMemory::CHUNK_MAX + 1]{};
|
||||
if (not std::filesystem::exists(update.file)) {
|
||||
sif::error << "PlocSupvUartManager::writeUpdatePackets: File "
|
||||
<< update.file << " does not exist" << std::endl;
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
sif::error << "PlocSupvUartManager::writeUpdatePackets: File " << update.file
|
||||
<< " does not exist" << std::endl;
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
std::ifstream file(update.file, std::ifstream::binary);
|
||||
uint16_t dataLength = 0;
|
||||
@ -553,6 +555,7 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
|
||||
return result;
|
||||
}
|
||||
Countdown countdown(timeoutExecutionReport);
|
||||
dur_millis_t currentDelay = 5;
|
||||
bool ackReceived = false;
|
||||
bool packetWasHandled = false;
|
||||
while (true) {
|
||||
@ -590,7 +593,10 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
|
||||
decodedRingBuf.deleteData(packetLen);
|
||||
}
|
||||
} else {
|
||||
TaskFactory::delayTask(20);
|
||||
TaskFactory::delayTask(currentDelay);
|
||||
if (currentDelay < 20) {
|
||||
currentDelay *= 2;
|
||||
}
|
||||
}
|
||||
if (countdown.hasTimedOut()) {
|
||||
return result::NO_REPLY_TIMEOUT;
|
||||
@ -1095,9 +1101,11 @@ void PlocSupvUartManager::addHdlcFraming(const uint8_t* src, size_t slen, uint8_
|
||||
}
|
||||
|
||||
size_t dummy = 0;
|
||||
uint8_t crcRaw[2];
|
||||
// hdlc crc16 is in little endian format
|
||||
SerializeAdapter::serialize(&crc16, dst + tlen, &dummy, maxDest, SerializeIF::Endianness::LITTLE);
|
||||
tlen += dummy;
|
||||
SerializeAdapter::serialize(&crc16, crcRaw, &dummy, maxDest, SerializeIF::Endianness::LITTLE);
|
||||
hdlc_add_byte(crcRaw[0], dst, &tlen);
|
||||
hdlc_add_byte(crcRaw[1], dst, &tlen);
|
||||
|
||||
dst[tlen++] = 0x7C;
|
||||
*dlen = tlen;
|
||||
@ -1141,3 +1149,9 @@ bool PlocSupvUartManager::longerRequestActive() const {
|
||||
MutexGuard mg(lock);
|
||||
return state == InternalState::DEDICATED_REQUEST;
|
||||
}
|
||||
|
||||
void PlocSupvUartManager::updateVtime(uint8_t vtime) {
|
||||
tcgetattr(serialPort, &tty);
|
||||
tty.c_cc[VTIME] = vtime;
|
||||
tcsetattr(serialPort, TCSANOW, &tty);
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
|
||||
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
|
||||
|
||||
bool printTc = true;
|
||||
bool printTc = false;
|
||||
bool debugMode = false;
|
||||
bool timestamping = true;
|
||||
|
||||
@ -368,6 +368,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override;
|
||||
|
||||
void performUartShutdown();
|
||||
void updateVtime(uint8_t vtime);
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user