-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server dictated client refresh times
- Loading branch information
1 parent
2119536
commit 2e4f30e
Showing
33 changed files
with
1,170 additions
and
936 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This is an example config.yaml to place at the root directory | ||
# of your SD card. The values in these parameters are just examples | ||
# so be sure to update them to suit your own setup. | ||
# | ||
# These parameters override what is set in config.h if SD card is enabled. | ||
server: | ||
# The URL on the server which the client will attempt to download the first image from. | ||
url: http://localhost:8080/download.png | ||
# The number of times to attempt downloading or drawing the server image. | ||
retries: 3 | ||
wifi: | ||
ssid: XXXX | ||
pass: XXXX | ||
# The number of times to attempt WiFi connection before timeout. | ||
retries: 6 | ||
ntp: | ||
# The time server host (keep as pool.ntp.org if in doubt). | ||
host: pool.ntp.org | ||
# The timezone you live in ("Olson" format). | ||
timezone: Europe/Dublin | ||
mqtt_logger: | ||
# Set to true to send publish logs to an MQTT broker. | ||
enabled: false | ||
# The MQTT broker to publish logs to. | ||
broker: localhost | ||
# The port of the MQTT broker. | ||
port: 1883 | ||
# The unique identifier for this project in your MQTT broker. | ||
clientId: inkplate10-weather-calendar | ||
# The name of the MQTT topic to publish to. | ||
topic: mqtt/inkplate10-weather-calendar | ||
# The number of times to attempt MQTT connection before timeout. | ||
retries: 3 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef __BATTERY_H__ | ||
#define __BATTERY_H__ | ||
// Define a battery capacity lookup table as an array of structs | ||
struct BatteryCapacity { | ||
double voltage; | ||
int percentage; | ||
}; | ||
|
||
/** | ||
Look up battery capacity percentage based on voltage. | ||
@param voltage the current voltage of the battery. | ||
@returns the capacity remaining as a percentage integer. | ||
*/ | ||
int getBatteryCapacity(double voltage); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef __DEFAULTS_H__ | ||
#define __DEFAULTS_H__ | ||
/** | ||
* Manually define config params. | ||
* | ||
* Only use this if you are not using the SD card (Inkplate10 V1). | ||
* Otherwise add USE_SDCARD flag to load from SD card config.yaml | ||
* | ||
* These parameters are overriden by the config.yaml if SD card is enabled. | ||
*/ | ||
|
||
// The URL on the server which the client will try to download the first | ||
// image from. | ||
extern char serverURL[]; | ||
// The number of times to attempt downloading or drawing the server image. | ||
extern int serverRetries; | ||
|
||
// Wifi config. | ||
extern char wifiSSID[]; | ||
extern char wifiPass[]; | ||
// The number of times to attempt WiFi connection before timeout. | ||
extern int wifiRetries; | ||
|
||
// NTP config. | ||
// The time server (keep as pool.ntp.org if in doubt). | ||
extern char ntpHost[]; | ||
// The timezone you live in ("Olson" format). | ||
extern char ntpTimezone[]; | ||
|
||
// Remote logging config. | ||
// Set to true to send publish logs to an MQTT broker. | ||
extern bool mqttLoggerEnabled; | ||
// The MQTT broker to publish logs to. | ||
extern char mqttLoggerBroker[]; | ||
// The port of the MQTT broker. | ||
extern int mqttLoggerPort; | ||
// The unique identifier for this project in your MQTT broker. | ||
extern char mqttLoggerClientID[]; | ||
// The name of the MQTT topic to publish to. | ||
extern char mqttLoggerTopic[]; | ||
// The number of times to attempt MQTT connection before timeout. | ||
extern int mqttLoggerRetries; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef __DISPLAY_H__ | ||
#define __DISPLAY_H__ | ||
#include "error_utils.h" | ||
|
||
// Guestimate file size for PNG image @ 1200x825 | ||
#define DEFAULT_BUFFER_SIZE E_INK_WIDTH* E_INK_HEIGHT * 4 + 100 | ||
|
||
/** | ||
Load an image to the display buffer. | ||
@param filePath the path of the file on disk. | ||
error. | ||
@returns the esp_err_t code: | ||
- ESP_OK if successful. | ||
- ESP_ERR_EFILER if writing file to filePath fails. | ||
*/ | ||
esp_err_t loadImage(const char* filePath); | ||
|
||
/** | ||
Load an image to the display buffer. | ||
@param buf load an image buffer to the display buffer. | ||
error. | ||
@returns the esp_err_t code: | ||
- ESP_OK if successful. | ||
*/ | ||
esp_err_t loadImage(uint8_t* buf); | ||
|
||
/** | ||
Load an image to the display buffer. | ||
@param buf the byte array data | ||
@returns the esp_err_t code: | ||
- ESP_OK if successful. | ||
- ESP_ERR_EDL if download file fails. | ||
- ESP_ERR_EFILEW if writing file to filePath fails. | ||
*/ | ||
esp_err_t loadImage(uint8_t* buf, int x, int y, int w, int h); | ||
|
||
/** | ||
Draw the battery status to the display. | ||
@param batteryRemainingPercent the percentage capacity remaining in the | ||
battery. error. | ||
@param invert flag to invert battery status due to black banner. | ||
*/ | ||
void displayBatteryStatus(int batteryRemainingPercent, bool invert); | ||
|
||
/** | ||
Draw an message to the display. The error message is drawn in the top-left | ||
corner of the display. Error message will overlay previously drawn image. | ||
@param msg the message to display. | ||
@param batteryRemainingPercent the percentage remaining battery capacity for | ||
battery status display. error. | ||
*/ | ||
void displayMessage(const char* msg, int batteryRemainingPercent); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef __ERROR_H__ | ||
#define __ERROR_H__ | ||
#include <esp_err.h> | ||
|
||
// Enum of errors that might be encountered. | ||
#define ESP_ERR_ERRNO_BASE (0) | ||
#define ESP_ERR_EDL (1 + ESP_ERR_ERRNO_BASE) // Download error | ||
#define ESP_ERR_EDRAW (2 + ESP_ERR_ERRNO_BASE) // Draw error | ||
#define ESP_ERR_EFILEW (3 + ESP_ERR_ERRNO_BASE) // File write error | ||
#define ESP_ERR_EFILER (4 + ESP_ERR_ERRNO_BASE) // File read error | ||
#define ESP_ERR_ENTP (5 + ESP_ERR_ERRNO_BASE) // NTP error | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef __FILE_H__ | ||
#define __FILE_H__ | ||
#include "error_utils.h" | ||
// The path on SD card where calendar images are downloaded to and read from. | ||
#define CALENDAR_RW_PATH "/calendar.png" | ||
// The file path on SD card to load config. | ||
#define CONFIG_FILE_PATH "/config.yaml" | ||
|
||
/** | ||
Write a data buffer a file at a given path. Store the file on disk at a given path. | ||
@param buf the data buffer. | ||
@param size the size of the file to write. | ||
@param filePath the path of the file on disk. | ||
@returns the esp_err_t code: | ||
- ESP_OK if successful. | ||
- ESP_ERR_EFILEW if number of retries is exceeded without success. | ||
*/ | ||
esp_err_t writeFile(uint8_t* buf, size_t size, const char* filePath); | ||
#endif |
2 changes: 2 additions & 0 deletions
2
src/Merienda_Regular12pt7b.h → include/font/Merienda_Regular12pt7b.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/Merienda_Regular16pt7b.h → include/font/Merienda_Regular16pt7b.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.