|
LevelMeter-Display
2.0
An ultrasonic Level Meter for Stormwater Cisterns
|
Handles commands from the Host Interface. More...

Macros | |
| #define | MAXPARAMS 5 |
Functions | |
| static int8_t | CmdAnalog (void) |
| Set the analog instrument to a certain position. More... | |
| static int8_t | CmdCalibrate (void) |
| Calibrates the Voltage Sensors. More... | |
| static int8_t | CmdClearErrors (void) |
| Clears Error Flags and Counters. More... | |
| static int8_t | CmdDebug (void) |
| Sets Debug Options. More... | |
| static int8_t | CmdDistance (void) |
| Continuously prints the Sensor Distance Value. More... | |
| static int8_t | CmdDumpConf (void) |
| Prints the Configuration Memory in a human readable form. More... | |
| static int8_t | CmdFTest (void) |
| Performs a Factory Test. More... | |
| static int8_t | CmdGetSensorValues (void) |
| Retrieves the Sensor Values. More... | |
| static int8_t | CmdHelp (void) |
| Lists a Description of all Commands. More... | |
| static int8_t | CmdReset (void) |
| Causes a Watchdog Reset. Useful for Debugging. More... | |
| static int8_t | CmdSetBright (void) |
| Sets the Brightness of the LCD Backlight. More... | |
| static int8_t | CmdSetCistern (void) |
| Sets the Cistern Metrics. More... | |
| static int8_t | CmdSetContrast (void) |
| Sets the Contrast of the LCD Backlight. More... | |
| static int8_t | CmdSetDCFInv (void) |
| Sets the DCF-Pin logic. More... | |
| static int8_t | CmdSetDisplay (void) |
| Sets the Display type. More... | |
| static int8_t | CmdSetOcr (void) |
| Sets the OCR1CL to an absolute Value. More... | |
| static int8_t | CmdSetPTime (void) |
| Sets the Delay for automatic Display stepping. More... | |
| static int8_t | CmdSetPTimeK (void) |
| Sets the Delay for switchback from manual to automatic Display stepping. More... | |
| static int8_t | CmdSetSignal (void) |
| Sets the Thresholds for a Signaling Output. More... | |
| static int8_t | CmdSetSounds (void) |
| Sets the Sounds-OK-Time and Soundmask. More... | |
| static int8_t | CmdSetSpontaneous (void) |
| Sets Spontaneous Volume Reporting. More... | |
| static int8_t | CmdSetTime (void) |
| Sets the Time. More... | |
| static int8_t | CmdStat (void) |
| Prints Values of System Sensors... More... | |
| static int8_t | CmdUpdateSensorFirmware (void) |
| Updates the Sensor Firmware. More... | |
| static int8_t | CmdUseRts (void) |
| Sets if to use RTS/CTS-Handshake. More... | |
| static int8_t | CmdVerifySensorFirmware (void) |
| Verifies the Sensor Firmware against an Intel-HEX-File. More... | |
| static int8_t | CmdWrite (void) |
| Writes the Configuration to the EEPROM. More... | |
| static double | EnterDouble (void) |
| Receives a Double from the Host. More... | |
| uint8_t | ExecCommand (char *str) |
| Executes one command line. More... | |
| static void | ExtraIgnored (uint8_t n) |
| Prints error message about superfluous parameters. More... | |
| static void | MissingArg (void) |
| Prints error message about missing arguments. More... | |
Variables | |
| static char * | cmd |
| static const commandTable_t | commandTable [] |
| static const char | helpCalibrate [] |
| static const char | helpClearErrors [] = "Clear error flags and counters" |
| static const char | helpDCFinv [] = "Sets DCF77-pin polarity" |
| static const char | helpDebug [] = "Change debug settings" |
| static const char | helpDistance [] = "Continuously prints sensor distance value until you press a key" |
| static const char | helpDumpConf [] = "Prints a human readable list of configuration data" |
| static const char | helpFTest [] = "Executes the factory test" |
| static const char | helpGetSensorValues [] = "Gets sensor measurement values" |
| static const char | helpHelp [] = "This list of commands" |
| static const char | helpReset [] = "Restarts the device" |
| static const char | helpSetBright [] = "Sets backlight brightness, absolute or relative (e.g. 50, +10 -10)" |
| static const char | helpSetCistern [] = "Sets the cistern metrics" |
| static const char | helpSetContr [] = "Sets LCD contrast, absolute or relative (e.g. 25, +5 -5)" |
| static const char | helpSetDisplay [] = "Sets the display type (4x20, 2x16 or analog)" |
| static const char | helpSetPTime [] = "Sets the delay for automatic display stepping (0 means no automatic stepping)" |
| static const char | helpSetPTimeK [] = "Sets the delay for switchback from manual to automatic stepping" |
| static const char | helpSetSignal [] = "Sets the thresholds for signaling outputs" |
| static const char | helpSetSounds [] = "Sets the Sounds-OK-Time and Soundmask. E.g. SetSounds 9 18 0" |
| static const char | helpSetSpontaneous [] = "Sets Volume difference for spontaneous reporting (0=Off)" |
| static const char | helpSetTime [] = "Sets the time. E.g. SetTime 18:35" |
| static const char | helpStatus [] = "Prints current status" |
| static const char | helpUpdate [] = "Updates sensor firmware" |
| static const char | helpUseRts [] = "Use RTS/CTS-handshake for serial communication" |
| static const char | helpVerify [] = "Verifies sensor firmware" |
| static const char | helpWrite [] = "Writes configuration to non-volatile memory.\n\n*** Execute Write after any changes in configuration\n or your changes will get lost at next reset! ***\n\n" |
| static uint8_t | nParams |
| static char * | params [MAXPARAMS] |
| static const char helpCalibrate [] | PROGMEM = "Calibrates the voltage sensors" |
Handles commands from the Host Interface.
Handles commands from the serial interface
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/.
| #define MAXPARAMS 5 |
|
static |
Set the analog instrument to a certain position.
This command is only useful for debugging if no other part of the software is setting the value!
References ExtraIgnored(), hprintf_P(), MissingArg(), nParams, params, and SetAnalogPerCent().

