Skip to content

Commit

Permalink
Fixed issues
Browse files Browse the repository at this point in the history
Signed-off-by: ActuallyTaylor <taylor.lineman@gmail.com>
  • Loading branch information
ActuallyTaylor committed Oct 30, 2023
1 parent 59e6bc3 commit 4b01203
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions src/HUDL/HUDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ uint16_t HUDL::getObjectDictionarySize() const {
void HUDL::updateLCD() {
if (!setHeaders) {
lcd.clearLCD();
headerForCorner(TOP_LEFT, "Battery");
headerForCorner(TOP_RIGHT, "HI Temp");
headerForCorner(TOP_LEFT, "Bat %");
headerForCorner(TOP_RIGHT, "Temp");
headerForCorner(BOTTOM_LEFT, "RPM");
headerForCorner(BOTTOM_RIGHT, "MC Stat");
setHeaders = true;
Expand All @@ -59,7 +59,7 @@ void HUDL::updateLCD() {
}

char temp[9];
std::sprintf(temp, "0x%02X C", highestTemp);
std::sprintf(temp, "%hu.%hu C", highestTemp / 10, highestTemp % 10);
dataForCorner(TOP_RIGHT, temp);

// Set the rpm
Expand All @@ -75,7 +75,7 @@ void HUDL::updateLCD() {
} else if (statusWord == 0x27) {
std::sprintf(status, "GO");
} else {
std::sprintf(status, "0x%x", statusWord);
std::sprintf(status, "%x", statusWord);
}

dataForCorner(BOTTOM_RIGHT, status);
Expand Down Expand Up @@ -115,9 +115,6 @@ void HUDL::dataForCorner(HUDL::Corner corner, const char* text) {
lcd.writeText(text, sectionPage, sectionColumn, EVT::core::DEV::LCD::FontSize::LARGE, false);
}

// Ignore the -Wreturn-type warning that occurs here because of the switch statements.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type"
uint8_t HUDL::columnForCorner(HUDL::Corner corner) {
switch (corner) {
case TOP_LEFT:
Expand All @@ -126,6 +123,8 @@ uint8_t HUDL::columnForCorner(HUDL::Corner corner) {
case TOP_RIGHT:
case BOTTOM_RIGHT:
return 64;
default:
return -1;
}
}

Expand All @@ -137,7 +136,10 @@ uint8_t HUDL::pageForCorner(HUDL::Corner corner) {
case BOTTOM_LEFT:
case BOTTOM_RIGHT:
return 4;
default:
return -1;
}

}
#pragma GCC diagnostic pop

Expand Down
5 changes: 3 additions & 2 deletions targets/HUDL/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using namespace std;
* will be passed to the EVT-core CAN interface which will in turn call this
* function each time a new CAN message comes in.
*
* NOTE: For this sample, every non-extended (so 11 bit CAN IDs) will be
* NOTE: For this sample, every non-extended (so 11 bit CAN IDs) will be
* assumed to be intended to be passed as a CANopen message.
*
* @param message[in] The passed in CAN message that was read.
Expand All @@ -55,7 +55,8 @@ int main() {

IO::UART& uart = IO::getUART<IO::Pin::PB_9, IO::Pin::PB_8>(9600);
log::LOGGER.setUART(&uart);

log::LOGGER.setLogLevel(log::Logger::LogLevel::INFO);

// Will store CANOpen messages that will be populated by the EVT-core CAN
// interrupt
auto canOpenQueue = EVT::core::types::FixedQueue<CANOPEN_QUEUE_SIZE, IO::CANMessage>(true);
Expand Down

0 comments on commit 4b01203

Please sign in to comment.