|
hhs utility
|
#include "Adafruit_MQTT.h"#include "Adafruit_MQTT_Client.h"#include <Ticker.h>#include <ESP8266WiFi.h>#include <WiFiClient.h>#include <ESP8266HTTPUpdateServer.h>#include <ESP8266mDNS.h>#include <ESP8266WebServer.h>

Go to the source code of this file.
Functions | |
| String | formatBytes (size_t bytes) |
| Utility function Original code found here: https://tttapa.github.io/ESP8266/Chap16%20-%20Data%20Logging.html Converts bytes to KB and MB. More... | |
| void | printFloat (float value, int places) |
| Utility function: Prints value with places of decimal places determine by precision. More... | |
| boolean | isNumeric (String str) |
| Utility function Checks if a string is numeric. Original code found here: http://tripsintech.com/arduino-isnumeric-function/. More... | |
| int | errorState (int state, int ledRed, int ledGreen) |
| Utility function Visual error indication via LED at pin D2 This is a dead end. You will need to fix the error and reset the device. Alocated states: State 1: No WiFi connection available State 2: Could not connect to MQTT broker // State 3: No temperature sensor found. // 200/600: Refrigerator, Temp measure State 4: Not possible to start SPIFFS. // 600/200: Refrigerator State 5: Could not transmit data to emoncms. // Refrigerator. More... | |
| void | keypressWait (void) |
| Utility function Halt the program and wait for "key press" at the serial port. For DEBUG purpose only. More... | |
| void ICACHE_RAM_ATTR | lwdtcb (void) |
| Utility function lwdTicker callback routine Code found here: https://www.sigmdel.ca/michel/program/esp8266/arduino/watchdogs2_en.html. More... | |
| void | lwdtFeedInit (void) |
| Utility function Initializes the loop watchdog interrupt routine. To be used in setup() at the end. More... | |
| void | lwdtFeed (void) |
| Utility function Resets the loop watchdog counter also known as "kicking the watchdog". More... | |
| int | getBootDevice (void) |
| Utility function See https://www.sigmdel.ca/michel/program/esp8266/arduino/watchdogs2_en.html for documentation More... | |
| int | startWiFi (IPAddress _ip, IPAddress _dns, IPAddress _gateway, IPAddress _subnet, char *_ssid, char *_password, char *_host) |
| Utility function Starts everything related to WiFi and Internet connections. More... | |
| void | showWiFiStatus (int i) |
| Utility function Display WiFi status in clear text. More... | |
| bool | doWifiConnect (char *_ssid, char *_password) |
| Utility function Tries to reconnect the WiFi connection Software found here: https://github.com/esp8266/Arduino/issues/4060. More... | |
| int | MQTT_connect (Adafruit_MQTT_Client *_mqtt) |
| Utility function Function to connect and reconnect as necessary to the MQTT server. More... | |
Definition in file hhsUtility.h.
| bool doWifiConnect | ( | char * | _ssid, |
| char * | _password | ||
| ) |
Utility function Tries to reconnect the WiFi connection Software found here: https://github.com/esp8266/Arduino/issues/4060.
| [in] | char | SSID WiFi SSID |
| [in] | char | password WiFi password |
Definition at line 346 of file hhsUtility.cpp.

| int errorState | ( | int | state, |
| int | ledRed, | ||
| int | ledGreen | ||
| ) |
Utility function Visual error indication via LED at pin D2 This is a dead end. You will need to fix the error and reset the device. Alocated states: State 1: No WiFi connection available State 2: Could not connect to MQTT broker // State 3: No temperature sensor found. // 200/600: Refrigerator, Temp measure State 4: Not possible to start SPIFFS. // 600/200: Refrigerator State 5: Could not transmit data to emoncms. // Refrigerator.
| [in] | int | state Error |
| [in] | int | ledRed |
| [in] | int | ledGreen |
Definition at line 122 of file hhsUtility.cpp.
| String formatBytes | ( | size_t | bytes | ) |
Utility function Original code found here: https://tttapa.github.io/ESP8266/Chap16%20-%20Data%20Logging.html Converts bytes to KB and MB.
| size_t | bytes: the bytes to convert. |
Definition at line 20 of file hhsUtility.cpp.
| int getBootDevice | ( | void | ) |
Utility function See https://www.sigmdel.ca/michel/program/esp8266/arduino/watchdogs2_en.html for documentation
| [in] | none |
Definition at line 256 of file hhsUtility.cpp.
| boolean isNumeric | ( | String | str | ) |
Utility function Checks if a string is numeric. Original code found here: http://tripsintech.com/arduino-isnumeric-function/.
| [in] | String | str string to verify. |
Definition at line 105 of file hhsUtility.cpp.
| void keypressWait | ( | void | ) |
Utility function Halt the program and wait for "key press" at the serial port. For DEBUG purpose only.
| [in] | none |
Definition at line 219 of file hhsUtility.cpp.
| void ICACHE_RAM_ATTR lwdtcb | ( | void | ) |
Utility function lwdTicker callback routine Code found here: https://www.sigmdel.ca/michel/program/esp8266/arduino/watchdogs2_en.html.
| [in] | none |
Definition at line 226 of file hhsUtility.cpp.

| void lwdtFeed | ( | void | ) |
Utility function Resets the loop watchdog counter also known as "kicking the watchdog".
| [in] | none |
Definition at line 250 of file hhsUtility.cpp.

| void lwdtFeedInit | ( | void | ) |
Utility function Initializes the loop watchdog interrupt routine. To be used in setup() at the end.
| [in] | none |
Definition at line 244 of file hhsUtility.cpp.

| int MQTT_connect | ( | Adafruit_MQTT_Client * | _mqtt | ) |
Utility function Function to connect and reconnect as necessary to the MQTT server.
| [in] | Adafruit_MQTT_Client | MQTT client to reconnect. |
Definition at line 373 of file hhsUtility.cpp.
| void printFloat | ( | float | value, |
| int | places | ||
| ) |
Utility function: Prints value with places of decimal places determine by precision.
| [in] | float | value decimal value to be printed |
| [in] | places | is a number indicating the desired decimal places Original code found here: https://playground.arduino.cc/Code/PrintFloats |
Definition at line 39 of file hhsUtility.cpp.
| void showWiFiStatus | ( | int | i | ) |
Utility function Display WiFi status in clear text.
| [in] | indicating the WiFi status to display in text. |
Definition at line 312 of file hhsUtility.cpp.

| int startWiFi | ( | IPAddress | _ip, |
| IPAddress | _dns, | ||
| IPAddress | _gateway, | ||
| IPAddress | _subnet, | ||
| char * | _ssid, | ||
| char * | _password, | ||
| char * | _host | ||
| ) |
Utility function Starts everything related to WiFi and Internet connections.
| [in] | IPAddress | _ip Static IP address of the device |
| [in] | IPAddress | _dns DNS IP address |
| [in] | IPAddress | _gateway Gateway IP address |
| [in] | IPAddress | _subnet Subnet. |
| [in] | char | *_ssid WiFi SSID |
| [in] | char | *_password WiFi password |
| [in] | char | *_host Unique host name of the device. |
Definition at line 269 of file hhsUtility.cpp.
