|
LevelMeter-Display
2.0
An ultrasonic Level Meter for Stormwater Cisterns
|
The Main Program and miscellaneous Routines. More...
Functions | |
| void | delay10ms (delay_t delay10ms) |
| Delay for a multiple of 10ms. More... | |
| static void | DoCflags (void) |
| Checks for Communication Flags. More... | |
| static void | DoKFlags (void) |
| Checks for Key Flags. More... | |
| static void | DoTflags (void) |
| Checks for Time Flags. More... | |
| static void | Init (void) |
| Initializes the System. More... | |
| static int16_t | IntLimit (LITERS_T i) |
| limits an integer from -9999 to +9999 for display purposes More... | |
| ISR (TIMER0_COMP_vect) | |
| Timer0 compare interrupt (100Hz) More... | |
| static LITERS_T | LitersFromDist (double dist) |
| Computes the Volume in Liters from the Distance in Meters. More... | |
| int | main (void) |
| The Main Program. More... | |
| static void | ResetDisplayFlags (void) |
| Resets the Error Flags in the Display. More... | |
| void | SetAnalogPerCent (double perCent) |
| Sets the analog Instrument display. More... | |
| static void | ShowScreen (showScreen_t action, uint8_t pageNo) |
| Steps through various Screens to be displayed. More... | |
Variables | |
| bool | backlightAlwaysOn |
| Shall the Backlight be always on? More... | |
| uint8_t | backlightOnTime |
| Time in Seconds the LCD-Backlight is already on (topped at 255 Seconds) More... | |
| 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... | |
| uint8_t | bootLdPage [32] |
| Holds the data for boot loader write/read. More... | |
| const char * | build ="Bld " __DATE__ |
| The Build Date as to be displayed in the Boot Screen. 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 volatile delay_t | delaycnt |
| Counter for delay() More... | |
| volatile uint8_t | dFlags |
| Flags Controlling Debug Output. More... | |
| const displayMetrics_T | displayMetrics [2] |
| Metrics for each of the possible displays. More... | |
| static uint8_t | displayTimer |
| Counts the seconds for each display page. More... | |
| displayValues_t | displayValues |
| Holds all values that are used for display. More... | |
| double | distance |
| To the reflecting surface in meters. More... | |
| FUSES | |
| Fuse settings for the Production ELF file. More... | |
| volatile uint8_t | hrCnt |
| Hours of the RTC. More... | |
| LOCKBITS = (LB_MODE_1) | |
| The Lock Bits for the production File. 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 [] ={"normal","faster","slower"} |
| Human readable interpretation of RTCAdj. More... | |
| volatile uint8_t | secCnt |
| Seconds of the RTC. More... | |
| static bool | sensorDead |
| Is set to false when a sensor telegram arrives. More... | |
| double | speedOfSound |
| In m/s, temperature calibrated. More... | |
| uint8_t | tempRaw |
| Raw value from the ADC. More... | |
| signed char | tempSemi |
| Temperature in 0.5°C. 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... | |
The Main Program and miscellaneous Routines.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
| 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 |
|
static |
Checks for Communication Flags.
|
static |
Checks for Key Flags.
|
static |
Checks for Time Flags.
|
static |
Initializes the System.
|
static |
limits an integer from -9999 to +9999 for display purposes
| i | the value to limit |
| ISR | ( | TIMER0_COMP_vect | ) |
Timer0 compare interrupt (100Hz)
The 100Hz-interrupt is not only used to create a RTC (Real Time Clock) but also for other tasks that rely on a constant timing, i.e. the DCF77 routines and debouncing of the Key.
If you change the frequency, be sure of all of the consequences!
|
inlinestatic |
Computes the Volume in Liters from the Distance in Meters.
| dist | The distance in Meters |
| int main | ( | void | ) |
The Main Program.
|
static |
Resets the Error Flags in the Display.
Replaces the error flag characters (aka "<PC") by spaces
| 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. |
|
static |
Steps through various Screens to be displayed.
| action | What to do:
|
| pageNo | The zero-based index of the Page to be displayed. Only used if action==SCREENABSPAGE |
| bool backlightAlwaysOn |
Shall the Backlight be always on?
| uint8_t backlightOnTime |
Time in Seconds the LCD-Backlight is already on (topped at 255 Seconds)
| volatile uint8_t blFlags |
Boot Loader Communication Flags.
| uint8_t boCnt |
Counts the number of Brown Out Resets.
| uint16_t bootLdAdr |
The address of the page.
| uint8_t bootLdPage[32] |
Holds the data for boot loader write/read.
| const char* build ="Bld " __DATE__ |
The Build Date as to be displayed in the Boot Screen.
| 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
| volatile char cmdline[81] |
Ready to hold 80 chars plus terminating 0.
| uint8_t deadTime |
Received dead time value from the sensor.
|
static |
Counter for delay()
| volatile uint8_t dFlags |
Flags Controlling Debug Output.
| const displayMetrics_T displayMetrics[2] |
Metrics for each of the possible displays.
|
static |
Counts the seconds for each display page.
| displayValues_t displayValues |
Holds all values that are used for display.
| double distance |
To the reflecting surface in meters.
| FUSES |
Fuse settings for the Production ELF file.
| volatile uint8_t hrCnt |
Hours of the RTC.
| LOCKBITS = (LB_MODE_1) |
The Lock Bits for the production File.
| volatile uint8_t minCnt |
Minutes of the RTC.
| double pulseTime |
In seconds.
| uint16_t pulseTimeInt |
Traveling time of the last pulse in timer1-clocks of the sensor CPU.
| uint8_t pulseTimeMult |
1 or 8 clocks from sensor timer1 prescaler
| volatile RTCAdj_t RTCAdj |
Soft Adjustment of the RTC (+-1%)
| const char* RTCAdjTxt[] ={"normal","faster","slower"} |
Human readable interpretation of RTCAdj.
| volatile uint8_t secCnt |
Seconds of the RTC.
|
static |
Is set to false when a sensor telegram arrives.
| double speedOfSound |
In m/s, temperature calibrated.
| uint8_t tempRaw |
Raw value from the ADC.
| signed char tempSemi |
Temperature in 0.5°C.
| 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.
| volatile uint8_t tickCnt |
counter for timer0 interrupts
| uint8_t wdrCnt |
Counts the number of Watchdog Resets.
1.8.3.1