diff --git a/esp-vent-main/src/PressureWrapper.cpp b/esp-vent-main/src/PressureWrapper.cpp index f7a0d90..79e2d78 100644 --- a/esp-vent-main/src/PressureWrapper.cpp +++ b/esp-vent-main/src/PressureWrapper.cpp @@ -42,14 +42,14 @@ int PressureWrapper::getPressure() { getRawPressure (); i = 0; } -// do { -// getRawPressure (); -// } while (crc8(data.rBuffer, 2) != data.crc); + if(crc8(data.rBuffer, 2) != data.crc){ pressure = data.rBuffer[0]; pressure = pressure << 8; pressure |= data.rBuffer[1]; float result = (float) pressure * 0.95 / 240; return (int) result; + } + return -255; } bool PressureWrapper::getRawPressure () { diff --git a/esp-vent-main/src/esp-vent-main.cpp b/esp-vent-main/src/esp-vent-main.cpp index 6e8783a..2ed9296 100644 --- a/esp-vent-main/src/esp-vent-main.cpp +++ b/esp-vent-main/src/esp-vent-main.cpp @@ -72,8 +72,11 @@ main (void) SwitchController sw_toggle (&b_toggle, &glob_time, &ventMachine, BUTTON_CONTROL_TOG_MODE); + PressureWrapper sens(); + + while (1) { @@ -84,7 +87,7 @@ main (void) * TODO: * - Update current pressure to eTick */ - ventMachine.HandleState (Event (Event::eTick, 0)); + ventMachine.HandleState (Event (Event::eTick)); glob_time.tickCounter (1); }