|
LevelMeter-Display
2.0
An ultrasonic Level Meter for Stormwater Cisterns
|


Go to the source code of this file.
Data Structures | |
| struct | displayMetrics_T |
| Parameters for each of the possible Displays. More... | |
| struct | displayValues_t |
| Holds all values used for Display Purposes. More... | |
Macros | |
| #define | ADCVoltsPerLSB (2.56/1024) |
| Voltage step for one LSB of the AD converter. More... | |
| #define | dividerP3 (4.7/(4.7+8.2)) |
| Resistor divider for P3. Gives 7.03V FSR or 6.86mV/LSB. More... | |
| #define | dividerP5 (4.7/(4.7+8.2)) |
| Resistor divider for P5. Gives 7.03V FSR or 6.86mV/LSB. More... | |
| #define | dividerSWUnreg (4.7/(4.7+68)) |
| Resistor divider for SWUnreg. Gives 39.6V FSR or 38.7mV/LSB. More... | |
| #define | dividerUnreg (4.7/(4.7+68)) |
| Resistor divider for Unreg. Gives 39.6V FSR or 38.7mV/LSB. More... | |
| #define | SCREENABSPAGE_VERSION 128 |
| Display Version Screen at startup. More... | |
| #define | SIGNAL_1_MASK 0b00000100 |
| #define | SIGNAL_2_MASK 0b00001000 |
| #define | SIGNAL_PORT PORTA |
| #define | WITH_UPDATE |
| Compile with Sensor Update Function. More... | |
Typedefs | |
| typedef uint8_t | delay_t |
| typedef double | LITERS_T |
| Remember that liters may go negative. More... | |
Enumerations | |
| enum | displayType_t { DISPLAY_2x16, DISPLAY_4x20, DISPLAY_ANALOG } |
| Constants for Display Type. More... | |
| enum | RTCAdj_t { RTC_NORMAL, RTC_FASTER, RTC_SLOWER } |
| Current speed of the RTC (Real Time Clock) More... | |
| enum | showScreen_t { SCREENSTEPAUTO, SCREENSTEPMANU, SCREENREFRESH, SCREENABSPAGE } |
| Command for ShowScreen() More... | |
Functions | |
| static void | BluetoothPowerOff (void) |
| Switches the Bluetooth Power off. More... | |
| static void | BluetoothPowerOn (void) |
| Switches the Bluetooth Power on. More... | |
| void | delay10ms (delay_t delay10ms) |
| Delay for a multiple of 10ms. More... | |
| static bool | GetSig1 (void) |
| Gets State of Optocoupler 1 True means Optocoupler is ON. More... | |
| static bool | GetSig2 (void) |
| Gets State of Optocoupler 2 True means Optocoupler is ON. More... | |
| LITERS_T | LitersFromDist (double dist) |
| Computes the Volume in Liters from the Distance in Meters. More... | |
| void | ResetDisplayFlags (void) |
| Resets the Error Flags in the Display. More... | |
| static void | SensorPowerOff (void) |
| Switches the Sensor Power off. More... | |
| static void | SensorPowerOn (void) |
| Switches the Sensor Power on. More... | |
| void | SetAnalogPerCent (double perCent) |
| Sets the analog Instrument display. More... | |
| static void | Sig1OFF (void) |
| Switches Signal Output Optocoupler 1 to OFF. More... | |
| static void | Sig1ON (void) |
| Switches Signal Output Optocoupler 1 to ON. More... | |
| static void | Sig2OFF (void) |
| Switches Signal Output Optocoupler 2 to OFF. More... | |
| static void | Sig2ON (void) |
| Switches Signal Output Optocoupler 2 to ON. More... | |
Variables | |
| volatile uint8_t | blFlags |
| Boot Loader Communication Flags. More... | |
| uint8_t | boCnt |
| Counts the number of Brown Out Resets. More... | |
| uint16_t | bootLdAdr |
| The address of the page. More... | |
| static const uint8_t | BOOTLDDATA =2 |
| Boot Loader Data received ("=") More... | |
| static const uint8_t | BOOTLDERROR =8 |
| Boot Loader Error received ("-") More... | |
| static const uint8_t | BOOTLDHELLO =1 |
| Boot Loader Hello received ("*") More... | |
| static const uint8_t | BOOTLDOK =4 |
| Boot Loader Data received ("+") More... | |
| uint8_t | bootLdPage [] |
| Holds the data for boot loader write/read. More... | |
| static const uint8_t | BOOTLDPROTECTED =16 |
| Boot Loader Protected Area received ("P") More... | |
| static const uint8_t | CFLAG_BTRECEIVED =64 |
| Received a telegram from the Bluetooth-Module. More... | |
| static const uint8_t | CFLAG_BYTERECEIVED =32 |
| Received a Byte from the host. More... | |
| static const uint8_t | CFLAG_CHECKSUMERROR =8 |
| Checksum Error in received Telegram. More... | |
| static const uint8_t | CFLAG_CMDRECEIVED =16 |
| Received the terminating CR of a Command. More... | |
| static const uint8_t | CFLAG_PARITYERROR =4 |
| Parity Error in received Byte. More... | |
| static const uint8_t | CFLAG_TEMPRECEIVED =2 |
| Received the current Sensor Temperature. More... | |
| static const uint8_t | CFLAG_TIMERECEIVED =1 |
| Received a Travel Time from the Sensor. More... | |
| volatile uint8_t | cFlags |
| Flags set by Serial Communication with the Sensor. More... | |
| volatile char | cmdline [81] |
| Ready to hold 80 chars plus terminating 0. More... | |
| uint8_t | deadTime |
| Received dead time value from the sensor. More... | |
| static const uint8_t | DFLAG_ADC =4 |
| Gives information about ADC MIN/MAX Values. More... | |
| static const uint8_t | DFLAG_DCF77 =1 |
| Gives information about DCF77 and RTC. More... | |
| static const uint8_t | DFLAG_SENSOR =2 |
| Gives information about Sensor Communication. More... | |
| volatile uint8_t | dFlags |
| Flags Controlling Debug Output. More... | |
| const displayMetrics_T | displayMetrics [] |
| Metrics for each of the possible displays. More... | |
| displayType_t | displayType |
| displayValues_t | displayValues |
| Holds all values that are used for display. More... | |
| double | distance |
| To the reflecting surface in meters. More... | |
| volatile uint8_t | hrCnt |
| Hours of the RTC. More... | |
| double | lastReportedVolume |
| Last Volume spontaneously reported. More... | |
| volatile uint8_t | minCnt |
| Minutes of the RTC. More... | |
| double | pulseTime |
| In seconds. More... | |
| uint16_t | pulseTimeInt |
| Traveling time of the last pulse in timer1-clocks of the sensor CPU. More... | |
| uint8_t | pulseTimeMult |
| 1 or 8 clocks from sensor timer1 prescaler More... | |
| volatile RTCAdj_t | RTCAdj |
| Soft Adjustment of the RTC (+-1%) More... | |
| const char * | RTCAdjTxt [] |
| Human readable interpretation of RTCAdj. More... | |
| volatile uint8_t | secCnt |
| Seconds of the RTC. More... | |
| double | speedOfSound |
| In m/s, temperature calibrated. More... | |
| uint8_t | tempRaw |
| Raw value from the ADC. More... | |
| signed char | tempSemi |
| static const uint8_t | TFLAG_DAY =8 |
| Is set every Day at Midnight. More... | |
| static const uint8_t | TFLAG_HOUR =4 |
| Is set once per Hour at Minute 0. More... | |
| static const uint8_t | TFLAG_MIN =2 |
| Is set once per Minute at Second 0. More... | |
| static const uint8_t | TFLAG_SEC =1 |
| Is set once per Second. More... | |
| volatile uint8_t | tFlags |
| Flags set by Timer Interrupt to signal Main Loop. More... | |
| volatile uint8_t | tickCnt |
| counter for timer0 interrupts More... | |
| uint8_t | wdrCnt |
| Counts the number of Watchdog Resets. More... | |
| #define ADCVoltsPerLSB (2.56/1024) |
Voltage step for one LSB of the AD converter.
| #define dividerP3 (4.7/(4.7+8.2)) |
Resistor divider for P3. Gives 7.03V FSR or 6.86mV/LSB.
| #define dividerP5 (4.7/(4.7+8.2)) |
Resistor divider for P5. Gives 7.03V FSR or 6.86mV/LSB.
| #define dividerSWUnreg (4.7/(4.7+68)) |
Resistor divider for SWUnreg. Gives 39.6V FSR or 38.7mV/LSB.
| #define dividerUnreg (4.7/(4.7+68)) |
Resistor divider for Unreg. Gives 39.6V FSR or 38.7mV/LSB.
| #define SCREENABSPAGE_VERSION 128 |
Display Version Screen at startup.
| #define SIGNAL_1_MASK 0b00000100 |
| #define SIGNAL_2_MASK 0b00001000 |
| #define SIGNAL_PORT PORTA |
| #define WITH_UPDATE |
Compile with Sensor Update Function.
| typedef uint8_t delay_t |
| typedef double LITERS_T |
Remember that liters may go negative.
| enum displayType_t |
| enum RTCAdj_t |
| enum showScreen_t |
Command for ShowScreen()
|
inlinestatic |
Switches the Bluetooth Power off.
|
inlinestatic |
| void delay10ms | ( | delay_t | delay10ms | ) |
Delay for a multiple of 10ms.
This function allows delays up to the range of delay_t controlled by the timer interrupt.
delay_t should be an unsigned integer type.
delaycnt must be decremented in the 100Hz-Interrupt.
This function of course takes care of the Watchdog and puts the CPU into sleep mode until the time expires.
| delay10ms | Delay in multiple of 10ms |
References delay10ms(), and delaycnt.
Referenced by CmdCalibrate(), delay10ms(), FTest485(), HBarTest(), and VBarTest().