|
static |
Calibrates the Voltage Sensors.
Normal operation is halted during the calibration so the RTC will be late afterwards.
The user is prompted to enter the voltages from which the real Volts per LSB for each channel is calculated.
References ADCData_t::ADC_P3, ADCData_t::ADC_P5, ADCData_t::ADC_SWUnreg, ADCData_t::ADC_Unreg, ADCDataAvg, AssertRTS(), byteFromHost, CFLAG_BYTERECEIVED, cFlags, config, configDirty, delay10ms(), EnterDouble(), hprintf_P(), InitADC(), confStruct_t::instCal, LCDClear(), LCDSetBrightness(), ADCData_t::named, confStruct_t::P3VoltsPerLSB, confStruct_t::P5VoltsPerLSB, SensorPowerOff(), SensorPowerOn(), SetAnalogPerCent(), confStruct_t::SWUnregVoltsPerLSB, confStruct_t::UnregVoltsPerLSB, and usart1FlushRx().

|
static |
Clears Error Flags and Counters.
Resets watchdog and brownout reset counters and the error flags in the display.
References boCnt, ExtraIgnored(), hprintf_P(), nParams, ResetDisplayFlags(), and wdrCnt.

|
static |
Sets Debug Options.
Possible parameters are dcf and sensor. Adding a parameter switches debug output on, omitting it off. So debug without parameters completely disables debugging output.
References DFLAG_ADC, DFLAG_DCF77, DFLAG_SENSOR, dFlags, hprintf_P(), nParams, and params.

|
static |
Continuously prints the Sensor Distance Value.
This command terminates if you press any key on the console. Mostly used for debugging and sensor installation.
References AssertRTS(), CFLAG_BYTERECEIVED, CFLAG_TIMERECEIVED, cFlags, displayValues, distance, hprintf_P(), hrCnt, LitersFromDist(), displayValues_t::literUnitChar, minCnt, pulseTime, pulseTimeInt, pulseTimeMult, secCnt, SensorPowerOff(), SensorPowerOn(), and speedOfSound.

|
static |
Prints the Configuration Memory in a human readable form.
References DumpConfig(), ExtraIgnored(), hprintf_P(), and nParams.

|
static |
Performs a Factory Test.
References CmdReset(), FTest(), and hprintf_P().

