Index: firmware/App/Monitors/Level.c =================================================================== diff -u -r9775f66eab915af9b353006a4fcb8d1f393a410d -r72d735179cbbb0e3e8be9c38392eee055f7b2697 --- firmware/App/Monitors/Level.c (.../Level.c) (revision 9775f66eab915af9b353006a4fcb8d1f393a410d) +++ firmware/App/Monitors/Level.c (.../Level.c) (revision 72d735179cbbb0e3e8be9c38392eee055f7b2697) @@ -31,8 +31,9 @@ #define FPGA_LEVEL_LOW 2 ///< Floater low level status #define FPGA_LEVEL_MEDIUM 3 ///< Floater medium level status #define FPGA_LEVEL_HIGH 1 ///< Floater high level status -#define LEVEL_COUNT_LOW 0x637F ///< Level sensor count when fluid level is low or non submerged -#define LEVEL_COUNT_HIGH ( LEVEL_COUNT_LOW / 2 ) ///< Level sensor count when fluid level is high or submerged +#define LEVEL_COUNT_LOW 0xFFFF ///< Level sensor count when fluid level is low or non submerged +#define LEVEL_COUNT_HIGH_START 0x2000 ///< Start range of level sensor count when fluid level is high or submerged +#define LEVEL_COUNT_HIGH_END 0x2FFF ///< End range of level sensor count when fluid level is high or submerged #define LOW_LEVEL_COUNT_TOLERANCE ( ( LEVEL_COUNT_LOW / 100 ) * 1 ) ///< Level sensor count 1% tolerance for low level #define HIGH_LEVEL_COUNT_TOLERANCE ( ( LEVEL_COUNT_HIGH / 100 ) * 1 ) ///< Level sensor count 1% tolerance for high level #define LEVEL_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the level data is published on the CAN bus. @@ -235,15 +236,10 @@ { BOOL level = FALSE; - // Check the level count with in the low/high level range - if ( ( count < LEVEL_COUNT_LOW + LOW_LEVEL_COUNT_TOLERANCE ) && - ( count > LEVEL_COUNT_LOW - LOW_LEVEL_COUNT_TOLERANCE ) ) + // Check the level count with in the high level range + if ( ( count >= LEVEL_COUNT_HIGH_START ) && + ( count <= LEVEL_COUNT_HIGH_END ) ) { - level = FALSE; - } - else if ( ( count < LEVEL_COUNT_HIGH + HIGH_LEVEL_COUNT_TOLERANCE ) && - ( count > LEVEL_COUNT_HIGH - HIGH_LEVEL_COUNT_TOLERANCE ) ) - { level = TRUE; } else