Skip to content

Commit

Permalink
Adjusted telemetry to FPGA changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pkubanek committed Sep 9, 2024
1 parent 5168ddd commit 4d787c5
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 48 deletions.
2 changes: 1 addition & 1 deletion doc/version-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Version History

v1.12.0
-------
* simplified MPU commonication
* simplified MPU communication

v1.11.1
-------
Expand Down
2 changes: 1 addition & 1 deletion include/cRIO/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class Application {
* Prints preamble for commands help. Can include tips which commands to
* use,..
*/
virtual void printGenericHelp() {};
virtual void printGenericHelp(){};

/**
* Process option from command line parsing.
Expand Down
37 changes: 4 additions & 33 deletions include/cRIO/MPUTelemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,12 @@ class MPUTelemetry {
*
* @param data[45] data as received from FPGA
*/
MPUTelemetry(uint8_t* data);
uint32_t writeBytes; /// Number of bytes written
uint32_t readBytes; /// Number of bytes read
uint16_t readTimedout; /// read timedout counter
MPUTelemetry(const uint8_t* data);

friend std::ostream& operator<<(std::ostream& os, const MPUTelemetry& tel);
uint64_t writeBytes; /// Number of bytes written
uint64_t readBytes; /// Number of bytes read

/**
* Updates MPU telemetry SAL message structure.
*
* @tparam message class with telemetry filed. Shall be SAL declared class
* @param msg message to check and update
*
* @return true if message shall be send, false if updates are minor and it should not be send
*/
template <class message>
bool sendUpdates(message* msg) {
return false;

/**
if (msg->readBytes != readBytes || msg->writeTimedout != writeTimedout ||
msg->instructionPointerOnError != instructionPointerOnError || msg->errorCode != errorCode) {
send = true;
}
msg->instructionPointer = instructionPointer;
msg->outputCounter = outputCounter;
msg->inputCounter = inputCounter;
msg->outputTimeouts = outputTimeouts;
msg->inputTimeouts = inputTimeouts;
msg->instructionPointerOnError = instructionPointerOnError;
msg->writeTimeout = writeTimeout;
msg->readTimeout = readTimeout;
msg->errorCode = errorCode;
return send; */
}
friend std::ostream& operator<<(std::ostream& os, const MPUTelemetry& tel);
};

} // namespace cRIO
Expand Down
4 changes: 2 additions & 2 deletions include/cRIO/ModbusBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ class ModbusBuffer {
* Called before responses are processed (before processXX methods are
* called).
*/
virtual void preProcess() {};
virtual void preProcess(){};

/**
* Called after responses are processed (after processXX methods are
* called).
*/
virtual void postProcess() {};
virtual void postProcess(){};

/**
* Thrown when an unknown response function is received. As unknown function
Expand Down
2 changes: 1 addition & 1 deletion include/cRIO/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Task {
*
* @param ex exception raised during processing
*/
virtual void reportException(const std::exception &ex) {};
virtual void reportException(const std::exception &ex){};

static constexpr task_return_t DONT_RESCHEDULE = 0xFFFFFFFF;

Expand Down
3 changes: 2 additions & 1 deletion src/LSST/cRIO/ElectromechanicalPneumaticILC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ ElectromechanicalPneumaticILC::ElectromechanicalPneumaticILC(uint8_t bus) : ILC:

addResponse(ILC_EM_CMD::STEPPER_FORCE_STATUS, stepperForceStatus, 195);

addResponse(ILC_EM_CMD::SET_DCA_GAIN, [this](Modbus::Parser parser) { parser.checkCRC(); }, 201);
addResponse(
ILC_EM_CMD::SET_DCA_GAIN, [this](Modbus::Parser parser) { parser.checkCRC(); }, 201);

addResponse(ILC_EM_CMD::REPORT_DCA_GAIN, dcaGain, 202);

Expand Down
9 changes: 6 additions & 3 deletions src/LSST/cRIO/FPGACliApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ FPGACliApp::FPGACliApp(const char* name, const char* description)
"Temporary disable given ILC in * commands");
addILCCommand("@enable", std::bind(&FPGACliApp::enableILC, this, std::placeholders::_1),
"Re-enable given ILC in * commands");
addILCCommand("info", [](ILCUnit u) { u.first->reportServerID(u.second); }, "Print ILC info");
addILCCommand("status", [](ILCUnit u) { u.first->reportServerStatus(u.second); }, "Print ILC status");
addILCCommand(
"info", [](ILCUnit u) { u.first->reportServerID(u.second); }, "Print ILC info");
addILCCommand(
"status", [](ILCUnit u) { u.first->reportServerStatus(u.second); }, "Print ILC status");
addILCCommand(
"standby", [](ILCUnit u) { u.first->changeILCMode(u.second, ILC::Mode::Standby); },
"Change ILC mode to standby");
Expand All @@ -61,7 +63,8 @@ FPGACliApp::FPGACliApp(const char* name, const char* description)
addILCCommand(
"clear-faults", [](ILCUnit u) { u.first->changeILCMode(u.second, ILC::Mode::ClearFaults); },
"Clear ILC faults");
addILCCommand("reset", [](ILCUnit u) { u.first->resetServer(u.second); }, "Reset server");
addILCCommand(
"reset", [](ILCUnit u) { u.first->resetServer(u.second); }, "Reset server");

addCommand("program-ilc", std::bind(&FPGACliApp::programILC, this, std::placeholders::_1), "FS?",
NEED_FPGA, "<firmware hex file> <ILC...>", "Program ILC with new firmware.");
Expand Down
10 changes: 4 additions & 6 deletions src/LSST/cRIO/MPUTelemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
namespace LSST {
namespace cRIO {

MPUTelemetry::MPUTelemetry(uint8_t *data) {
writeBytes = be32toh(*(reinterpret_cast<uint32_t *>(data + 0)));
readBytes = be32toh(*(reinterpret_cast<uint32_t *>(data + 4)));
readTimedout = be16toh(*(reinterpret_cast<uint16_t *>(data + 8)));
MPUTelemetry::MPUTelemetry(const uint8_t *data) {
writeBytes = be64toh(*(reinterpret_cast<const uint64_t *>(data + 0)));
readBytes = be64toh(*(reinterpret_cast<const uint64_t *>(data + 8)));
}

std::ostream &operator<<(std::ostream &os, const MPUTelemetry &tel) {
os << std::setw(20) << "Write bytes: " << tel.writeBytes << std::endl
<< std::setw(20) << "Read bytes: " << tel.readBytes << std::endl
<< std::setw(20) << "Read timedout: " << tel.readTimedout << std::endl;
<< std::setw(20) << "Read bytes: " << tel.readBytes << std::endl;
return os;
}

Expand Down

0 comments on commit 4d787c5

Please sign in to comment.