Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Corrected TypeBit parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
crsz20 committed Jan 4, 2024
1 parent 62bbb1a commit fff8615
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Project/DAQ_System/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2"/>
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F"/>
</option>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.languagestandard.1510859129" name="Language standard" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.languagestandard" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.languagestandard.value.gnupp14" valueType="enumerated"/>
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp.1879535246" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp"/>
</tool>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.1415815366" name="MCU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class FramePE2 : public FrameFormat4 {
case(TypeBit::kHigh): return PressureType::kKiloPascal;
case(TypeBit::kLow): return PressureType::kPoundsPerSquareInch;
}

return PressureType::kUnknown;
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class FramePE6 : public FrameFormat4 {
case(TypeBit::kHigh): return TemperatureType::kCelsius;
case(TypeBit::kLow): return TemperatureType::kFarenheit;
}

return TemperatureType::kUnknown;
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ bool ParseFields(const uint8_t rx_buffer[kByteArrayMaxLength], std::vector<int16
// ECU datasheet describes one "bit", but it is actually a whole byte of 1s (0xFF).
// This may be a "bit" in the sense that the byte will only have two possible values (hence, binary bit).
TypeBit ParseTypeBit(const uint8_t rx_buffer[kByteArrayMaxLength]) {
static constexpr uint8_t kHigh = 0xFF;
static constexpr uint8_t kHigh = 0x01;
static constexpr uint8_t kLow = 0;

uint8_t type_bit = rx_buffer[kByteArrayMaxLength - 1];
uint8_t type_bit = rx_buffer[kByteArrayMaxLength - 2];

if (type_bit == kHigh) {
return TypeBit::kHigh;
Expand Down

0 comments on commit fff8615

Please sign in to comment.