|
inlinestatic |
Gets State of Optocoupler 1 True means Optocoupler is ON.
References SIGNAL_1_MASK, and SIGNAL_PORT.
Referenced by DoTflags().

|
inlinestatic |
Gets State of Optocoupler 2 True means Optocoupler is ON.
References SIGNAL_2_MASK, and SIGNAL_PORT.
Referenced by DoTflags().

| LITERS_T LitersFromDist | ( | double | dist | ) |
Computes the Volume in Liters from the Distance in Meters.
| dist | The distance in Meters |
References CIST_CONST_AREA, CIST_HORIZ_CYL, CIST_SPHERE, confStruct_t::cistAreaOrDiameter, confStruct_t::cisternType, confStruct_t::cistHeight, confStruct_t::cistLength, and config.
Referenced by CmdDistance(), and DoCflags().

| void ResetDisplayFlags | ( | void | ) |
Resets the Error Flags in the Display.
Replaces the character type members flag characters (aka "<PC") by printable default values.
References displayValues_t::checksumErrorChar, displayValues, displayValues_t::error, displayValues_t::literUnitChar, displayValues_t::not10ErrorChar, displayValues_t::parityErrorChar, and displayValues_t::sensorDeadChar.
Referenced by CmdClearErrors(), DoTflags(), and Init().