|
static |
Retrieves the Sensor Values.
Measured volume and temperature inside the cistern.
References displayValues, ExtraIgnored(), hprintf_P(), displayValues_t::liters, displayValues_t::literUnitChar, nParams, and displayValues_t::tempSemi.

|
static |
Lists a Description of all Commands.
References cmd, commandTable, ExtraIgnored(), hprintf_P(), and nParams.

|
static |
Causes a Watchdog Reset. Useful for Debugging.
References hprintf_P().
Referenced by CmdFTest().


|
static |
Sets the Brightness of the LCD Backlight.
If the brightness is a pure number, it is treated as an absolute value, a preceding '+' or '-' increases or decreases the brightness for the specified value.
References config, configDirty, ExtraIgnored(), hprintf_P(), confStruct_t::LCDBright, LCDGetBrightness(), LCDSetBrightness(), MissingArg(), nParams, and params.

|
static |
Sets the Cistern Metrics.
References CIST_CONST_AREA, CIST_HORIZ_CYL, CIST_SPHERE, confStruct_t::cistAreaOrDiameter, confStruct_t::cistCapacity, confStruct_t::cisternType, confStruct_t::cistHeight, confStruct_t::cistLength, config, configDirty, ExtraIgnored(), hprintf_P(), MissingArg(), nParams, and params.

|
static |
Sets the Contrast of the LCD Backlight.
If the contrast is a pure number, it is treated as an absolute value, a preceding '+' or '-' increases or decreases the contrast for the specified value.
References config, configDirty, ExtraIgnored(), hprintf_P(), confStruct_t::LCDBright, LCDGetContrast(), LCDSetContrast(), MissingArg(), nParams, and params.

|
static |
Sets the DCF-Pin logic.
References config, configDirty, DCF77_PINMASK, hprintf_P(), confStruct_t::invDCF77, MissingArg(), nParams, and params.

|
static |
Sets the Display type.
References config, configDirty, DISPLAY_2x16, DISPLAY_4x20, DISPLAY_ANALOG, confStruct_t::displayType, ExtraIgnored(), hprintf_P(), LCDClear(), MissingArg(), nParams, and params.

|
static |
Sets the OCR1CL to an absolute Value.
This command is only useful for debugging if no other part of the software is setting the value!
References ExtraIgnored(), hprintf_P(), MissingArg(), nParams, and params.

|
static |
Sets the Delay for automatic Display stepping.
References config, configDirty, ExtraIgnored(), hprintf_P(), MissingArg(), nParams, confStruct_t::pageTime, and params.

|
static |
Sets the Delay for switchback from manual to automatic Display stepping.
References config, configDirty, ExtraIgnored(), hprintf_P(), MissingArg(), nParams, confStruct_t::pageTime, confStruct_t::pageTimeK, and params.

|
static |
Sets the Thresholds for a Signaling Output.
References signalOutput_t::activeAbove, signalOutput_t::activeBelow, config, configDirty, DumpConfigSignal(), ExtraIgnored(), hprintf_P(), MissingArg(), nParams, params, and confStruct_t::signalOutputs.

|
static |
Sets the Sounds-OK-Time and Soundmask.
References config, configDirty, ExtraIgnored(), hprintf_P(), MissingArg(), nParams, params, and confStruct_t::sndMask.

|
static |
Sets Spontaneous Volume Reporting.
References config, configDirty, ExtraIgnored(), hprintf_P(), MissingArg(), nParams, params, and confStruct_t::spontaneousReportVolume.

|
static |
Sets the Time.
References DCFInSync, ExtraIgnored(), hprintf_P(), hrCnt, min, minCnt, MissingArg(), nParams, params, and secCnt.