|
inlinestatic |
Switches the Sensor Power off.
Referenced by CmdCalibrate(), CmdDistance(), DoCflags(), DoTflags(), FTest(), FTestSWUnreg(), UpdateSensorFirmware(), and VerifySensorFirmware().

|
inlinestatic |
Switches the Sensor Power on.
Referenced by CmdCalibrate(), CmdDistance(), DoTflags(), FTestSWUnreg(), UpdateSensorFirmware(), and VerifySensorFirmware().

| void SetAnalogPerCent | ( | double | perCent | ) |
Sets the analog Instrument display.
| perCent | The value in a range from 0.0 to 100.0. Exceeding values will be trimmed correctly. |
References config, and confStruct_t::instCal.
Referenced by CmdAnalog(), CmdCalibrate(), and DoCflags().

|
inlinestatic |
Switches Signal Output Optocoupler 1 to OFF.
References SIGNAL_1_MASK, and SIGNAL_PORT.
Referenced by DoCflags(), and FTestToggleSignal().

|
inlinestatic |
Switches Signal Output Optocoupler 1 to ON.
References SIGNAL_1_MASK, and SIGNAL_PORT.
Referenced by DoCflags(), and FTestToggleSignal().

|
inlinestatic |
Switches Signal Output Optocoupler 2 to OFF.
References SIGNAL_2_MASK, and SIGNAL_PORT.
Referenced by DoCflags(), and FTestToggleSignal().

|
inlinestatic |
Switches Signal Output Optocoupler 2 to ON.
References SIGNAL_2_MASK, and SIGNAL_PORT.
Referenced by DoCflags(), and FTestToggleSignal().

| volatile uint8_t blFlags |
Boot Loader Communication Flags.
Referenced by BootldRead(), BootldWrite(), ISR(), ProgramSensor(), UpdateSensorFirmware(), and VerifySensorFirmware().
| uint8_t boCnt |
Counts the number of Brown Out Resets.
Referenced by CmdClearErrors(), CmdStat(), Init(), and ShowScreen().
| uint16_t bootLdAdr |
The address of the page.
|
static |
Boot Loader Data received ("=")
Referenced by BootldRead(), and ISR().
|
static |
Boot Loader Error received ("-")
Referenced by BootldRead(), BootldWrite(), and ISR().
|
static |
Boot Loader Hello received ("*")
Referenced by ISR(), UpdateSensorFirmware(), and VerifySensorFirmware().
|
static |
Boot Loader Data received ("+")
Referenced by ISR().
| uint8_t bootLdPage[] |
Holds the data for boot loader write/read.
Referenced by ISR(), and VerifySensor().
|
static |
Boot Loader Protected Area received ("P")
Referenced by ISR().
|
static |
Received a telegram from the Bluetooth-Module.
Referenced by DoCflags(), ISR(), and usart1FlushRx().
|
static |
Received a Byte from the host.
Referenced by CmdCalibrate(), CmdDistance(), DoCflags(), ISR(), and usart1FlushRx().
|
static |
Checksum Error in received Telegram.
Referenced by DoCflags(), and ISR().
|
static |
Received the terminating CR of a Command.
Referenced by DoCflags(), EnterDouble(), ISR(), ReadIntelHex(), and usart1FlushRx().
|
static |
Parity Error in received Byte.
Referenced by DoCflags(), and ISR().
|
static |
Received the current Sensor Temperature.
Referenced by DoCflags(), and ISR().
|
static |
Received a Travel Time from the Sensor.
Referenced by CmdDistance(), DoCflags(), and ISR().
| volatile uint8_t cFlags |
Flags set by Serial Communication with the Sensor.
The flags are set by serial interrupt and must be cleared by the main loop
Referenced by CmdCalibrate(), CmdDistance(), DoCflags(), EnterDouble(), ISR(), main(), ReadIntelHex(), and usart1FlushRx().
| volatile char cmdline[81] |
Ready to hold 80 chars plus terminating 0.
Referenced by CopyRbuf1ToCmdline(), DoCflags(), DoOneLine(), EnterDouble(), and ReadIntelHex().
| uint8_t deadTime |
Received dead time value from the sensor.
Referenced by DoCflags(), and ISR().
|
static |
Gives information about ADC MIN/MAX Values.
Referenced by CmdDebug(), and DoTflags().
|
static |
Gives information about DCF77 and RTC.
Referenced by CmdDebug(), DCF77int(), PushBit(), and RTCsync().
|
static |
Gives information about Sensor Communication.
Referenced by CmdDebug(), and DoCflags().
| volatile uint8_t dFlags |
Flags Controlling Debug Output.
Referenced by CmdDebug(), DCF77int(), DoCflags(), DoTflags(), PushBit(), and RTCsync().
| const displayMetrics_T displayMetrics[] |
Metrics for each of the possible displays.
Referenced by HBarGraphPerCent(), LCDBuildVBarChars(), LCDHBarGraph(), LCDPrintLine_P(), ShowScreen(), and VBarGraphPrepare().
| displayType_t displayType |
| displayValues_t displayValues |
Holds all values that are used for display.
Referenced by CmdDistance(), CmdGetSensorValues(), CmdStat(), DoCflags(), DoTflags(), HBarGraphPerCent(), Init(), ISR(), main(), ResetDisplayFlags(), ShowScreen(), and VBarGraphPrepare().
| double distance |
To the reflecting surface in meters.
Referenced by CmdDistance(), CmdStat(), DoCflags(), and ShowScreen().
| volatile uint8_t hrCnt |
Hours of the RTC.
Referenced by CmdDistance(), CmdSetTime(), CmdStat(), DoTflags(), ISR(), RTCsync(), ShowScreen(), and SoundsOK().
| double lastReportedVolume |
Last Volume spontaneously reported.
Referenced by CmdStat(), and DoTflags().
| volatile uint8_t minCnt |
Minutes of the RTC.
Referenced by CmdDistance(), CmdSetTime(), CmdStat(), DoTflags(), ISR(), RTCsync(), and ShowScreen().
| double pulseTime |
In seconds.
Referenced by CmdDistance(), DoCflags(), and ShowScreen().
| uint16_t pulseTimeInt |
Traveling time of the last pulse in timer1-clocks of the sensor CPU.
Referenced by CmdDistance(), DoCflags(), and ISR().
| uint8_t pulseTimeMult |
1 or 8 clocks from sensor timer1 prescaler
Referenced by CmdDistance(), DoCflags(), and ISR().
| volatile RTCAdj_t RTCAdj |
Soft Adjustment of the RTC (+-1%)
Referenced by CmdStat(), Invalidate(), ISR(), and RTCsync().
| const char* RTCAdjTxt[] |
| volatile uint8_t secCnt |
Seconds of the RTC.
Referenced by CmdDistance(), CmdSetTime(), CmdStat(), DoCflags(), DoTflags(), FTest485(), ISR(), RTCsync(), and ShowScreen().
| double speedOfSound |
In m/s, temperature calibrated.
Referenced by CmdDistance(), DoCflags(), Init(), and ShowScreen().
| uint8_t tempRaw |
Raw value from the ADC.
Referenced by DoCflags(), and ISR().
| signed char tempSemi |
|
static |
Is set every Day at Midnight.
Referenced by DoTflags(), and ISR().
|
static |
Is set once per Hour at Minute 0.
Referenced by DoTflags(), and ISR().
|
static |
Is set once per Minute at Second 0.
Referenced by DoTflags(), and ISR().
|
static |
Is set once per Second.
Referenced by DoTflags(), and ISR().
| volatile uint8_t tFlags |
Flags set by Timer Interrupt to signal Main Loop.
The flags are set each second, minute, hour or day respectively by timer interrupt. The flags must be cleared by the main loop.
Referenced by DoTflags(), ISR(), and main().
| volatile uint8_t tickCnt |
counter for timer0 interrupts
Referenced by BootldWrite(), DoCflags(), FTestSWUnreg(), ISR(), RTCsync(), and WaitKeyBlinking().
| uint8_t wdrCnt |
Counts the number of Watchdog Resets.
Referenced by CmdClearErrors(), CmdStat(), Init(), and ShowScreen().
1.8.15