|
static |
Prints Values of System Sensors...
... and some other useful information.
References ADCData_t::ADC_P3, ADCData_t::ADC_P5, ADCData_t::ADC_SWUnreg, ADCData_t::ADC_Unreg, ADCData, ADCDataMax, ADCDataMin, boCnt, BTStatus, channelMismatchCnt, config, DCFInSync, displayValues, distance, displayValues_t::error, ExtraIgnored(), GetDCFdiff(), BTStatus_t::haveBT, hostCommandsLost, hprintf_P(), hrCnt, lastReportedVolume, displayValues_t::liters, displayValues_t::literUnitChar, BTStatus_t::localPort, minCnt, ADCData_t::named, nParams, P3FromADC(), P5FromADC(), BTStatus_t::remoteAddress, RTCAdj, RTCAdjTxt, secCnt, confStruct_t::sndHourFrom, confStruct_t::sndHourTo, confStruct_t::sndMask, SNDMASK_ALERT1ALWAYS, SNDMASK_ALERT2ALWAYS, SNDMASK_HOURBELL, confStruct_t::spontaneousReportVolume, SWUnregFromADC(), TempFromADC(), displayValues_t::tempSemi, BTStatus_t::unknTelCnt, UnregFromADC(), and wdrCnt.

|
static |
Updates the Sensor Firmware.
The User is asked to send the Intel HEX file which is then sent to the sensor.
References ExtraIgnored(), nParams, and UpdateSensorFirmware().

|
static |
Sets if to use RTS/CTS-Handshake.
References config, configDirty, hprintf_P(), MissingArg(), nParams, params, and confStruct_t::useRts.

|
static |
Verifies the Sensor Firmware against an Intel-HEX-File.
The User is asked to send the Intel HEX file which is then verified against the sensor firmware.
References ExtraIgnored(), nParams, and VerifySensorFirmware().

|
static |
Writes the Configuration to the EEPROM.
References configDirty, ExtraIgnored(), hprintf_P(), nParams, and WriteConfig().

|
static |
Receives a Double from the Host.
References ADCData_t::ADC_P3, ADCData_t::ADC_P5, ADCData_t::ADC_SWUnreg, ADCData_t::ADC_Unreg, ADCDataAvg, ADCFLAG_NEWAVERAGES, adcFlags, AssertRTS(), CFLAG_CMDRECEIVED, cFlags, cmdline, config, DISPLAY_4x20, confStruct_t::displayType, LCDGoTo(), ADCData_t::named, P3FromADC(), P5FromADC(), SWUnregFromADC(), and UnregFromADC().
Referenced by CmdCalibrate().


| uint8_t ExecCommand | ( | char * | str | ) |
Executes one command line.
| str | A pointer to the line |
References commandTable_t::adr, cmd, commandTable, configDirty, hprintf_P(), nParams, and params.
Referenced by DoCflags().


|
static |
Prints error message about superfluous parameters.
| n | The number of extra parameters |
References cmd, and hprintf_P().
Referenced by CmdAnalog(), CmdClearErrors(), CmdDumpConf(), CmdGetSensorValues(), CmdHelp(), CmdSetBright(), CmdSetCistern(), CmdSetContrast(), CmdSetDisplay(), CmdSetOcr(), CmdSetPTime(), CmdSetPTimeK(), CmdSetSignal(), CmdSetSounds(), CmdSetSpontaneous(), CmdSetTime(), CmdStat(), CmdUpdateSensorFirmware(), CmdVerifySensorFirmware(), and CmdWrite().


|
static |
Prints error message about missing arguments.
References cmd, and hprintf_P().
Referenced by CmdAnalog(), CmdSetBright(), CmdSetCistern(), CmdSetContrast(), CmdSetDCFInv(), CmdSetDisplay(), CmdSetOcr(), CmdSetPTime(), CmdSetPTimeK(), CmdSetSignal(), CmdSetSounds(), CmdSetSpontaneous(), CmdSetTime(), and CmdUseRts().


|
static |
Referenced by CmdHelp(), ExecCommand(), ExtraIgnored(), and MissingArg().
|
static |
Referenced by CmdHelp(), and ExecCommand().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Referenced by CmdAnalog(), CmdClearErrors(), CmdDebug(), CmdDumpConf(), CmdGetSensorValues(), CmdHelp(), CmdSetBright(), CmdSetCistern(), CmdSetContrast(), CmdSetDCFInv(), CmdSetDisplay(), CmdSetOcr(), CmdSetPTime(), CmdSetPTimeK(), CmdSetSignal(), CmdSetSounds(), CmdSetSpontaneous(), CmdSetTime(), CmdStat(), CmdUpdateSensorFirmware(), CmdUseRts(), CmdVerifySensorFirmware(), CmdWrite(), and ExecCommand().
|
static |
|
static |
1.8.15