diff --git a/lib/PubSubClient/CHANGES.txt b/lib/PubSubClient/CHANGES.txt deleted file mode 100644 index ff4da62..0000000 --- a/lib/PubSubClient/CHANGES.txt +++ /dev/null @@ -1,76 +0,0 @@ -2.7 - * Fix remaining-length handling to prevent buffer overrun - * Add large-payload API - beginPublish/write/publish/endPublish - * Add yield call to improve reliability on ESP - * Add Clean Session flag to connect options - * Add ESP32 support for functional callback signature - * Various other fixes - -2.4 - * Add MQTT_SOCKET_TIMEOUT to prevent it blocking indefinitely - whilst waiting for inbound data - * Fixed return code when publishing >256 bytes - -2.3 - * Add publish(topic,payload,retained) function - -2.2 - * Change code layout to match Arduino Library reqs - -2.1 - * Add MAX_TRANSFER_SIZE def to chunk messages if needed - * Reject topic/payloads that exceed MQTT_MAX_PACKET_SIZE - -2.0 - * Add (and default to) MQTT 3.1.1 support - * Fix PROGMEM handling for Intel Galileo/ESP8266 - * Add overloaded constructors for convenience - * Add chainable setters for server/callback/client/stream - * Add state function to return connack return code - -1.9 - * Do not split MQTT packets over multiple calls to _client->write() - * API change: All constructors now require an instance of Client - to be passed in. - * Fixed example to match 1.8 api changes - dpslwk - * Added username/password support - WilHall - * Added publish_P - publishes messages from PROGMEM - jobytaffey - -1.8 - * KeepAlive interval is configurable in PubSubClient.h - * Maximum packet size is configurable in PubSubClient.h - * API change: Return boolean rather than int from various functions - * API change: Length parameter in message callback changed - from int to unsigned int - * Various internal tidy-ups around types -1.7 - * Improved keepalive handling - * Updated to the Arduino-1.0 API -1.6 - * Added the ability to publish a retained message - -1.5 - * Added default constructor - * Fixed compile error when used with arduino-0021 or later - -1.4 - * Fixed connection lost handling - -1.3 - * Fixed packet reading bug in PubSubClient.readPacket - -1.2 - * Fixed compile error when used with arduino-0016 or later - - -1.1 - * Reduced size of library - * Added support for Will messages - * Clarified licensing - see LICENSE.txt - - -1.0 - * Only Quality of Service (QOS) 0 messaging is supported - * The maximum message size, including header, is 128 bytes - * The keepalive interval is set to 30 seconds - * No support for Will messages diff --git a/lib/PubSubClient/LICENSE.txt b/lib/PubSubClient/LICENSE.txt deleted file mode 100644 index 217df35..0000000 --- a/lib/PubSubClient/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008-2015 Nicholas O'Leary - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/PubSubClient/README.md b/lib/PubSubClient/README.md deleted file mode 100644 index 69cbb8f..0000000 --- a/lib/PubSubClient/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Arduino Client for MQTT - -This library provides a client for doing simple publish/subscribe messaging with -a server that supports MQTT. - -## Examples - -The library comes with a number of example sketches. See File > Examples > PubSubClient -within the Arduino application. - -Full API documentation is available here: https://pubsubclient.knolleary.net - -## Limitations - - - It can only publish QoS 0 messages. It can subscribe at QoS 0 or QoS 1. - - The maximum message size, including header, is **128 bytes** by default. This - is configurable via `MQTT_MAX_PACKET_SIZE` in `PubSubClient.h`. - - The keepalive interval is set to 15 seconds by default. This is configurable - via `MQTT_KEEPALIVE` in `PubSubClient.h`. - - The client uses MQTT 3.1.1 by default. It can be changed to use MQTT 3.1 by - changing value of `MQTT_VERSION` in `PubSubClient.h`. - - -## Compatible Hardware - -The library uses the Arduino Ethernet Client api for interacting with the -underlying network hardware. This means it Just Works with a growing number of -boards and shields, including: - - - Arduino Ethernet - - Arduino Ethernet Shield - - Arduino YUN – use the included `YunClient` in place of `EthernetClient`, and - be sure to do a `Bridge.begin()` first - - Arduino WiFi Shield - if you want to send packets > 90 bytes with this shield, - enable the `MQTT_MAX_TRANSFER_SIZE` define in `PubSubClient.h`. - - Sparkfun WiFly Shield – [library](https://github.com/dpslwk/WiFly) - - TI CC3000 WiFi - [library](https://github.com/sparkfun/SFE_CC3000_Library) - - Intel Galileo/Edison - - ESP8266 - - ESP32 - -The library cannot currently be used with hardware based on the ENC28J60 chip – -such as the Nanode or the Nuelectronics Ethernet Shield. For those, there is an -[alternative library](https://github.com/njh/NanodeMQTT) available. - -## License - -This code is released under the MIT License. diff --git a/lib/PubSubClient/examples/mqtt_auth/mqtt_auth.ino b/lib/PubSubClient/examples/mqtt_auth/mqtt_auth.ino deleted file mode 100644 index e9f7b18..0000000 --- a/lib/PubSubClient/examples/mqtt_auth/mqtt_auth.ino +++ /dev/null @@ -1,43 +0,0 @@ -/* - Basic MQTT example with Authentication - - - connects to an MQTT server, providing username - and password - - publishes "hello world" to the topic "outTopic" - - subscribes to the topic "inTopic" -*/ - -#include -#include -#include - -// Update these with values suitable for your network. -byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; -IPAddress ip(172, 16, 0, 100); -IPAddress server(172, 16, 0, 2); - -void callback(char* topic, byte* payload, unsigned int length) { - // handle message arrived -} - -EthernetClient ethClient; -PubSubClient client(server, 1883, callback, ethClient); - -void setup() -{ - Ethernet.begin(mac, ip); - // Note - the default maximum packet size is 128 bytes. If the - // combined length of clientId, username and password exceed this, - // you will need to increase the value of MQTT_MAX_PACKET_SIZE in - // PubSubClient.h - - if (client.connect("arduinoClient", "testuser", "testpass")) { - client.publish("outTopic","hello world"); - client.subscribe("inTopic"); - } -} - -void loop() -{ - client.loop(); -} diff --git a/lib/PubSubClient/examples/mqtt_basic/mqtt_basic.ino b/lib/PubSubClient/examples/mqtt_basic/mqtt_basic.ino deleted file mode 100644 index f545ade..0000000 --- a/lib/PubSubClient/examples/mqtt_basic/mqtt_basic.ino +++ /dev/null @@ -1,77 +0,0 @@ -/* - Basic MQTT example - - This sketch demonstrates the basic capabilities of the library. - It connects to an MQTT server then: - - publishes "hello world" to the topic "outTopic" - - subscribes to the topic "inTopic", printing out any messages - it receives. NB - it assumes the received payloads are strings not binary - - It will reconnect to the server if the connection is lost using a blocking - reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to - achieve the same result without blocking the main loop. - -*/ - -#include -#include -#include - -// Update these with values suitable for your network. -byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; -IPAddress ip(172, 16, 0, 100); -IPAddress server(172, 16, 0, 2); - -void callback(char* topic, byte* payload, unsigned int length) { - Serial.print("Message arrived ["); - Serial.print(topic); - Serial.print("] "); - for (int i=0;i Preferences -> Additional Boards Manager URLs": - http://arduino.esp8266.com/stable/package_esp8266com_index.json - - Open the "Tools -> Board -> Board Manager" and click install for the ESP8266" - - Select your ESP8266 in "Tools -> Board" - -*/ - -#include -#include - -// Update these with values suitable for your network. - -const char* ssid = "........"; -const char* password = "........"; -const char* mqtt_server = "broker.mqtt-dashboard.com"; - -WiFiClient espClient; -PubSubClient client(espClient); -long lastMsg = 0; -char msg[50]; -int value = 0; - -void setup_wifi() { - - delay(10); - // We start by connecting to a WiFi network - Serial.println(); - Serial.print("Connecting to "); - Serial.println(ssid); - - WiFi.begin(ssid, password); - - while (WiFi.status() != WL_CONNECTED) { - delay(500); - Serial.print("."); - } - - randomSeed(micros()); - - Serial.println(""); - Serial.println("WiFi connected"); - Serial.println("IP address: "); - Serial.println(WiFi.localIP()); -} - -void callback(char* topic, byte* payload, unsigned int length) { - Serial.print("Message arrived ["); - Serial.print(topic); - Serial.print("] "); - for (int i = 0; i < length; i++) { - Serial.print((char)payload[i]); - } - Serial.println(); - - // Switch on the LED if an 1 was received as first character - if ((char)payload[0] == '1') { - digitalWrite(BUILTIN_LED, LOW); // Turn the LED on (Note that LOW is the voltage level - // but actually the LED is on; this is because - // it is active low on the ESP-01) - } else { - digitalWrite(BUILTIN_LED, HIGH); // Turn the LED off by making the voltage HIGH - } - -} - -void reconnect() { - // Loop until we're reconnected - while (!client.connected()) { - Serial.print("Attempting MQTT connection..."); - // Create a random client ID - String clientId = "ESP8266Client-"; - clientId += String(random(0xffff), HEX); - // Attempt to connect - if (client.connect(clientId.c_str())) { - Serial.println("connected"); - // Once connected, publish an announcement... - client.publish("outTopic", "hello world"); - // ... and resubscribe - client.subscribe("inTopic"); - } else { - Serial.print("failed, rc="); - Serial.print(client.state()); - Serial.println(" try again in 5 seconds"); - // Wait 5 seconds before retrying - delay(5000); - } - } -} - -void setup() { - pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output - Serial.begin(115200); - setup_wifi(); - client.setServer(mqtt_server, 1883); - client.setCallback(callback); -} - -void loop() { - - if (!client.connected()) { - reconnect(); - } - client.loop(); - - long now = millis(); - if (now - lastMsg > 2000) { - lastMsg = now; - ++value; - snprintf (msg, 50, "hello world #%ld", value); - Serial.print("Publish message: "); - Serial.println(msg); - client.publish("outTopic", msg); - } -} diff --git a/lib/PubSubClient/examples/mqtt_large_message/mqtt_large_message.ino b/lib/PubSubClient/examples/mqtt_large_message/mqtt_large_message.ino deleted file mode 100644 index e048c3e..0000000 --- a/lib/PubSubClient/examples/mqtt_large_message/mqtt_large_message.ino +++ /dev/null @@ -1,179 +0,0 @@ -/* - Long message ESP8266 MQTT example - - This sketch demonstrates sending arbitrarily large messages in combination - with the ESP8266 board/library. - - It connects to an MQTT server then: - - publishes "hello world" to the topic "outTopic" - - subscribes to the topic "greenBottles/#", printing out any messages - it receives. NB - it assumes the received payloads are strings not binary - - If the sub-topic is a number, it publishes a "greenBottles/lyrics" message - with a payload consisting of the lyrics to "10 green bottles", replacing - 10 with the number given in the sub-topic. - - It will reconnect to the server if the connection is lost using a blocking - reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to - achieve the same result without blocking the main loop. - - To install the ESP8266 board, (using Arduino 1.6.4+): - - Add the following 3rd party board manager under "File -> Preferences -> Additional Boards Manager URLs": - http://arduino.esp8266.com/stable/package_esp8266com_index.json - - Open the "Tools -> Board -> Board Manager" and click install for the ESP8266" - - Select your ESP8266 in "Tools -> Board" - -*/ - -#include -#include - -// Update these with values suitable for your network. - -const char* ssid = "........"; -const char* password = "........"; -const char* mqtt_server = "broker.mqtt-dashboard.com"; - -WiFiClient espClient; -PubSubClient client(espClient); -long lastMsg = 0; -char msg[50]; -int value = 0; - -void setup_wifi() { - - delay(10); - // We start by connecting to a WiFi network - Serial.println(); - Serial.print("Connecting to "); - Serial.println(ssid); - - WiFi.begin(ssid, password); - - while (WiFi.status() != WL_CONNECTED) { - delay(500); - Serial.print("."); - } - - randomSeed(micros()); - - Serial.println(""); - Serial.println("WiFi connected"); - Serial.println("IP address: "); - Serial.println(WiFi.localIP()); -} - -void callback(char* topic, byte* payload, unsigned int length) { - Serial.print("Message arrived ["); - Serial.print(topic); - Serial.print("] "); - for (int i = 0; i < length; i++) { - Serial.print((char)payload[i]); - } - Serial.println(); - - // Find out how many bottles we should generate lyrics for - String topicStr(topic); - int bottleCount = 0; // assume no bottles unless we correctly parse a value from the topic - if (topicStr.indexOf('/') >= 0) { - // The topic includes a '/', we'll try to read the number of bottles from just after that - topicStr.remove(0, topicStr.indexOf('/')+1); - // Now see if there's a number of bottles after the '/' - bottleCount = topicStr.toInt(); - } - - if (bottleCount > 0) { - // Work out how big our resulting message will be - int msgLen = 0; - for (int i = bottleCount; i > 0; i--) { - String numBottles(i); - msgLen += 2*numBottles.length(); - if (i == 1) { - msgLen += 2*String(" green bottle, standing on the wall\n").length(); - } else { - msgLen += 2*String(" green bottles, standing on the wall\n").length(); - } - msgLen += String("And if one green bottle should accidentally fall\nThere'll be ").length(); - switch (i) { - case 1: - msgLen += String("no green bottles, standing on the wall\n\n").length(); - break; - case 2: - msgLen += String("1 green bottle, standing on the wall\n\n").length(); - break; - default: - numBottles = i-1; - msgLen += numBottles.length(); - msgLen += String(" green bottles, standing on the wall\n\n").length(); - break; - }; - } - - // Now we can start to publish the message - client.beginPublish("greenBottles/lyrics", msgLen, false); - for (int i = bottleCount; i > 0; i--) { - for (int j = 0; j < 2; j++) { - client.print(i); - if (i == 1) { - client.print(" green bottle, standing on the wall\n"); - } else { - client.print(" green bottles, standing on the wall\n"); - } - } - client.print("And if one green bottle should accidentally fall\nThere'll be "); - switch (i) { - case 1: - client.print("no green bottles, standing on the wall\n\n"); - break; - case 2: - client.print("1 green bottle, standing on the wall\n\n"); - break; - default: - client.print(i-1); - client.print(" green bottles, standing on the wall\n\n"); - break; - }; - } - // Now we're done! - client.endPublish(); - } -} - -void reconnect() { - // Loop until we're reconnected - while (!client.connected()) { - Serial.print("Attempting MQTT connection..."); - // Create a random client ID - String clientId = "ESP8266Client-"; - clientId += String(random(0xffff), HEX); - // Attempt to connect - if (client.connect(clientId.c_str())) { - Serial.println("connected"); - // Once connected, publish an announcement... - client.publish("outTopic", "hello world"); - // ... and resubscribe - client.subscribe("greenBottles/#"); - } else { - Serial.print("failed, rc="); - Serial.print(client.state()); - Serial.println(" try again in 5 seconds"); - // Wait 5 seconds before retrying - delay(5000); - } - } -} - -void setup() { - pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output - Serial.begin(115200); - setup_wifi(); - client.setServer(mqtt_server, 1883); - client.setCallback(callback); -} - -void loop() { - - if (!client.connected()) { - reconnect(); - } - client.loop(); -} diff --git a/lib/PubSubClient/examples/mqtt_publish_in_callback/mqtt_publish_in_callback.ino b/lib/PubSubClient/examples/mqtt_publish_in_callback/mqtt_publish_in_callback.ino deleted file mode 100644 index 42afb2a..0000000 --- a/lib/PubSubClient/examples/mqtt_publish_in_callback/mqtt_publish_in_callback.ino +++ /dev/null @@ -1,60 +0,0 @@ -/* - Publishing in the callback - - - connects to an MQTT server - - subscribes to the topic "inTopic" - - when a message is received, republishes it to "outTopic" - - This example shows how to publish messages within the - callback function. The callback function header needs to - be declared before the PubSubClient constructor and the - actual callback defined afterwards. - This ensures the client reference in the callback function - is valid. - -*/ - -#include -#include -#include - -// Update these with values suitable for your network. -byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; -IPAddress ip(172, 16, 0, 100); -IPAddress server(172, 16, 0, 2); - -// Callback function header -void callback(char* topic, byte* payload, unsigned int length); - -EthernetClient ethClient; -PubSubClient client(server, 1883, callback, ethClient); - -// Callback function -void callback(char* topic, byte* payload, unsigned int length) { - // In order to republish this payload, a copy must be made - // as the orignal payload buffer will be overwritten whilst - // constructing the PUBLISH packet. - - // Allocate the correct amount of memory for the payload copy - byte* p = (byte*)malloc(length); - // Copy the payload to the new buffer - memcpy(p,payload,length); - client.publish("outTopic", p, length); - // Free the memory - free(p); -} - -void setup() -{ - - Ethernet.begin(mac, ip); - if (client.connect("arduinoClient")) { - client.publish("outTopic","hello world"); - client.subscribe("inTopic"); - } -} - -void loop() -{ - client.loop(); -} diff --git a/lib/PubSubClient/examples/mqtt_reconnect_nonblocking/mqtt_reconnect_nonblocking.ino b/lib/PubSubClient/examples/mqtt_reconnect_nonblocking/mqtt_reconnect_nonblocking.ino deleted file mode 100644 index 080b739..0000000 --- a/lib/PubSubClient/examples/mqtt_reconnect_nonblocking/mqtt_reconnect_nonblocking.ino +++ /dev/null @@ -1,67 +0,0 @@ -/* - Reconnecting MQTT example - non-blocking - - This sketch demonstrates how to keep the client connected - using a non-blocking reconnect function. If the client loses - its connection, it attempts to reconnect every 5 seconds - without blocking the main loop. - -*/ - -#include -#include -#include - -// Update these with values suitable for your hardware/network. -byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; -IPAddress ip(172, 16, 0, 100); -IPAddress server(172, 16, 0, 2); - -void callback(char* topic, byte* payload, unsigned int length) { - // handle message arrived -} - -EthernetClient ethClient; -PubSubClient client(ethClient); - -long lastReconnectAttempt = 0; - -boolean reconnect() { - if (client.connect("arduinoClient")) { - // Once connected, publish an announcement... - client.publish("outTopic","hello world"); - // ... and resubscribe - client.subscribe("inTopic"); - } - return client.connected(); -} - -void setup() -{ - client.setServer(server, 1883); - client.setCallback(callback); - - Ethernet.begin(mac, ip); - delay(1500); - lastReconnectAttempt = 0; -} - - -void loop() -{ - if (!client.connected()) { - long now = millis(); - if (now - lastReconnectAttempt > 5000) { - lastReconnectAttempt = now; - // Attempt to reconnect - if (reconnect()) { - lastReconnectAttempt = 0; - } - } - } else { - // Client connected - - client.loop(); - } - -} diff --git a/lib/PubSubClient/examples/mqtt_stream/mqtt_stream.ino b/lib/PubSubClient/examples/mqtt_stream/mqtt_stream.ino deleted file mode 100644 index 67c2287..0000000 --- a/lib/PubSubClient/examples/mqtt_stream/mqtt_stream.ino +++ /dev/null @@ -1,57 +0,0 @@ -/* - Example of using a Stream object to store the message payload - - Uses SRAM library: https://github.com/ennui2342/arduino-sram - but could use any Stream based class such as SD - - - connects to an MQTT server - - publishes "hello world" to the topic "outTopic" - - subscribes to the topic "inTopic" -*/ - -#include -#include -#include -#include - -// Update these with values suitable for your network. -byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; -IPAddress ip(172, 16, 0, 100); -IPAddress server(172, 16, 0, 2); - -SRAM sram(4, SRAM_1024); - -void callback(char* topic, byte* payload, unsigned int length) { - sram.seek(1); - - // do something with the message - for(uint8_t i=0; i -maintainer=Nick O'Leary -sentence=A client library for MQTT messaging. -paragraph=MQTT is a lightweight messaging protocol ideal for small devices. This library allows you to send and receive MQTT messages. It supports the latest MQTT 3.1.1 protocol and can be configured to use the older MQTT 3.1 if needed. It supports all Arduino Ethernet Client compatible hardware, including the Intel Galileo/Edison, ESP8266 and TI CC3000. -category=Communication -url=http://pubsubclient.knolleary.net -architectures=* diff --git a/lib/PubSubClient/src/PubSubClient.cpp b/lib/PubSubClient/src/PubSubClient.cpp deleted file mode 100644 index 592b024..0000000 --- a/lib/PubSubClient/src/PubSubClient.cpp +++ /dev/null @@ -1,653 +0,0 @@ -/* - PubSubClient.cpp - A simple client for MQTT. - Nick O'Leary - http://knolleary.net -*/ - -#include "PubSubClient.h" -#include - -PubSubClient::PubSubClient() { - this->_state = MQTT_DISCONNECTED; - this->_client = NULL; - this->stream = NULL; - setCallback(NULL); -} - -PubSubClient::PubSubClient(Client& client) { - this->_state = MQTT_DISCONNECTED; - setClient(client); - this->stream = NULL; -} - -PubSubClient::PubSubClient(IPAddress addr, uint16_t port, Client& client) { - this->_state = MQTT_DISCONNECTED; - setServer(addr, port); - setClient(client); - this->stream = NULL; -} -PubSubClient::PubSubClient(IPAddress addr, uint16_t port, Client& client, Stream& stream) { - this->_state = MQTT_DISCONNECTED; - setServer(addr,port); - setClient(client); - setStream(stream); -} -PubSubClient::PubSubClient(IPAddress addr, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client) { - this->_state = MQTT_DISCONNECTED; - setServer(addr, port); - setCallback(callback); - setClient(client); - this->stream = NULL; -} -PubSubClient::PubSubClient(IPAddress addr, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client, Stream& stream) { - this->_state = MQTT_DISCONNECTED; - setServer(addr,port); - setCallback(callback); - setClient(client); - setStream(stream); -} - -PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, Client& client) { - this->_state = MQTT_DISCONNECTED; - setServer(ip, port); - setClient(client); - this->stream = NULL; -} -PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, Client& client, Stream& stream) { - this->_state = MQTT_DISCONNECTED; - setServer(ip,port); - setClient(client); - setStream(stream); -} -PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client) { - this->_state = MQTT_DISCONNECTED; - setServer(ip, port); - setCallback(callback); - setClient(client); - this->stream = NULL; -} -PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client, Stream& stream) { - this->_state = MQTT_DISCONNECTED; - setServer(ip,port); - setCallback(callback); - setClient(client); - setStream(stream); -} - -PubSubClient::PubSubClient(const char* domain, uint16_t port, Client& client) { - this->_state = MQTT_DISCONNECTED; - setServer(domain,port); - setClient(client); - this->stream = NULL; -} -PubSubClient::PubSubClient(const char* domain, uint16_t port, Client& client, Stream& stream) { - this->_state = MQTT_DISCONNECTED; - setServer(domain,port); - setClient(client); - setStream(stream); -} -PubSubClient::PubSubClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client) { - this->_state = MQTT_DISCONNECTED; - setServer(domain,port); - setCallback(callback); - setClient(client); - this->stream = NULL; -} -PubSubClient::PubSubClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client, Stream& stream) { - this->_state = MQTT_DISCONNECTED; - setServer(domain,port); - setCallback(callback); - setClient(client); - setStream(stream); -} - -boolean PubSubClient::connect(const char *id) { - return connect(id,NULL,NULL,0,0,0,0,1); -} - -boolean PubSubClient::connect(const char *id, const char *user, const char *pass) { - return connect(id,user,pass,0,0,0,0,1); -} - -boolean PubSubClient::connect(const char *id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) { - return connect(id,NULL,NULL,willTopic,willQos,willRetain,willMessage,1); -} - -boolean PubSubClient::connect(const char *id, const char *user, const char *pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) { - return connect(id,user,pass,willTopic,willQos,willRetain,willMessage,1); -} - -boolean PubSubClient::connect(const char *id, const char *user, const char *pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage, boolean cleanSession) { - if (!connected()) { - int result = 0; - - if (domain != NULL) { - result = _client->connect(this->domain, this->port); - } else { - result = _client->connect(this->ip, this->port); - } - if (result == 1) { - nextMsgId = 1; - // Leave room in the buffer for header and variable length field - uint16_t length = MQTT_MAX_HEADER_SIZE; - unsigned int j; - -#if MQTT_VERSION == MQTT_VERSION_3_1 - uint8_t d[9] = {0x00,0x06,'M','Q','I','s','d','p', MQTT_VERSION}; -#define MQTT_HEADER_VERSION_LENGTH 9 -#elif MQTT_VERSION == MQTT_VERSION_3_1_1 - uint8_t d[7] = {0x00,0x04,'M','Q','T','T',MQTT_VERSION}; -#define MQTT_HEADER_VERSION_LENGTH 7 -#endif - for (j = 0;j>1); - } - } - - buffer[length++] = v; - - buffer[length++] = ((MQTT_KEEPALIVE) >> 8); - buffer[length++] = ((MQTT_KEEPALIVE) & 0xFF); - - CHECK_STRING_LENGTH(length,id) - length = writeString(id,buffer,length); - if (willTopic) { - CHECK_STRING_LENGTH(length,willTopic) - length = writeString(willTopic,buffer,length); - CHECK_STRING_LENGTH(length,willMessage) - length = writeString(willMessage,buffer,length); - } - - if(user != NULL) { - CHECK_STRING_LENGTH(length,user) - length = writeString(user,buffer,length); - if(pass != NULL) { - CHECK_STRING_LENGTH(length,pass) - length = writeString(pass,buffer,length); - } - } - - write(MQTTCONNECT,buffer,length-MQTT_MAX_HEADER_SIZE); - - lastInActivity = lastOutActivity = millis(); - - while (!_client->available()) { - unsigned long t = millis(); - if (t-lastInActivity >= ((int32_t) MQTT_SOCKET_TIMEOUT*1000UL)) { - _state = MQTT_CONNECTION_TIMEOUT; - _client->stop(); - return false; - } - } - uint8_t llen; - uint16_t len = readPacket(&llen); - - if (len == 4) { - if (buffer[3] == 0) { - lastInActivity = millis(); - pingOutstanding = false; - _state = MQTT_CONNECTED; - return true; - } else { - _state = buffer[3]; - } - } - _client->stop(); - } else { - _state = MQTT_CONNECT_FAILED; - } - return false; - } - return true; -} - -// reads a byte into result -boolean PubSubClient::readByte(uint8_t * result) { - uint32_t previousMillis = millis(); - while(!_client->available()) { - yield(); - uint32_t currentMillis = millis(); - if(currentMillis - previousMillis >= ((int32_t) MQTT_SOCKET_TIMEOUT * 1000)){ - return false; - } - } - *result = _client->read(); - return true; -} - -// reads a byte into result[*index] and increments index -boolean PubSubClient::readByte(uint8_t * result, uint16_t * index){ - uint16_t current_index = *index; - uint8_t * write_address = &(result[current_index]); - if(readByte(write_address)){ - *index = current_index + 1; - return true; - } - return false; -} - -uint16_t PubSubClient::readPacket(uint8_t* lengthLength) { - uint16_t len = 0; - if(!readByte(buffer, &len)) return 0; - bool isPublish = (buffer[0]&0xF0) == MQTTPUBLISH; - uint32_t multiplier = 1; - uint16_t length = 0; - uint8_t digit = 0; - uint16_t skip = 0; - uint8_t start = 0; - - do { - if (len == 5) { - // Invalid remaining length encoding - kill the connection - _state = MQTT_DISCONNECTED; - _client->stop(); - return 0; - } - if(!readByte(&digit)) return 0; - buffer[len++] = digit; - length += (digit & 127) * multiplier; - multiplier *= 128; - } while ((digit & 128) != 0); - *lengthLength = len-1; - - if (isPublish) { - // Read in topic length to calculate bytes to skip over for Stream writing - if(!readByte(buffer, &len)) return 0; - if(!readByte(buffer, &len)) return 0; - skip = (buffer[*lengthLength+1]<<8)+buffer[*lengthLength+2]; - start = 2; - if (buffer[0]&MQTTQOS1) { - // skip message id - skip += 2; - } - } - - for (uint16_t i = start;istream) { - if (isPublish && len-*lengthLength-2>skip) { - this->stream->write(digit); - } - } - if (len < MQTT_MAX_PACKET_SIZE) { - buffer[len] = digit; - } - len++; - } - - if (!this->stream && len > MQTT_MAX_PACKET_SIZE) { - len = 0; // This will cause the packet to be ignored. - } - - return len; -} - -boolean PubSubClient::loop() { - if (connected()) { - unsigned long t = millis(); - if ((t - lastInActivity > MQTT_KEEPALIVE*1000UL) || (t - lastOutActivity > MQTT_KEEPALIVE*1000UL)) { - if (pingOutstanding) { - this->_state = MQTT_CONNECTION_TIMEOUT; - _client->stop(); - return false; - } else { - buffer[0] = MQTTPINGREQ; - buffer[1] = 0; - _client->write(buffer,2); - lastOutActivity = t; - lastInActivity = t; - pingOutstanding = true; - } - } - if (_client->available()) { - uint8_t llen; - uint16_t len = readPacket(&llen); - uint16_t msgId = 0; - uint8_t *payload; - if (len > 0) { - lastInActivity = t; - uint8_t type = buffer[0]&0xF0; - if (type == MQTTPUBLISH) { - if (callback) { - uint16_t tl = (buffer[llen+1]<<8)+buffer[llen+2]; /* topic length in bytes */ - memmove(buffer+llen+2,buffer+llen+3,tl); /* move topic inside buffer 1 byte to front */ - buffer[llen+2+tl] = 0; /* end the topic as a 'C' string with \x00 */ - char *topic = (char*) buffer+llen+2; - // msgId only present for QOS>0 - if ((buffer[0]&0x06) == MQTTQOS1) { - msgId = (buffer[llen+3+tl]<<8)+buffer[llen+3+tl+1]; - payload = buffer+llen+3+tl+2; - callback(topic,payload,len-llen-3-tl-2); - - buffer[0] = MQTTPUBACK; - buffer[1] = 2; - buffer[2] = (msgId >> 8); - buffer[3] = (msgId & 0xFF); - _client->write(buffer,4); - lastOutActivity = t; - - } else { - payload = buffer+llen+3+tl; - callback(topic,payload,len-llen-3-tl); - } - } - } else if (type == MQTTPINGREQ) { - buffer[0] = MQTTPINGRESP; - buffer[1] = 0; - _client->write(buffer,2); - } else if (type == MQTTPINGRESP) { - pingOutstanding = false; - } - } else if (!connected()) { - // readPacket has closed the connection - return false; - } - } - return true; - } - return false; -} - -boolean PubSubClient::publish(const char* topic, const char* payload) { - return publish(topic,(const uint8_t*)payload,strlen(payload),false); -} - -boolean PubSubClient::publish(const char* topic, const char* payload, boolean retained) { - return publish(topic,(const uint8_t*)payload,strlen(payload),retained); -} - -boolean PubSubClient::publish(const char* topic, const uint8_t* payload, unsigned int plength) { - return publish(topic, payload, plength, false); -} - -boolean PubSubClient::publish(const char* topic, const uint8_t* payload, unsigned int plength, boolean retained) { - if (connected()) { - if (MQTT_MAX_PACKET_SIZE < MQTT_MAX_HEADER_SIZE + 2+strlen(topic) + plength) { - // Too long - return false; - } - // Leave room in the buffer for header and variable length field - uint16_t length = MQTT_MAX_HEADER_SIZE; - length = writeString(topic,buffer,length); - uint16_t i; - for (i=0;i 0) { - digit |= 0x80; - } - buffer[pos++] = digit; - llen++; - } while(len>0); - - pos = writeString(topic,buffer,pos); - - rc += _client->write(buffer,pos); - - for (i=0;iwrite((char)pgm_read_byte_near(payload + i)); - } - - lastOutActivity = millis(); - - return rc == tlen + 4 + plength; -} - -boolean PubSubClient::beginPublish(const char* topic, unsigned int plength, boolean retained) { - if (connected()) { - // Send the header and variable length field - uint16_t length = MQTT_MAX_HEADER_SIZE; - length = writeString(topic,buffer,length); -// uint16_t i; - uint8_t header = MQTTPUBLISH; - if (retained) { - header |= 1; - } - size_t hlen = buildHeader(header, buffer, plength+length-MQTT_MAX_HEADER_SIZE); - uint16_t rc = _client->write(buffer+(MQTT_MAX_HEADER_SIZE-hlen),length-(MQTT_MAX_HEADER_SIZE-hlen)); - lastOutActivity = millis(); - return (rc == (length-(MQTT_MAX_HEADER_SIZE-hlen))); - } - return false; -} - -int PubSubClient::endPublish() { - return 1; -} - -size_t PubSubClient::write(uint8_t data) { - lastOutActivity = millis(); - return _client->write(data); -} - -size_t PubSubClient::write(const uint8_t *buffer, size_t size) { - lastOutActivity = millis(); - return _client->write(buffer,size); -} - -size_t PubSubClient::buildHeader(uint8_t header, uint8_t* buf, uint16_t length) { - uint8_t lenBuf[4]; - uint8_t llen = 0; - uint8_t digit; - uint8_t pos = 0; - uint16_t len = length; - do { - digit = len % 128; - len = len / 128; - if (len > 0) { - digit |= 0x80; - } - lenBuf[pos++] = digit; - llen++; - } while(len>0); - - buf[4-llen] = header; - for (int i=0;i 0) && result) { - bytesToWrite = (bytesRemaining > MQTT_MAX_TRANSFER_SIZE)?MQTT_MAX_TRANSFER_SIZE:bytesRemaining; - rc = _client->write(writeBuf,bytesToWrite); - result = (rc == bytesToWrite); - bytesRemaining -= rc; - writeBuf += rc; - } - return result; -#else - rc = _client->write(buf+(MQTT_MAX_HEADER_SIZE-hlen),length+hlen); - lastOutActivity = millis(); - return (rc == hlen+length); -#endif -} - -boolean PubSubClient::subscribe(const char* topic) { - return subscribe(topic, 0); -} - -boolean PubSubClient::subscribe(const char* topic, uint8_t qos) { - if (qos > 1) { - return false; - } - if (MQTT_MAX_PACKET_SIZE < 9 + strlen(topic)) { - // Too long - return false; - } - if (connected()) { - // Leave room in the buffer for header and variable length field - uint16_t length = MQTT_MAX_HEADER_SIZE; - nextMsgId++; - if (nextMsgId == 0) { - nextMsgId = 1; - } - buffer[length++] = (nextMsgId >> 8); - buffer[length++] = (nextMsgId & 0xFF); - length = writeString((char*)topic, buffer,length); - buffer[length++] = qos; - return write(MQTTSUBSCRIBE|MQTTQOS1,buffer,length-MQTT_MAX_HEADER_SIZE); - } - return false; -} - -boolean PubSubClient::unsubscribe(const char* topic) { - if (MQTT_MAX_PACKET_SIZE < 9 + strlen(topic)) { - // Too long - return false; - } - if (connected()) { - uint16_t length = MQTT_MAX_HEADER_SIZE; - nextMsgId++; - if (nextMsgId == 0) { - nextMsgId = 1; - } - buffer[length++] = (nextMsgId >> 8); - buffer[length++] = (nextMsgId & 0xFF); - length = writeString(topic, buffer,length); - return write(MQTTUNSUBSCRIBE|MQTTQOS1,buffer,length-MQTT_MAX_HEADER_SIZE); - } - return false; -} - -void PubSubClient::disconnect() { - buffer[0] = MQTTDISCONNECT; - buffer[1] = 0; - _client->write(buffer,2); - _state = MQTT_DISCONNECTED; - _client->flush(); - _client->stop(); - lastInActivity = lastOutActivity = millis(); -} - -uint16_t PubSubClient::writeString(const char* string, uint8_t* buf, uint16_t pos) { - const char* idp = string; - uint16_t i = 0; - pos += 2; - while (*idp) { - buf[pos++] = *idp++; - i++; - } - buf[pos-i-2] = (i >> 8); - buf[pos-i-1] = (i & 0xFF); - return pos; -} - - -boolean PubSubClient::connected() { - boolean rc; - if (_client == NULL ) { - rc = false; - } else { - rc = (int)_client->connected(); - if (!rc) { - if (this->_state == MQTT_CONNECTED) { - this->_state = MQTT_CONNECTION_LOST; - _client->flush(); - _client->stop(); - } - } - } - return rc; -} - -PubSubClient& PubSubClient::setServer(uint8_t * ip, uint16_t port) { - IPAddress addr(ip[0],ip[1],ip[2],ip[3]); - return setServer(addr,port); -} - -PubSubClient& PubSubClient::setServer(IPAddress ip, uint16_t port) { - this->ip = ip; - this->port = port; - this->domain = NULL; - return *this; -} - -PubSubClient& PubSubClient::setServer(const char * domain, uint16_t port) { - this->domain = domain; - this->port = port; - return *this; -} - -PubSubClient& PubSubClient::setCallback(MQTT_CALLBACK_SIGNATURE) { - this->callback = callback; - return *this; -} - -PubSubClient& PubSubClient::setClient(Client& client){ - this->_client = &client; - return *this; -} - -PubSubClient& PubSubClient::setStream(Stream& stream){ - this->stream = &stream; - return *this; -} - -int PubSubClient::state() { - return this->_state; -} diff --git a/lib/PubSubClient/src/PubSubClient.h b/lib/PubSubClient/src/PubSubClient.h deleted file mode 100644 index 2fd6f1d..0000000 --- a/lib/PubSubClient/src/PubSubClient.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - PubSubClient.h - A simple client for MQTT. - Nick O'Leary - http://knolleary.net -*/ - -#ifndef PubSubClient_h -#define PubSubClient_h - -#include -#include "IPAddress.h" -#include "Client.h" -#include "Stream.h" - -#define MQTT_VERSION_3_1 3 -#define MQTT_VERSION_3_1_1 4 - -// MQTT_VERSION : Pick the version -//#define MQTT_VERSION MQTT_VERSION_3_1 -#ifndef MQTT_VERSION -#define MQTT_VERSION MQTT_VERSION_3_1_1 -#endif - -// MQTT_MAX_PACKET_SIZE : Maximum packet size -#ifndef MQTT_MAX_PACKET_SIZE -#define MQTT_MAX_PACKET_SIZE 128 -#endif - -// MQTT_KEEPALIVE : keepAlive interval in Seconds -#ifndef MQTT_KEEPALIVE -#define MQTT_KEEPALIVE 15 -#endif - -// MQTT_SOCKET_TIMEOUT: socket timeout interval in Seconds -#ifndef MQTT_SOCKET_TIMEOUT -#define MQTT_SOCKET_TIMEOUT 15 -#endif - -// MQTT_MAX_TRANSFER_SIZE : limit how much data is passed to the network client -// in each write call. Needed for the Arduino Wifi Shield. Leave undefined to -// pass the entire MQTT packet in each write call. -//#define MQTT_MAX_TRANSFER_SIZE 80 - -// Possible values for client.state() -#define MQTT_CONNECTION_TIMEOUT -4 -#define MQTT_CONNECTION_LOST -3 -#define MQTT_CONNECT_FAILED -2 -#define MQTT_DISCONNECTED -1 -#define MQTT_CONNECTED 0 -#define MQTT_CONNECT_BAD_PROTOCOL 1 -#define MQTT_CONNECT_BAD_CLIENT_ID 2 -#define MQTT_CONNECT_UNAVAILABLE 3 -#define MQTT_CONNECT_BAD_CREDENTIALS 4 -#define MQTT_CONNECT_UNAUTHORIZED 5 - -#define MQTTCONNECT 1 << 4 // Client request to connect to Server -#define MQTTCONNACK 2 << 4 // Connect Acknowledgment -#define MQTTPUBLISH 3 << 4 // Publish message -#define MQTTPUBACK 4 << 4 // Publish Acknowledgment -#define MQTTPUBREC 5 << 4 // Publish Received (assured delivery part 1) -#define MQTTPUBREL 6 << 4 // Publish Release (assured delivery part 2) -#define MQTTPUBCOMP 7 << 4 // Publish Complete (assured delivery part 3) -#define MQTTSUBSCRIBE 8 << 4 // Client Subscribe request -#define MQTTSUBACK 9 << 4 // Subscribe Acknowledgment -#define MQTTUNSUBSCRIBE 10 << 4 // Client Unsubscribe request -#define MQTTUNSUBACK 11 << 4 // Unsubscribe Acknowledgment -#define MQTTPINGREQ 12 << 4 // PING Request -#define MQTTPINGRESP 13 << 4 // PING Response -#define MQTTDISCONNECT 14 << 4 // Client is Disconnecting -#define MQTTReserved 15 << 4 // Reserved - -#define MQTTQOS0 (0 << 1) -#define MQTTQOS1 (1 << 1) -#define MQTTQOS2 (2 << 1) - -// Maximum size of fixed header and variable length size header -#define MQTT_MAX_HEADER_SIZE 5 - -#if defined(ESP8266) || defined(ESP32) -#include -#define MQTT_CALLBACK_SIGNATURE std::function callback -#else -#define MQTT_CALLBACK_SIGNATURE void (*callback)(char*, uint8_t*, unsigned int) -#endif - -#define CHECK_STRING_LENGTH(l,s) if (l+2+strlen(s) > MQTT_MAX_PACKET_SIZE) {_client->stop();return false;} - -class PubSubClient : public Print { -private: - Client* _client; - uint8_t buffer[MQTT_MAX_PACKET_SIZE]; - uint16_t nextMsgId; - unsigned long lastOutActivity; - unsigned long lastInActivity; - bool pingOutstanding; - MQTT_CALLBACK_SIGNATURE; - uint16_t readPacket(uint8_t*); - boolean readByte(uint8_t * result); - boolean readByte(uint8_t * result, uint16_t * index); - boolean write(uint8_t header, uint8_t* buf, uint16_t length); - uint16_t writeString(const char* string, uint8_t* buf, uint16_t pos); - // Build up the header ready to send - // Returns the size of the header - // Note: the header is built at the end of the first MQTT_MAX_HEADER_SIZE bytes, so will start - // (MQTT_MAX_HEADER_SIZE - ) bytes into the buffer - size_t buildHeader(uint8_t header, uint8_t* buf, uint16_t length); - IPAddress ip; - const char* domain; - uint16_t port; - Stream* stream; - int _state; -public: - PubSubClient(); - PubSubClient(Client& client); - PubSubClient(IPAddress, uint16_t, Client& client); - PubSubClient(IPAddress, uint16_t, Client& client, Stream&); - PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client); - PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&); - PubSubClient(uint8_t *, uint16_t, Client& client); - PubSubClient(uint8_t *, uint16_t, Client& client, Stream&); - PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client); - PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&); - PubSubClient(const char*, uint16_t, Client& client); - PubSubClient(const char*, uint16_t, Client& client, Stream&); - PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client); - PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&); - - PubSubClient& setServer(IPAddress ip, uint16_t port); - PubSubClient& setServer(uint8_t * ip, uint16_t port); - PubSubClient& setServer(const char * domain, uint16_t port); - PubSubClient& setCallback(MQTT_CALLBACK_SIGNATURE); - PubSubClient& setClient(Client& client); - PubSubClient& setStream(Stream& stream); - - boolean connect(const char* id); - boolean connect(const char* id, const char* user, const char* pass); - boolean connect(const char* id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage); - boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage); - boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage, boolean cleanSession); - void disconnect(); - boolean publish(const char* topic, const char* payload); - boolean publish(const char* topic, const char* payload, boolean retained); - boolean publish(const char* topic, const uint8_t * payload, unsigned int plength); - boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained); - boolean publish_P(const char* topic, const char* payload, boolean retained); - boolean publish_P(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained); - // Start to publish a message. - // This API: - // beginPublish(...) - // one or more calls to write(...) - // endPublish() - // Allows for arbitrarily large payloads to be sent without them having to be copied into - // a new buffer and held in memory at one time - // Returns 1 if the message was started successfully, 0 if there was an error - boolean beginPublish(const char* topic, unsigned int plength, boolean retained); - // Finish off this publish message (started with beginPublish) - // Returns 1 if the packet was sent successfully, 0 if there was an error - int endPublish(); - // Write a single byte of payload (only to be used with beginPublish/endPublish) - virtual size_t write(uint8_t); - // Write size bytes from buffer into the payload (only to be used with beginPublish/endPublish) - // Returns the number of bytes written - virtual size_t write(const uint8_t *buffer, size_t size); - boolean subscribe(const char* topic); - boolean subscribe(const char* topic, uint8_t qos); - boolean unsubscribe(const char* topic); - boolean loop(); - boolean connected(); - int state(); -}; - - -#endif diff --git a/lib/PubSubClient/tests/.gitignore b/lib/PubSubClient/tests/.gitignore deleted file mode 100644 index 215de78..0000000 --- a/lib/PubSubClient/tests/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.build -tmpbin -logs -*.pyc diff --git a/lib/PubSubClient/tests/Makefile b/lib/PubSubClient/tests/Makefile deleted file mode 100644 index 1f71636..0000000 --- a/lib/PubSubClient/tests/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -SRC_PATH=./src -OUT_PATH=./bin -TEST_SRC=$(wildcard ${SRC_PATH}/*_spec.cpp) -TEST_BIN= $(TEST_SRC:${SRC_PATH}/%.cpp=${OUT_PATH}/%) -VPATH=${SRC_PATH} -SHIM_FILES=${SRC_PATH}/lib/*.cpp -PSC_FILE=../src/PubSubClient.cpp -CC=g++ -CFLAGS=-I${SRC_PATH}/lib -I../src - -all: $(TEST_BIN) - -${OUT_PATH}/%: ${SRC_PATH}/%.cpp ${PSC_FILE} ${SHIM_FILES} - mkdir -p ${OUT_PATH} - ${CC} ${CFLAGS} $^ -o $@ - -clean: - @rm -rf ${OUT_PATH} - -test: - @bin/connect_spec - @bin/publish_spec - @bin/receive_spec - @bin/subscribe_spec - @bin/keepalive_spec diff --git a/lib/PubSubClient/tests/README.md b/lib/PubSubClient/tests/README.md deleted file mode 100644 index e5700a6..0000000 --- a/lib/PubSubClient/tests/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# Arduino Client for MQTT Test Suite - -This is a regression test suite for the `PubSubClient` library. - -There are two parts: - - - Tests that can be compiled and run on any machine - - Tests that build the example sketches using the Arduino IDE - - -It is a work-in-progress and is subject to complete refactoring as the whim takes -me. - - -## Local tests - -These are a set of executables that can be run to test specific areas of functionality. -They do not require a real Arduino to be attached, nor the use of the Arduino IDE. - -The tests include a set of mock files to stub out the parts of the Arduino environment the library -depends on. - -### Dependencies - - - g++ - -### Running - -Build the tests using the provided `Makefile`: - - $ make - -This will create a set of executables in `./bin/`. Run each of these executables to test the corresponding functionality. - -*Note:* the `connect_spec` and `keepalive_spec` tests involve testing keepalive timers so naturally take a few minutes to run through. - -## Arduino tests - -*Note:* INO Tool doesn't currently play nicely with Arduino 1.5. This has broken this test suite. - -Without a suitable arduino plugged in, the test suite will only check the -example sketches compile cleanly against the library. - -With an arduino plugged in, each sketch that has a corresponding python -test case is built, uploaded and then the tests run. - -### Dependencies - - - Python 2.7+ - - [INO Tool](http://inotool.org/) - this provides command-line build/upload of Arduino sketches - -### Running - -The test suite _does not_ run an MQTT server - it is assumed to be running already. - - $ python testsuite.py - -A summary of activity is printed to the console. More comprehensive logs are written -to the `logs` directory. - -### What it does - -For each sketch in the library's `examples` directory, e.g. `mqtt_basic.ino`, the suite looks for a matching test case -`testcases/mqtt_basic.py`. - -The test case must follow these conventions: - - sub-class `unittest.TestCase` - - provide the class methods `setUpClass` and `tearDownClass` (TODO: make this optional) - - all test method names begin with `test_` - -The suite will call the `setUpClass` method _before_ uploading the sketch. This -allows any test setup to be performed before the sketch runs - such as connecting -a client and subscribing to topics. - - -### Settings - -The file `testcases/settings.py` is used to config the test environment. - - - `server_ip` - the IP address of the broker the client should connect to (the broker port is assumed to be 1883). - - `arduino_ip` - the IP address the arduino should use (when not testing DHCP). - -Before each sketch is compiled, these values are automatically substituted in. To -do this, the suite looks for lines that _start_ with the following: - - byte server[] = { - byte ip[] = { - -and replaces them with the appropriate values. - - - - diff --git a/lib/PubSubClient/tests/src/connect_spec.cpp_ b/lib/PubSubClient/tests/src/connect_spec.cpp_ deleted file mode 100644 index e27a1f5..0000000 --- a/lib/PubSubClient/tests/src/connect_spec.cpp_ +++ /dev/null @@ -1,302 +0,0 @@ -#include "PubSubClient.h" -#include "ShimClient.h" -#include "Buffer.h" -#include "BDDTest.h" -#include "trace.h" - - -byte server[] = { 172, 16, 0, 2 }; - -void callback(char* topic, byte* payload, unsigned int length) { - // handle message arrived -} - - -int test_connect_fails_no_network() { - IT("fails to connect if underlying client doesn't connect"); - ShimClient shimClient; - shimClient.setAllowConnect(false); - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_FALSE(rc); - int state = client.state(); - IS_TRUE(state == MQTT_CONNECT_FAILED); - END_IT -} - -int test_connect_fails_on_no_response() { - IT("fails to connect if no response received after 15 seconds"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_FALSE(rc); - int state = client.state(); - IS_TRUE(state == MQTT_CONNECTION_TIMEOUT); - END_IT -} - -int test_connect_properly_formatted() { - IT("sends a properly formatted connect packet and succeeds"); - ShimClient shimClient; - - shimClient.setAllowConnect(true); - byte expectServer[] = { 172, 16, 0, 2 }; - shimClient.expectConnect(expectServer,1883); - byte connect[] = {0x10,0x18,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0x2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - - shimClient.expect(connect,26); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int state = client.state(); - IS_TRUE(state == MQTT_DISCONNECTED); - - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - state = client.state(); - IS_TRUE(state == MQTT_CONNECTED); - - END_IT -} - -int test_connect_properly_formatted_hostname() { - IT("accepts a hostname"); - ShimClient shimClient; - - shimClient.setAllowConnect(true); - shimClient.expectConnect((char* const)"localhost",1883); - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client((char* const)"localhost", 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - END_IT -} - - -int test_connect_fails_on_bad_rc() { - IT("fails to connect if a bad return code is received"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - byte connack[] = { 0x20, 0x02, 0x00, 0x01 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_FALSE(rc); - - int state = client.state(); - IS_TRUE(state == 0x01); - - END_IT -} - -int test_connect_non_clean_session() { - IT("sends a properly formatted non-clean session connect packet and succeeds"); - ShimClient shimClient; - - shimClient.setAllowConnect(true); - byte expectServer[] = { 172, 16, 0, 2 }; - shimClient.expectConnect(expectServer,1883); - byte connect[] = {0x10,0x18,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0x0,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - - shimClient.expect(connect,26); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int state = client.state(); - IS_TRUE(state == MQTT_DISCONNECTED); - - int rc = client.connect((char*)"client_test1",0,0,0,0,0,0,0); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - state = client.state(); - IS_TRUE(state == MQTT_CONNECTED); - - END_IT -} - -int test_connect_accepts_username_password() { - IT("accepts a username and password"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connect[] = { 0x10,0x24,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0xc2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31,0x0,0x4,0x75,0x73,0x65,0x72,0x0,0x4,0x70,0x61,0x73,0x73}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.expect(connect,0x26); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1",(char*)"user",(char*)"pass"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_connect_accepts_username_no_password() { - IT("accepts a username but no password"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connect[] = { 0x10,0x1e,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0x82,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31,0x0,0x4,0x75,0x73,0x65,0x72}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.expect(connect,0x20); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1",(char*)"user",0); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - END_IT -} -int test_connect_accepts_username_blank_password() { - IT("accepts a username and blank password"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connect[] = { 0x10,0x20,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0xc2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31,0x0,0x4,0x75,0x73,0x65,0x72,0x0,0x0}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.expect(connect,0x26); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1",(char*)"user",(char*)"pass"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_connect_ignores_password_no_username() { - IT("ignores a password but no username"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connect[] = {0x10,0x18,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0x2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.expect(connect,26); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1",0,(char*)"pass"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_connect_with_will() { - IT("accepts a will"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connect[] = {0x10,0x30,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0xe,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31,0x0,0x9,0x77,0x69,0x6c,0x6c,0x54,0x6f,0x70,0x69,0x63,0x0,0xb,0x77,0x69,0x6c,0x6c,0x4d,0x65,0x73,0x73,0x61,0x67,0x65}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.expect(connect,0x32); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1",(char*)"willTopic",1,0,(char*)"willMessage"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_connect_with_will_username_password() { - IT("accepts a will, username and password"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connect[] = {0x10,0x40,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0xce,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31,0x0,0x9,0x77,0x69,0x6c,0x6c,0x54,0x6f,0x70,0x69,0x63,0x0,0xb,0x77,0x69,0x6c,0x6c,0x4d,0x65,0x73,0x73,0x61,0x67,0x65,0x0,0x4,0x75,0x73,0x65,0x72,0x0,0x8,0x70,0x61,0x73,0x73,0x77,0x6f,0x72,0x64}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.expect(connect,0x42); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1",(char*)"user",(char*)"password",(char*)"willTopic",1,0,(char*)"willMessage"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_connect_disconnect_connect() { - IT("connects, disconnects and connects again"); - ShimClient shimClient; - - shimClient.setAllowConnect(true); - byte expectServer[] = { 172, 16, 0, 2 }; - shimClient.expectConnect(expectServer,1883); - byte connect[] = {0x10,0x18,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0x2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31}; - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - - shimClient.expect(connect,26); - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - - int state = client.state(); - IS_TRUE(state == MQTT_DISCONNECTED); - - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - - state = client.state(); - IS_TRUE(state == MQTT_CONNECTED); - - byte disconnect[] = {0xE0,0x00}; - shimClient.expect(disconnect,2); - - client.disconnect(); - - IS_FALSE(client.connected()); - IS_FALSE(shimClient.connected()); - IS_FALSE(shimClient.error()); - - state = client.state(); - IS_TRUE(state == MQTT_DISCONNECTED); - - shimClient.expect(connect,28); - shimClient.respond(connack,4); - rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - state = client.state(); - IS_TRUE(state == MQTT_CONNECTED); - - END_IT -} - -int main() -{ - SUITE("Connect"); - - test_connect_fails_no_network(); - test_connect_fails_on_no_response(); - - test_connect_properly_formatted(); - test_connect_non_clean_session(); - test_connect_accepts_username_password(); - test_connect_fails_on_bad_rc(); - test_connect_properly_formatted_hostname(); - - test_connect_accepts_username_no_password(); - test_connect_ignores_password_no_username(); - test_connect_with_will(); - test_connect_with_will_username_password(); - test_connect_disconnect_connect(); - FINISH -} diff --git a/lib/PubSubClient/tests/src/keepalive_spec.cpp_ b/lib/PubSubClient/tests/src/keepalive_spec.cpp_ deleted file mode 100644 index ea643cf..0000000 --- a/lib/PubSubClient/tests/src/keepalive_spec.cpp_ +++ /dev/null @@ -1,185 +0,0 @@ -#include "PubSubClient.h" -#include "ShimClient.h" -#include "Buffer.h" -#include "BDDTest.h" -#include "trace.h" -#include - -byte server[] = { 172, 16, 0, 2 }; - -void callback(char* topic, byte* payload, unsigned int length) { - // handle message arrived -} - - -int test_keepalive_pings_idle() { - IT("keeps an idle connection alive (takes 1 minute)"); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte pingreq[] = { 0xC0,0x0 }; - shimClient.expect(pingreq,2); - byte pingresp[] = { 0xD0,0x0 }; - shimClient.respond(pingresp,2); - - for (int i = 0; i < 50; i++) { - sleep(1); - if ( i == 15 || i == 31 || i == 47) { - shimClient.expect(pingreq,2); - shimClient.respond(pingresp,2); - } - rc = client.loop(); - IS_TRUE(rc); - } - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_keepalive_pings_with_outbound_qos0() { - IT("keeps a connection alive that only sends qos0 (takes 1 minute)"); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - - for (int i = 0; i < 50; i++) { - TRACE(i<<":"); - shimClient.expect(publish,16); - rc = client.publish((char*)"topic",(char*)"payload"); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - sleep(1); - if ( i == 15 || i == 31 || i == 47) { - byte pingreq[] = { 0xC0,0x0 }; - shimClient.expect(pingreq,2); - byte pingresp[] = { 0xD0,0x0 }; - shimClient.respond(pingresp,2); - } - rc = client.loop(); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - } - - END_IT -} - -int test_keepalive_pings_with_inbound_qos0() { - IT("keeps a connection alive that only receives qos0 (takes 1 minute)"); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - - for (int i = 0; i < 50; i++) { - TRACE(i<<":"); - sleep(1); - if ( i == 15 || i == 31 || i == 47) { - byte pingreq[] = { 0xC0,0x0 }; - shimClient.expect(pingreq,2); - byte pingresp[] = { 0xD0,0x0 }; - shimClient.respond(pingresp,2); - } - shimClient.respond(publish,16); - rc = client.loop(); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - } - - END_IT -} - -int test_keepalive_no_pings_inbound_qos1() { - IT("does not send pings for connections with inbound qos1 (takes 1 minute)"); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x32,0x10,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x12,0x34,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - byte puback[] = {0x40,0x2,0x12,0x34}; - - for (int i = 0; i < 50; i++) { - shimClient.respond(publish,18); - shimClient.expect(puback,4); - sleep(1); - rc = client.loop(); - IS_TRUE(rc); - IS_FALSE(shimClient.error()); - } - - END_IT -} - -int test_keepalive_disconnects_hung() { - IT("disconnects a hung connection (takes 30 seconds)"); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte pingreq[] = { 0xC0,0x0 }; - shimClient.expect(pingreq,2); - - for (int i = 0; i < 32; i++) { - sleep(1); - rc = client.loop(); - } - IS_FALSE(rc); - - int state = client.state(); - IS_TRUE(state == MQTT_CONNECTION_TIMEOUT); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int main() -{ - SUITE("Keep-alive"); - test_keepalive_pings_idle(); - test_keepalive_pings_with_outbound_qos0(); - test_keepalive_pings_with_inbound_qos0(); - test_keepalive_no_pings_inbound_qos1(); - test_keepalive_disconnects_hung(); - - FINISH -} diff --git a/lib/PubSubClient/tests/src/lib/Arduino.h b/lib/PubSubClient/tests/src/lib/Arduino.h deleted file mode 100644 index 2a00f24..0000000 --- a/lib/PubSubClient/tests/src/lib/Arduino.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef Arduino_h -#define Arduino_h - -#include -#include -#include -#include -#include "Print.h" - - -extern "C"{ - typedef uint8_t byte ; - typedef uint8_t boolean ; - - /* sketch */ - extern void setup( void ) ; - extern void loop( void ) ; - uint32_t millis( void ); -} - -#define PROGMEM -#define pgm_read_byte_near(x) *(x) - -#define yield(x) {} - -#endif // Arduino_h diff --git a/lib/PubSubClient/tests/src/lib/BDDTest.cpp_ b/lib/PubSubClient/tests/src/lib/BDDTest.cpp_ deleted file mode 100644 index a72bf65..0000000 --- a/lib/PubSubClient/tests/src/lib/BDDTest.cpp_ +++ /dev/null @@ -1,50 +0,0 @@ -#include "BDDTest.h" -#include "trace.h" -#include -#include -#include -#include - -int testCount = 0; -int testPasses = 0; -const char* testDescription; - -std::list failureList; - -void bddtest_suite(const char* name) { - LOG(name << "\n"); -} - -int bddtest_test(const char* file, int line, const char* assertion, int result) { - if (!result) { - LOG("✗\n"); - std::ostringstream os; - os << " ! "<::iterator it = failureList.begin(); it != failureList.end(); it++) { - LOG("\n"); - LOG(*it); - LOG("\n"); - } - - LOG(std::dec << testPasses << "/" << testCount << " tests passed\n\n"); - if (testPasses == testCount) { - return 0; - } - return 1; -} diff --git a/lib/PubSubClient/tests/src/lib/BDDTest.h b/lib/PubSubClient/tests/src/lib/BDDTest.h deleted file mode 100644 index 1197fdd..0000000 --- a/lib/PubSubClient/tests/src/lib/BDDTest.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef bddtest_h -#define bddtest_h - -void bddtest_suite(const char* name); -int bddtest_test(const char*, int, const char*, int); -void bddtest_start(const char*); -void bddtest_end(); -int bddtest_summary(); - -#define SUITE(x) { bddtest_suite(x); } -#define TEST(x) { if (!bddtest_test(__FILE__, __LINE__, #x, (x))) return false; } - -#define IT(x) { bddtest_start(x); } -#define END_IT { bddtest_end();return true;} - -#define FINISH { return bddtest_summary(); } - -#define IS_TRUE(x) TEST(x) -#define IS_FALSE(x) TEST(!(x)) -#define IS_EQUAL(x,y) TEST(x==y) -#define IS_NOT_EQUAL(x,y) TEST(x!=y) - -#endif diff --git a/lib/PubSubClient/tests/src/lib/Buffer.cpp_ b/lib/PubSubClient/tests/src/lib/Buffer.cpp_ deleted file mode 100644 index 656f7dd..0000000 --- a/lib/PubSubClient/tests/src/lib/Buffer.cpp_ +++ /dev/null @@ -1,34 +0,0 @@ -#include "Buffer.h" -#include - -Buffer::Buffer() { - this->pos = 0; - this->length = 0; -} - -Buffer::Buffer(uint8_t* buf, size_t size) { - this->pos = 0; - this->length = 0; - this->add(buf,size); -} -bool Buffer::available() { - return this->pos < this->length; -} - -uint8_t Buffer::next() { - if (this->available()) { - return this->buffer[this->pos++]; - } - return 0; -} - -void Buffer::reset() { - this->pos = 0; -} - -void Buffer::add(uint8_t* buf, size_t size) { - uint16_t i = 0; - for (;ibuffer[this->length++] = buf[i]; - } -} diff --git a/lib/PubSubClient/tests/src/lib/Buffer.h b/lib/PubSubClient/tests/src/lib/Buffer.h deleted file mode 100644 index 4d46caa..0000000 --- a/lib/PubSubClient/tests/src/lib/Buffer.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef buffer_h -#define buffer_h - -#include - -class Buffer { -private: - uint8_t buffer[1024]; - uint16_t pos; - uint16_t length; - -public: - Buffer(); - Buffer(uint8_t* buf, size_t size); - - virtual bool available(); - virtual uint8_t next(); - virtual void reset(); - - virtual void add(uint8_t* buf, size_t size); -}; - -#endif diff --git a/lib/PubSubClient/tests/src/lib/Client.h b/lib/PubSubClient/tests/src/lib/Client.h deleted file mode 100644 index 9e18c07..0000000 --- a/lib/PubSubClient/tests/src/lib/Client.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef client_h -#define client_h -#include "IPAddress.h" - -class Client { -public: - virtual int connect(IPAddress ip, uint16_t port) =0; - virtual int connect(const char *host, uint16_t port) =0; - virtual size_t write(uint8_t) =0; - virtual size_t write(const uint8_t *buf, size_t size) =0; - virtual int available() = 0; - virtual int read() = 0; - virtual int read(uint8_t *buf, size_t size) = 0; - virtual int peek() = 0; - virtual void flush() = 0; - virtual void stop() = 0; - virtual uint8_t connected() = 0; - virtual operator bool() = 0; -}; - -#endif diff --git a/lib/PubSubClient/tests/src/lib/IPAddress.cpp_ b/lib/PubSubClient/tests/src/lib/IPAddress.cpp_ deleted file mode 100644 index 610ff4c..0000000 --- a/lib/PubSubClient/tests/src/lib/IPAddress.cpp_ +++ /dev/null @@ -1,44 +0,0 @@ - -#include -#include - -IPAddress::IPAddress() -{ - memset(_address, 0, sizeof(_address)); -} - -IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) -{ - _address[0] = first_octet; - _address[1] = second_octet; - _address[2] = third_octet; - _address[3] = fourth_octet; -} - -IPAddress::IPAddress(uint32_t address) -{ - memcpy(_address, &address, sizeof(_address)); -} - -IPAddress::IPAddress(const uint8_t *address) -{ - memcpy(_address, address, sizeof(_address)); -} - -IPAddress& IPAddress::operator=(const uint8_t *address) -{ - memcpy(_address, address, sizeof(_address)); - return *this; -} - -IPAddress& IPAddress::operator=(uint32_t address) -{ - memcpy(_address, (const uint8_t *)&address, sizeof(_address)); - return *this; -} - -bool IPAddress::operator==(const uint8_t* addr) -{ - return memcmp(addr, _address, sizeof(_address)) == 0; -} - diff --git a/lib/PubSubClient/tests/src/lib/IPAddress.h b/lib/PubSubClient/tests/src/lib/IPAddress.h deleted file mode 100644 index e75a8fe..0000000 --- a/lib/PubSubClient/tests/src/lib/IPAddress.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * MIT License: - * Copyright (c) 2011 Adrian McEwen - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * adrianm@mcqn.com 1/1/2011 - */ - -#ifndef IPAddress_h -#define IPAddress_h - - -// A class to make it easier to handle and pass around IP addresses - -class IPAddress { -private: - uint8_t _address[4]; // IPv4 address - // Access the raw byte array containing the address. Because this returns a pointer - // to the internal structure rather than a copy of the address this function should only - // be used when you know that the usage of the returned uint8_t* will be transient and not - // stored. - uint8_t* raw_address() { return _address; }; - -public: - // Constructors - IPAddress(); - IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet); - IPAddress(uint32_t address); - IPAddress(const uint8_t *address); - - // Overloaded cast operator to allow IPAddress objects to be used where a pointer - // to a four-byte uint8_t array is expected - operator uint32_t() { return *((uint32_t*)_address); }; - bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); }; - bool operator==(const uint8_t* addr); - - // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const { return _address[index]; }; - uint8_t& operator[](int index) { return _address[index]; }; - - // Overloaded copy operators to allow initialisation of IPAddress objects from other types - IPAddress& operator=(const uint8_t *address); - IPAddress& operator=(uint32_t address); - - - friend class EthernetClass; - friend class UDP; - friend class Client; - friend class Server; - friend class DhcpClass; - friend class DNSClient; -}; - - -#endif diff --git a/lib/PubSubClient/tests/src/lib/Print.h b/lib/PubSubClient/tests/src/lib/Print.h deleted file mode 100644 index 02ef77c..0000000 --- a/lib/PubSubClient/tests/src/lib/Print.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - Print.h - Base class that provides print() and println() - Copyright (c) 2008 David A. Mellis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef Print_h -#define Print_h - -class Print { - public: - virtual size_t write(uint8_t) = 0; -}; - -#endif diff --git a/lib/PubSubClient/tests/src/lib/ShimClient.cpp_ b/lib/PubSubClient/tests/src/lib/ShimClient.cpp_ deleted file mode 100644 index f70115f..0000000 --- a/lib/PubSubClient/tests/src/lib/ShimClient.cpp_ +++ /dev/null @@ -1,153 +0,0 @@ -#include "ShimClient.h" -#include "trace.h" -#include -#include -#include - -extern "C" { - uint32_t millis(void) { - return time(0)*1000; - } -} - -ShimClient::ShimClient() { - this->responseBuffer = new Buffer(); - this->expectBuffer = new Buffer(); - this->_allowConnect = true; - this->_connected = false; - this->_error = false; - this->expectAnything = true; - this->_received = 0; - this->_expectedPort = 0; -} - -int ShimClient::connect(IPAddress ip, uint16_t port) { - if (this->_allowConnect) { - this->_connected = true; - } - if (this->_expectedPort !=0) { - // if (memcmp(ip,this->_expectedIP,4) != 0) { - // TRACE( "ip mismatch\n"); - // this->_error = true; - // } - if (port != this->_expectedPort) { - TRACE( "port mismatch\n"); - this->_error = true; - } - } - return this->_connected; -} -int ShimClient::connect(const char *host, uint16_t port) { - if (this->_allowConnect) { - this->_connected = true; - } - if (this->_expectedPort !=0) { - if (strcmp(host,this->_expectedHost) != 0) { - TRACE( "host mismatch\n"); - this->_error = true; - } - if (port != this->_expectedPort) { - TRACE( "port mismatch\n"); - this->_error = true; - } - - } - return this->_connected; -} -size_t ShimClient::write(uint8_t b) { - this->_received += 1; - TRACE(std::hex << (unsigned int)b); - if (!this->expectAnything) { - if (this->expectBuffer->available()) { - uint8_t expected = this->expectBuffer->next(); - if (expected != b) { - this->_error = true; - TRACE("!=" << (unsigned int)expected); - } - } else { - this->_error = true; - } - } - TRACE("\n"<< std::dec); - return 1; -} -size_t ShimClient::write(const uint8_t *buf, size_t size) { - this->_received += size; - TRACE( "[" << std::dec << (unsigned int)(size) << "] "); - uint16_t i=0; - for (;i0) { - TRACE(":"); - } - TRACE(std::hex << (unsigned int)(buf[i])); - - if (!this->expectAnything) { - if (this->expectBuffer->available()) { - uint8_t expected = this->expectBuffer->next(); - if (expected != buf[i]) { - this->_error = true; - TRACE("!=" << (unsigned int)expected); - } - } else { - this->_error = true; - } - } - } - TRACE("\n"<responseBuffer->available(); -} -int ShimClient::read() { return this->responseBuffer->next(); } -int ShimClient::read(uint8_t *buf, size_t size) { - uint16_t i = 0; - for (;iread(); - } - return size; -} -int ShimClient::peek() { return 0; } -void ShimClient::flush() {} -void ShimClient::stop() { - this->setConnected(false); -} -uint8_t ShimClient::connected() { return this->_connected; } -ShimClient::operator bool() { return true; } - - -ShimClient* ShimClient::respond(uint8_t *buf, size_t size) { - this->responseBuffer->add(buf,size); - return this; -} - -ShimClient* ShimClient::expect(uint8_t *buf, size_t size) { - this->expectAnything = false; - this->expectBuffer->add(buf,size); - return this; -} - -void ShimClient::setConnected(bool b) { - this->_connected = b; -} -void ShimClient::setAllowConnect(bool b) { - this->_allowConnect = b; -} - -bool ShimClient::error() { - return this->_error; -} - -uint16_t ShimClient::received() { - return this->_received; -} - -void ShimClient::expectConnect(IPAddress ip, uint16_t port) { - this->_expectedIP = ip; - this->_expectedPort = port; -} - -void ShimClient::expectConnect(const char *host, uint16_t port) { - this->_expectedHost = host; - this->_expectedPort = port; -} diff --git a/lib/PubSubClient/tests/src/lib/ShimClient.h b/lib/PubSubClient/tests/src/lib/ShimClient.h deleted file mode 100644 index 17fc61a..0000000 --- a/lib/PubSubClient/tests/src/lib/ShimClient.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef shimclient_h -#define shimclient_h - -#include -#include "Client.h" -#include "IPAddress.h" -#include "Buffer.h" - - -class ShimClient : public Client { -private: - Buffer* responseBuffer; - Buffer* expectBuffer; - bool _allowConnect; - bool _connected; - bool expectAnything; - bool _error; - uint16_t _received; - IPAddress _expectedIP; - uint16_t _expectedPort; - const char* _expectedHost; - -public: - ShimClient(); - virtual int connect(IPAddress ip, uint16_t port); - virtual int connect(const char *host, uint16_t port); - virtual size_t write(uint8_t); - virtual size_t write(const uint8_t *buf, size_t size); - virtual int available(); - virtual int read(); - virtual int read(uint8_t *buf, size_t size); - virtual int peek(); - virtual void flush(); - virtual void stop(); - virtual uint8_t connected(); - virtual operator bool(); - - virtual ShimClient* respond(uint8_t *buf, size_t size); - virtual ShimClient* expect(uint8_t *buf, size_t size); - - virtual void expectConnect(IPAddress ip, uint16_t port); - virtual void expectConnect(const char *host, uint16_t port); - - virtual uint16_t received(); - virtual bool error(); - - virtual void setAllowConnect(bool b); - virtual void setConnected(bool b); -}; - -#endif diff --git a/lib/PubSubClient/tests/src/lib/Stream.cpp_ b/lib/PubSubClient/tests/src/lib/Stream.cpp_ deleted file mode 100644 index b0ecbb4..0000000 --- a/lib/PubSubClient/tests/src/lib/Stream.cpp_ +++ /dev/null @@ -1,39 +0,0 @@ -#include "Stream.h" -#include "trace.h" -#include -#include - -Stream::Stream() { - this->expectBuffer = new Buffer(); - this->_error = false; - this->_written = 0; -} - -size_t Stream::write(uint8_t b) { - this->_written++; - TRACE(std::hex << (unsigned int)b); - if (this->expectBuffer->available()) { - uint8_t expected = this->expectBuffer->next(); - if (expected != b) { - this->_error = true; - TRACE("!=" << (unsigned int)expected); - } - } else { - this->_error = true; - } - TRACE("\n"<< std::dec); - return 1; -} - - -bool Stream::error() { - return this->_error; -} - -void Stream::expect(uint8_t *buf, size_t size) { - this->expectBuffer->add(buf,size); -} - -uint16_t Stream::length() { - return this->_written; -} diff --git a/lib/PubSubClient/tests/src/lib/Stream.h b/lib/PubSubClient/tests/src/lib/Stream.h deleted file mode 100644 index a488d2d..0000000 --- a/lib/PubSubClient/tests/src/lib/Stream.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef Stream_h -#define Stream_h - -#include -#include "Buffer.h" - -class Stream { -private: - Buffer* expectBuffer; - bool _error; - uint16_t _written; - -public: - Stream(); - virtual size_t write(uint8_t); - - virtual bool error(); - virtual void expect(uint8_t *buf, size_t size); - virtual uint16_t length(); -}; - -#endif diff --git a/lib/PubSubClient/tests/src/lib/trace.h b/lib/PubSubClient/tests/src/lib/trace.h deleted file mode 100644 index 42eb991..0000000 --- a/lib/PubSubClient/tests/src/lib/trace.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef trace_h -#define trace_h -#include - -#include - -#define LOG(x) {std::cout << x << std::flush; } -#define TRACE(x) {if (getenv("TRACE")) { std::cout << x << std::flush; }} - -#endif diff --git a/lib/PubSubClient/tests/src/publish_spec.cpp_ b/lib/PubSubClient/tests/src/publish_spec.cpp_ deleted file mode 100644 index 232df0d..0000000 --- a/lib/PubSubClient/tests/src/publish_spec.cpp_ +++ /dev/null @@ -1,190 +0,0 @@ -#include "PubSubClient.h" -#include "ShimClient.h" -#include "Buffer.h" -#include "BDDTest.h" -#include "trace.h" - - -byte server[] = { 172, 16, 0, 2 }; - -void callback(char* topic, byte* payload, unsigned int length) { - // handle message arrived -} - -int test_publish() { - IT("publishes a null-terminated string"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - shimClient.expect(publish,16); - - rc = client.publish((char*)"topic",(char*)"payload"); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - - -int test_publish_bytes() { - IT("publishes a byte array"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte payload[] = { 0x01,0x02,0x03,0x0,0x05 }; - int length = 5; - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x30,0xc,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x1,0x2,0x3,0x0,0x5}; - shimClient.expect(publish,14); - - rc = client.publish((char*)"topic",payload,length); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - - -int test_publish_retained() { - IT("publishes retained - 1"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte payload[] = { 0x01,0x02,0x03,0x0,0x05 }; - int length = 5; - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x31,0xc,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x1,0x2,0x3,0x0,0x5}; - shimClient.expect(publish,14); - - rc = client.publish((char*)"topic",payload,length,true); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_publish_retained_2() { - IT("publishes retained - 2"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x31,0xc,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,'A','B','C','D','E'}; - shimClient.expect(publish,14); - - rc = client.publish((char*)"topic",(char*)"ABCDE",true); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_publish_not_connected() { - IT("publish fails when not connected"); - ShimClient shimClient; - - PubSubClient client(server, 1883, callback, shimClient); - - int rc = client.publish((char*)"topic",(char*)"payload"); - IS_FALSE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_publish_too_long() { - IT("publish fails when topic/payload are too long"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - // 0 1 2 3 4 5 6 7 8 9 0 1 2 - rc = client.publish((char*)"topic",(char*)"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"); - IS_FALSE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_publish_P() { - IT("publishes using PROGMEM"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte payload[] = { 0x01,0x02,0x03,0x0,0x05 }; - int length = 5; - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x31,0xc,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x1,0x2,0x3,0x0,0x5}; - shimClient.expect(publish,14); - - rc = client.publish_P((char*)"topic",payload,length,true); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - - - - -int main() -{ - SUITE("Publish"); - test_publish(); - test_publish_bytes(); - test_publish_retained(); - test_publish_retained_2(); - test_publish_not_connected(); - test_publish_too_long(); - test_publish_P(); - - FINISH -} diff --git a/lib/PubSubClient/tests/src/receive_spec.cpp_ b/lib/PubSubClient/tests/src/receive_spec.cpp_ deleted file mode 100644 index 9a18af0..0000000 --- a/lib/PubSubClient/tests/src/receive_spec.cpp_ +++ /dev/null @@ -1,279 +0,0 @@ -#include "PubSubClient.h" -#include "ShimClient.h" -#include "Buffer.h" -#include "BDDTest.h" -#include "trace.h" - - -byte server[] = { 172, 16, 0, 2 }; - -bool callback_called = false; -char lastTopic[1024]; -char lastPayload[1024]; -unsigned int lastLength; - -void reset_callback() { - callback_called = false; - lastTopic[0] = '\0'; - lastPayload[0] = '\0'; - lastLength = 0; -} - -void callback(char* topic, byte* payload, unsigned int length) { - callback_called = true; - strcpy(lastTopic,topic); - memcpy(lastPayload,payload,length); - lastLength = length; -} - -int test_receive_callback() { - IT("receives a callback message"); - reset_callback(); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - shimClient.respond(publish,16); - - rc = client.loop(); - - IS_TRUE(rc); - - IS_TRUE(callback_called); - IS_TRUE(strcmp(lastTopic,"topic")==0); - IS_TRUE(memcmp(lastPayload,"payload",7)==0); - IS_TRUE(lastLength == 7); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_receive_stream() { - IT("receives a streamed callback message"); - reset_callback(); - - Stream stream; - stream.expect((uint8_t*)"payload",7); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient, stream); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - shimClient.respond(publish,16); - - rc = client.loop(); - - IS_TRUE(rc); - - IS_TRUE(callback_called); - IS_TRUE(strcmp(lastTopic,"topic")==0); - IS_TRUE(lastLength == 7); - - IS_FALSE(stream.error()); - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_receive_max_sized_message() { - IT("receives an max-sized message"); - reset_callback(); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - int length = MQTT_MAX_PACKET_SIZE; - byte publish[] = {0x30,length-2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - byte bigPublish[length]; - memset(bigPublish,'A',length); - bigPublish[length] = 'B'; - memcpy(bigPublish,publish,16); - shimClient.respond(bigPublish,length); - - rc = client.loop(); - - IS_TRUE(rc); - - IS_TRUE(callback_called); - IS_TRUE(strcmp(lastTopic,"topic")==0); - IS_TRUE(lastLength == length-9); - IS_TRUE(memcmp(lastPayload,bigPublish+9,lastLength)==0); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_receive_oversized_message() { - IT("drops an oversized message"); - reset_callback(); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - int length = MQTT_MAX_PACKET_SIZE+1; - byte publish[] = {0x30,length-2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - byte bigPublish[length]; - memset(bigPublish,'A',length); - bigPublish[length] = 'B'; - memcpy(bigPublish,publish,16); - shimClient.respond(bigPublish,length); - - rc = client.loop(); - - IS_TRUE(rc); - - IS_FALSE(callback_called); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_drop_invalid_remaining_length_message() { - IT("drops invalid remaining length message"); - reset_callback(); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x30,0x92,0x92,0x92,0x92,0x01,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - shimClient.respond(publish,20); - - rc = client.loop(); - - IS_FALSE(rc); - - IS_FALSE(callback_called); - - IS_FALSE(shimClient.error()); - - END_IT -} - - -int test_receive_oversized_stream_message() { - IT("drops an oversized message"); - reset_callback(); - - Stream stream; - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient, stream); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - int length = MQTT_MAX_PACKET_SIZE+1; - byte publish[] = {0x30,length-2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - - byte bigPublish[length]; - memset(bigPublish,'A',length); - bigPublish[length] = 'B'; - memcpy(bigPublish,publish,16); - - shimClient.respond(bigPublish,length); - stream.expect(bigPublish+9,length-9); - - rc = client.loop(); - - IS_TRUE(rc); - - IS_TRUE(callback_called); - IS_TRUE(strcmp(lastTopic,"topic")==0); - IS_TRUE(lastLength == length-9); - - IS_FALSE(stream.error()); - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_receive_qos1() { - IT("receives a qos1 message"); - reset_callback(); - - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte publish[] = {0x32,0x10,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x12,0x34,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; - shimClient.respond(publish,18); - - byte puback[] = {0x40,0x2,0x12,0x34}; - shimClient.expect(puback,4); - - rc = client.loop(); - - IS_TRUE(rc); - - IS_TRUE(callback_called); - IS_TRUE(strcmp(lastTopic,"topic")==0); - IS_TRUE(memcmp(lastPayload,"payload",7)==0); - IS_TRUE(lastLength == 7); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int main() -{ - SUITE("Receive"); - test_receive_callback(); - test_receive_stream(); - test_receive_max_sized_message(); - test_drop_invalid_remaining_length_message(); - test_receive_oversized_message(); - test_receive_oversized_stream_message(); - test_receive_qos1(); - - FINISH -} diff --git a/lib/PubSubClient/tests/src/subscribe_spec.cpp_ b/lib/PubSubClient/tests/src/subscribe_spec.cpp_ deleted file mode 100644 index a419823..0000000 --- a/lib/PubSubClient/tests/src/subscribe_spec.cpp_ +++ /dev/null @@ -1,177 +0,0 @@ -#include "PubSubClient.h" -#include "ShimClient.h" -#include "Buffer.h" -#include "BDDTest.h" -#include "trace.h" - - -byte server[] = { 172, 16, 0, 2 }; - -void callback(char* topic, byte* payload, unsigned int length) { - // handle message arrived -} - -int test_subscribe_no_qos() { - IT("subscribe without qos defaults to 0"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte subscribe[] = { 0x82,0xa,0x0,0x2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x0 }; - shimClient.expect(subscribe,12); - byte suback[] = { 0x90,0x3,0x0,0x2,0x0 }; - shimClient.respond(suback,5); - - rc = client.subscribe((char*)"topic"); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_subscribe_qos_1() { - IT("subscribes qos 1"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte subscribe[] = { 0x82,0xa,0x0,0x2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x1 }; - shimClient.expect(subscribe,12); - byte suback[] = { 0x90,0x3,0x0,0x2,0x1 }; - shimClient.respond(suback,5); - - rc = client.subscribe((char*)"topic",1); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_subscribe_not_connected() { - IT("subscribe fails when not connected"); - ShimClient shimClient; - - PubSubClient client(server, 1883, callback, shimClient); - - int rc = client.subscribe((char*)"topic"); - IS_FALSE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_subscribe_invalid_qos() { - IT("subscribe fails with invalid qos values"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - rc = client.subscribe((char*)"topic",2); - IS_FALSE(rc); - rc = client.subscribe((char*)"topic",254); - IS_FALSE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_subscribe_too_long() { - IT("subscribe fails with too long topic"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - // max length should be allowed - // 0 1 2 3 4 5 6 7 8 9 0 1 2 - rc = client.subscribe((char*)"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"); - IS_TRUE(rc); - - // 0 1 2 3 4 5 6 7 8 9 0 1 2 - rc = client.subscribe((char*)"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"); - IS_FALSE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - - -int test_unsubscribe() { - IT("unsubscribes"); - ShimClient shimClient; - shimClient.setAllowConnect(true); - - byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; - shimClient.respond(connack,4); - - PubSubClient client(server, 1883, callback, shimClient); - int rc = client.connect((char*)"client_test1"); - IS_TRUE(rc); - - byte unsubscribe[] = { 0xA2,0x9,0x0,0x2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63 }; - shimClient.expect(unsubscribe,12); - byte unsuback[] = { 0xB0,0x2,0x0,0x2 }; - shimClient.respond(unsuback,4); - - rc = client.unsubscribe((char*)"topic"); - IS_TRUE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int test_unsubscribe_not_connected() { - IT("unsubscribe fails when not connected"); - ShimClient shimClient; - - PubSubClient client(server, 1883, callback, shimClient); - - int rc = client.unsubscribe((char*)"topic"); - IS_FALSE(rc); - - IS_FALSE(shimClient.error()); - - END_IT -} - -int main() -{ - SUITE("Subscribe"); - test_subscribe_no_qos(); - test_subscribe_qos_1(); - test_subscribe_not_connected(); - test_subscribe_invalid_qos(); - test_subscribe_too_long(); - test_unsubscribe(); - test_unsubscribe_not_connected(); - FINISH -} diff --git a/lib/PubSubClient/tests/testcases/__init__.py b/lib/PubSubClient/tests/testcases/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/lib/PubSubClient/tests/testcases/mqtt_basic.py b/lib/PubSubClient/tests/testcases/mqtt_basic.py deleted file mode 100644 index f23ef71..0000000 --- a/lib/PubSubClient/tests/testcases/mqtt_basic.py +++ /dev/null @@ -1,39 +0,0 @@ -import unittest -import settings -import time -import mosquitto - - -def on_message(mosq, obj, msg): - obj.message_queue.append(msg) - - -class mqtt_basic(unittest.TestCase): - - message_queue = [] - - @classmethod - def setUpClass(self): - self.client = mosquitto.Mosquitto("pubsubclient_ut", clean_session=True, obj=self) - self.client.connect(settings.server_ip) - self.client.on_message = on_message - self.client.subscribe("outTopic", 0) - - @classmethod - def tearDownClass(self): - self.client.disconnect() - - def test_one(self): - i = 30 - while len(self.message_queue) == 0 and i > 0: - self.client.loop() - time.sleep(0.5) - i -= 1 - self.assertTrue(i > 0, "message receive timed-out") - self.assertEqual(len(self.message_queue), 1, "unexpected number of messages received") - msg = self.message_queue[0] - self.assertEqual(msg.mid, 0, "message id not 0") - self.assertEqual(msg.topic, "outTopic", "message topic incorrect") - self.assertEqual(msg.payload, "hello world") - self.assertEqual(msg.qos, 0, "message qos not 0") - self.assertEqual(msg.retain, False, "message retain flag incorrect") diff --git a/lib/PubSubClient/tests/testcases/mqtt_publish_in_callback.py b/lib/PubSubClient/tests/testcases/mqtt_publish_in_callback.py deleted file mode 100644 index 45b0a85..0000000 --- a/lib/PubSubClient/tests/testcases/mqtt_publish_in_callback.py +++ /dev/null @@ -1,59 +0,0 @@ -import unittest -import settings -import time -import mosquitto - - -def on_message(mosq, obj, msg): - obj.message_queue.append(msg) - - -class mqtt_publish_in_callback(unittest.TestCase): - - message_queue = [] - - @classmethod - def setUpClass(self): - self.client = mosquitto.Mosquitto("pubsubclient_ut", clean_session=True, obj=self) - self.client.connect(settings.server_ip) - self.client.on_message = on_message - self.client.subscribe("outTopic", 0) - - @classmethod - def tearDownClass(self): - self.client.disconnect() - - def test_connect(self): - i = 30 - while len(self.message_queue) == 0 and i > 0: - self.client.loop() - time.sleep(0.5) - i -= 1 - self.assertTrue(i > 0, "message receive timed-out") - self.assertEqual(len(self.message_queue), 1, "unexpected number of messages received") - msg = self.message_queue.pop(0) - self.assertEqual(msg.mid, 0, "message id not 0") - self.assertEqual(msg.topic, "outTopic", "message topic incorrect") - self.assertEqual(msg.payload, "hello world") - self.assertEqual(msg.qos, 0, "message qos not 0") - self.assertEqual(msg.retain, False, "message retain flag incorrect") - - def test_publish(self): - self.assertEqual(len(self.message_queue), 0, "message queue not empty") - payload = "abcdefghij" - self.client.publish("inTopic", payload) - - i = 30 - while len(self.message_queue) == 0 and i > 0: - self.client.loop() - time.sleep(0.5) - i -= 1 - - self.assertTrue(i > 0, "message receive timed-out") - self.assertEqual(len(self.message_queue), 1, "unexpected number of messages received") - msg = self.message_queue.pop(0) - self.assertEqual(msg.mid, 0, "message id not 0") - self.assertEqual(msg.topic, "outTopic", "message topic incorrect") - self.assertEqual(msg.payload, payload) - self.assertEqual(msg.qos, 0, "message qos not 0") - self.assertEqual(msg.retain, False, "message retain flag incorrect") diff --git a/lib/PubSubClient/tests/testcases/settings.py b/lib/PubSubClient/tests/testcases/settings.py deleted file mode 100644 index 4ad8719..0000000 --- a/lib/PubSubClient/tests/testcases/settings.py +++ /dev/null @@ -1,2 +0,0 @@ -server_ip = "172.16.0.2" -arduino_ip = "172.16.0.100" diff --git a/lib/PubSubClient/tests/testsuite.py b/lib/PubSubClient/tests/testsuite.py deleted file mode 100644 index 788fc5d..0000000 --- a/lib/PubSubClient/tests/testsuite.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env python -import os -import os.path -import sys -import shutil -from subprocess import call -import importlib -import unittest -import re - -from testcases import settings - - -class Workspace(object): - - def __init__(self): - self.root_dir = os.getcwd() - self.build_dir = os.path.join(self.root_dir, "tmpbin") - self.log_dir = os.path.join(self.root_dir, "logs") - self.tests_dir = os.path.join(self.root_dir, "testcases") - self.examples_dir = os.path.join(self.root_dir, "../PubSubClient/examples") - self.examples = [] - self.tests = [] - if not os.path.isdir("../PubSubClient"): - raise Exception("Cannot find PubSubClient library") - try: - return __import__('ino') - except ImportError: - raise Exception("ino tool not installed") - - def init(self): - if os.path.isdir(self.build_dir): - shutil.rmtree(self.build_dir) - os.mkdir(self.build_dir) - if os.path.isdir(self.log_dir): - shutil.rmtree(self.log_dir) - os.mkdir(self.log_dir) - - os.chdir(self.build_dir) - call(["ino", "init"]) - - shutil.copytree("../../PubSubClient", "lib/PubSubClient") - - filenames = [] - for root, dirs, files in os.walk(self.examples_dir): - filenames += [os.path.join(root, f) for f in files if f.endswith(".ino")] - filenames.sort() - for e in filenames: - self.examples.append(Sketch(self, e)) - - filenames = [] - for root, dirs, files in os.walk(self.tests_dir): - filenames += [os.path.join(root, f) for f in files if f.endswith(".ino")] - filenames.sort() - for e in filenames: - self.tests.append(Sketch(self, e)) - - def clean(self): - shutil.rmtree(self.build_dir) - - -class Sketch(object): - def __init__(self, wksp, fn): - self.w = wksp - self.filename = fn - self.basename = os.path.basename(self.filename) - self.build_log = os.path.join(self.w.log_dir, "%s.log" % (os.path.basename(self.filename),)) - self.build_err_log = os.path.join(self.w.log_dir, "%s.err.log" % (os.path.basename(self.filename),)) - self.build_upload_log = os.path.join(self.w.log_dir, "%s.upload.log" % (os.path.basename(self.filename),)) - - def build(self): - sys.stdout.write(" Build: ") - sys.stdout.flush() - - # Copy sketch over, replacing IP addresses as necessary - fin = open(self.filename, "r") - lines = fin.readlines() - fin.close() - fout = open(os.path.join(self.w.build_dir, "src", "sketch.ino"), "w") - for l in lines: - if re.match(r"^byte server\[\] = {", l): - fout.write("byte server[] = { %s };\n" % (settings.server_ip.replace(".", ", "),)) - elif re.match(r"^byte ip\[\] = {", l): - fout.write("byte ip[] = { %s };\n" % (settings.arduino_ip.replace(".", ", "),)) - else: - fout.write(l) - fout.flush() - fout.close() - - # Run build - fout = open(self.build_log, "w") - ferr = open(self.build_err_log, "w") - rc = call(["ino", "build"], stdout=fout, stderr=ferr) - fout.close() - ferr.close() - if rc == 0: - sys.stdout.write("pass") - sys.stdout.write("\n") - return True - else: - sys.stdout.write("fail") - sys.stdout.write("\n") - with open(self.build_err_log) as f: - for line in f: - print(" " + line) - return False - - def upload(self): - sys.stdout.write(" Upload: ") - sys.stdout.flush() - fout = open(self.build_upload_log, "w") - rc = call(["ino", "upload"], stdout=fout, stderr=fout) - fout.close() - if rc == 0: - sys.stdout.write("pass") - sys.stdout.write("\n") - return True - else: - sys.stdout.write("fail") - sys.stdout.write("\n") - with open(self.build_upload_log) as f: - for line in f: - print(" " + line) - return False - - def test(self): - # import the matching test case, if it exists - try: - basename = os.path.basename(self.filename)[:-4] - i = importlib.import_module("testcases." + basename) - except: - sys.stdout.write(" Test: no tests found") - sys.stdout.write("\n") - return - c = getattr(i, basename) - - testmethods = [m for m in dir(c) if m.startswith("test_")] - testmethods.sort() - tests = [] - for m in testmethods: - tests.append(c(m)) - - result = unittest.TestResult() - c.setUpClass() - if self.upload(): - sys.stdout.write(" Test: ") - sys.stdout.flush() - for t in tests: - t.run(result) - print(str(result.testsRun - len(result.failures) - len(result.errors)) + "/" + str(result.testsRun)) - if not result.wasSuccessful(): - if len(result.failures) > 0: - for f in result.failures: - print("-- " + str(f[0])) - print(f[1]) - if len(result.errors) > 0: - print(" Errors:") - for f in result.errors: - print("-- " + str(f[0])) - print(f[1]) - c.tearDownClass() - - -if __name__ == '__main__': - run_tests = True - - w = Workspace() - w.init() - - for e in w.examples: - print("--------------------------------------") - print("[" + e.basename + "]") - if e.build() and run_tests: - e.test() - for e in w.tests: - print("--------------------------------------") - print("[" + e.basename + "]") - if e.build() and run_tests: - e.test() - - w.clean() diff --git a/src/Afterburner.cpp b/src/Afterburner.cpp index 296ab00..4b48c25 100644 --- a/src/Afterburner.cpp +++ b/src/Afterburner.cpp @@ -157,7 +157,6 @@ void heaterOff(); void updateFilteredData(); bool HandleMQTTsetup(char rxVal); void showMainmenu(); -void showMQTTmenu(); // DS18B20 temperature sensor support // Uses the RMT timeslot driver to operate as a one-wire bus diff --git a/src/Bluetooth/BluetoothHC05.cpp b/src/Bluetooth/BluetoothHC05.cpp index 12a0158..729a01a 100644 --- a/src/Bluetooth/BluetoothHC05.cpp +++ b/src/Bluetooth/BluetoothHC05.cpp @@ -28,7 +28,7 @@ // Bluetooth access via HC-05 Module, using a UART - +#if USE_HC05_BLUETOOTH == 1 CBluetoothHC05::CBluetoothHC05(int keyPin, int sensePin) { // extra control pins required to fully drive a HC05 module @@ -377,3 +377,5 @@ CBluetoothHC05::decodeMACresponse(char* pResponse, int len) *--pDest = 0; // step back and replace last colon with the null terminator! } } + +#endif \ No newline at end of file diff --git a/src/OLED/BTScreen.h b/src/OLED/BTScreen.h index 1958903..4614330 100644 --- a/src/OLED/BTScreen.h +++ b/src/OLED/BTScreen.h @@ -35,7 +35,8 @@ public: bool show(); bool keyHandler(uint8_t event); private: - int _rowSel, _colSel; + int _rowSel; + int _colSel; void _initUI(); }; diff --git a/src/OLED/BasicScreen.cpp b/src/OLED/BasicScreen.cpp index 9a950f4..874e261 100644 --- a/src/OLED/BasicScreen.cpp +++ b/src/OLED/BasicScreen.cpp @@ -180,8 +180,6 @@ CBasicScreen::show() if(bShowLargeTemp) { float fTemp = getTemperatureSensor(0); // Primary system sensor - the one used for thermostat modes -// float fTemp = getTemperatureSensor(0); // DHT22 or DS18B20 - // fTemp = getTemperatureSensor(1); // BMP180 if(fTemp > -80) { if(NVstore.getUserSettings().degF) { fTemp = fTemp * 9 / 5 + 32; diff --git a/src/OLED/DS18B20Screen.cpp b/src/OLED/DS18B20Screen.cpp index 9ba61c6..9c834fa 100644 --- a/src/OLED/DS18B20Screen.cpp +++ b/src/OLED/DS18B20Screen.cpp @@ -152,121 +152,105 @@ CDS18B20Screen::keyHandler(uint8_t event) _rowSel = 1; _keyHold = -1; } + return true; } - else { - sUserSettings us; - if(event & keyPressed) { - _keyHold = 0; - // DOWN press - if(event & key_Down) { - _testCancel(); - if(_rowSel == 0 && getTempSensor().getBME280().getCount()) { - _ScreenManager.returnMenu(); - } - if(_rowSel == SaveConfirm) - _rowSel = 0; - _rowSel--; - LOWERLIMIT(_rowSel, 0); + sUserSettings us; + if(event & keyPressed) { + _keyHold = 0; + // DOWN press + if(event & key_Down) { + _testCancel(); + if(_rowSel == 0 && getTempSensor().getBME280().getCount()) { + _ScreenManager.returnMenu(); } + if(_rowSel == SaveConfirm) + _rowSel = 0; + _rowSel--; + LOWERLIMIT(_rowSel, 0); } + } - if(event & keyRepeat) { - if(_keyHold >= 0) { - _keyHold++; - if(_keyHold == 2) { - if(event & key_Up) { - // rescan the one wire bus - getTempSensor().getDS18B20().find(); - _nNumSensors = getTempSensor().getDS18B20().getNumSensors(); - _readNV(); - } - if(event & key_Left) { - _colSel = 0; - _scrollChar = 0; - } - if(event & key_Right) { - _testCancel(); - _colSel = 1; - _scrollChar = 0; - } - if(event & key_Centre) { - if(_colSel == 0) - _sensorRole[_rowSel-1] = -1; - else - _Offset[_rowSel-1] = 0; - } - _keyHold = -1; - } - } - } - - - if(event & keyReleased) { - if(_keyHold == 0) { - // UP release + if(event & keyRepeat) { + if(_keyHold >= 0) { + _keyHold++; + if(_keyHold == 2) { if(event & key_Up) { - if(_rowSel == SaveConfirm) { - _enableStoringMessage(); - _saveNV(); - NVstore.save(); - getTempSensor().getDS18B20().mapSensor(-1); // reset existing mapping - getTempSensor().getDS18B20().mapSensor(0, NVstore.getHeaterTuning().DS18B20probe[0].romCode); - getTempSensor().getDS18B20().mapSensor(1, NVstore.getHeaterTuning().DS18B20probe[1].romCode); - getTempSensor().getDS18B20().mapSensor(2, NVstore.getHeaterTuning().DS18B20probe[2].romCode); - getTempSensor().getDS18B20().mapSensor(-2); // report mapping - _rowSel = 0; + // rescan the one wire bus + getTempSensor().getDS18B20().find(); + _nNumSensors = getTempSensor().getDS18B20().getNumSensors(); + _readNV(); + } + if(event & key_Left) { + _colSel = 0; + _scrollChar = 0; + } + if(event & key_Right) { + _testCancel(); + _colSel = 1; + _scrollChar = 0; + } + if(event & key_Centre) { + if(_colSel == 0) + _sensorRole[_rowSel-1] = -1; + else + _Offset[_rowSel-1] = 0; + } + _keyHold = -1; + } + } + } + + + if(event & keyReleased) { + if(_keyHold == 0) { + // UP release + if(event & key_Up) { + if(_rowSel == 0) { + _getPassword(); + if(_isPasswordOK()) { + _rowSel = 1; + } } else { - if(_rowSel == 0) { - _getPassword(); - if(_isPasswordOK()) { - _rowSel = 1; - } - } - else { - _testCancel(); - _rowSel++; - UPPERLIMIT(_rowSel, 3); - } + _testCancel(); + _rowSel++; + UPPERLIMIT(_rowSel, 3); } + } + // LEFT press + if(event & key_Left) { + if(_rowSel == 0) + _ScreenManager.prevMenu(); + else + adjust(-1); + } + // RIGHT press + if(event & key_Right) { + if(_rowSel == 0) + _ScreenManager.nextMenu(); + else + adjust(+1); + } + // CENTRE press + if(event & key_Centre) { + if(_rowSel == 0) { + if(getTempSensor().getBME280().getCount()) + _ScreenManager.returnMenu(); + else + _ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // force return to main menu } - // LEFT press - if(event & key_Left) { - if(_rowSel == 0) - _ScreenManager.prevMenu(); - else - adjust(-1); - } - // RIGHT press - if(event & key_Right) { - if(_rowSel == 0) - _ScreenManager.nextMenu(); - else - adjust(+1); - } - // CENTRE press - if(event & key_Centre) { - if(_rowSel == 0) { -// _ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // force return to main menu -// _ScreenManager.selectMenu(CScreenManager::SystemSettingsLoop, CScreenManager::TempSensorUI); // force return to user settings menu - if(getTempSensor().getBME280().getCount()) - _ScreenManager.returnMenu(); - else - _ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // force return to main menu - } - else { - _rowSel = SaveConfirm; - } + else { + _rowSel = SaveConfirm; } } - _keyHold = -1; } - - _ScreenManager.reqUpdate(); + _keyHold = -1; } + _ScreenManager.reqUpdate(); + return true; } @@ -378,4 +362,12 @@ CDS18B20Screen::_saveNV() } } NVstore.setHeaterTuning(tuning); + NVstore.save(); + + getTempSensor().getDS18B20().mapSensor(-1); // reset existing mapping + getTempSensor().getDS18B20().mapSensor(0, NVstore.getHeaterTuning().DS18B20probe[0].romCode); + getTempSensor().getDS18B20().mapSensor(1, NVstore.getHeaterTuning().DS18B20probe[1].romCode); + getTempSensor().getDS18B20().mapSensor(2, NVstore.getHeaterTuning().DS18B20probe[2].romCode); + getTempSensor().getDS18B20().mapSensor(-2); // report mapping + } \ No newline at end of file diff --git a/src/OLED/DS18B20Screen.h b/src/OLED/DS18B20Screen.h index 6e0f9a3..7cf131e 100644 --- a/src/OLED/DS18B20Screen.h +++ b/src/OLED/DS18B20Screen.h @@ -31,9 +31,9 @@ class CScreenManager; class CDS18B20Screen : public CPasswordScreen { - int _rowSel, _colSel; + int _colSel; int _keyHold; - int _scrollChar; + int _scrollChar; int _nNumSensors; int _sensorRole[3]; float _Offset[3]; diff --git a/src/OLED/FontDumpScreen.cpp b/src/OLED/FontDumpScreen.cpp deleted file mode 100644 index b6ee55d..0000000 --- a/src/OLED/FontDumpScreen.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the "bluetoothheater" distribution - * (https://gitlab.com/mrjones.id.au/bluetoothheater) - * - * Copyright (C) 2018 Ray Jones - * - * 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 . - * - */ - -#include "128x64OLED.h" -#include "FontDumpScreen.h" -#include "KeyPad.h" - -/////////////////////////////////////////////////////////////////////////// -// -// CFontDumpScreen -// -// This screen provides control over experimental features -// -/////////////////////////////////////////////////////////////////////////// - -static const int Lines[4] = { 24, 34, 44, 54 }; - -CFontDumpScreen::CFontDumpScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr) -{ - _initUI(); -} - -void -CFontDumpScreen::onSelect() -{ - CScreen::onSelect(); -} - -void -CFontDumpScreen::_initUI() -{ - _startChar = 0; -} - -bool -CFontDumpScreen::show() -{ - _display.clearDisplay(); - - char msg[8]; - - _printInverted(_display.xCentre(), 0, " Adafruit Font ", true, eCentreJustify); - int column = 15; - for(int i=0; i<16; i++) { - sprintf(msg, "%X", i); - _printMenuText(column, 12, msg); - column += 7; - } - for(int row = 0; row < 4; row++) { - int currentChar = row * 16 + _startChar; - sprintf(msg, "%02X", currentChar); - _printMenuText(0, Lines[row], msg); - column = 15; - for(int i=0; i<16; i++) { - msg[0] = currentChar++; - msg[1] = 0; - _printMenuText(column, Lines[row], msg); - column += 7; - } - } - _display.drawFastVLine(13, 12, 61, WHITE); - _display.drawFastHLine(0, 21, 128, WHITE); - - return true; -} - - -bool -CFontDumpScreen::keyHandler(uint8_t event) -{ - if(event & keyPressed) { - // press LEFT or UP to show prior 64 characters - if(event & (key_Left | key_Up)) { - _startChar -= 64; - } - // press RIGHT or DOWN to show next 64 characters - if(event & (key_Right | key_Down)) { - _startChar += 64; - } - // CENTRE press - if(event & key_Centre) { - _ScreenManager.selectMenu(CScreenManager::UserSettingsLoop, CScreenManager::ExThermostatUI); // force return to prior menu - } - _ScreenManager.reqUpdate(); - } - - return true; -} - diff --git a/src/OLED/FontDumpScreen.h b/src/OLED/FontDumpScreen.h deleted file mode 100644 index d8c8ee3..0000000 --- a/src/OLED/FontDumpScreen.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of the "bluetoothheater" distribution - * (https://gitlab.com/mrjones.id.au/bluetoothheater) - * - * Copyright (C) 2018 Ray Jones - * - * 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 . - * - */ - -#ifndef __FONTDUMPSCREEN_H__ -#define __FONTDUMPSCREEN_H__ - -#include -#include "Screen.h" - -class C128x64_OLED; -class CScreenManager; - -class CFontDumpScreen : public CScreen -{ - uint8_t _startChar; - void _initUI(); -public: - CFontDumpScreen(C128x64_OLED& display, CScreenManager& mgr); - bool show(); - bool keyHandler(uint8_t event); - void onSelect(); -}; - -#endif diff --git a/src/OLED/FrostScreen.h b/src/OLED/FrostScreen.h index fb9d7c4..a7460ee 100644 --- a/src/OLED/FrostScreen.h +++ b/src/OLED/FrostScreen.h @@ -31,7 +31,6 @@ class CScreenManager; class CFrostScreen : public CPasswordScreen { -// int _rowSel; int _scrollChar; uint8_t _frostOn; uint8_t _frostRise; diff --git a/src/OLED/MQTTScreen.h b/src/OLED/MQTTScreen.h index a663126..ecb3e97 100644 --- a/src/OLED/MQTTScreen.h +++ b/src/OLED/MQTTScreen.h @@ -36,7 +36,8 @@ public: bool animate(); bool keyHandler(uint8_t event); private: - int _rowSel, _colSel; + int _rowSel; + int _colSel; int _repeatCount; void _initUI(); }; diff --git a/src/OLED/MenuTrunkScreen.h b/src/OLED/MenuTrunkScreen.h index d1e8c7a..859bbf5 100644 --- a/src/OLED/MenuTrunkScreen.h +++ b/src/OLED/MenuTrunkScreen.h @@ -35,7 +35,8 @@ public: bool show(); bool keyHandler(uint8_t event); private: - int _rowSel, _colSel; + int _rowSel; + int _colSel; void _initUI(); }; diff --git a/src/OLED/ScreenManager.cpp b/src/OLED/ScreenManager.cpp index 0341446..0c22534 100644 --- a/src/OLED/ScreenManager.cpp +++ b/src/OLED/ScreenManager.cpp @@ -33,7 +33,6 @@ #include "FuelCalScreen.h" #include "SettingsScreen.h" #include "ThermostatModeScreen.h" -#include "FontDumpScreen.h" #include "TimerChartScreen.h" #include "InheritSettingsScreen.h" #include "GPIOInfoScreen.h" @@ -508,7 +507,6 @@ CScreenManager::_loadScreens() menuloop.clear(); menuloop.push_back(new CSetClockScreen(*_pDisplay, *this)); // clock set branch screen menuloop.push_back(new CInheritSettingsScreen(*_pDisplay, *this)); // inherit OEM settings branch screen - menuloop.push_back(new CFontDumpScreen(*_pDisplay, *this)); // font dump branch screen menuloop.push_back(new CSettingsScreen(*_pDisplay, *this)); // Tuning info menuloop.push_back(new CDS18B20Screen(*_pDisplay, *this)); _Screens.push_back(menuloop); diff --git a/src/OLED/ScreenManager.h b/src/OLED/ScreenManager.h index 2caab6c..f522c72 100644 --- a/src/OLED/ScreenManager.h +++ b/src/OLED/ScreenManager.h @@ -56,7 +56,7 @@ public: Timer8UI, Timer9UI, Timer10UI, Timer11UI, Timer12UI, Timer13UI, Timer14UI }; enum eUITuningMenus { MixtureUI, HeaterSettingsUI, FuelCalUI }; enum eUIUserSettingsMenus { ExThermostatUI, FrostUI, HomeMenuUI, TimeIntervalsUI, TempSensorUI, GPIOUI }; - enum eUIBranchMenus { SetClockUI, InheritSettingsUI, FontDumpUI, HtrSettingsUI, DS18B20UI }; + enum eUIBranchMenus { SetClockUI, InheritSettingsUI, HtrSettingsUI, DS18B20UI }; enum eUISystemSettingsMenus { SysVerUI, SysHoursUI, SysWifiUI, SysBTUI }; public: CScreenManager(); diff --git a/src/OLED/TempSensorScreen.h b/src/OLED/TempSensorScreen.h index 208fbb1..1e7b0a3 100644 --- a/src/OLED/TempSensorScreen.h +++ b/src/OLED/TempSensorScreen.h @@ -31,7 +31,7 @@ class CScreenManager; class CTempSensorScreen : public CPasswordScreen { - int _rowSel, _colSel; + int _colSel; int _keyHold; int _scrollChar; // int _nNumSensors; diff --git a/src/OLED/ThermostatModeScreen.cpp b/src/OLED/ThermostatModeScreen.cpp index f5692bb..3c4d143 100644 --- a/src/OLED/ThermostatModeScreen.cpp +++ b/src/OLED/ThermostatModeScreen.cpp @@ -19,7 +19,6 @@ * */ -//#include "128x64OLED.h" #include "ThermostatModeScreen.h" #include "KeyPad.h" #include "../Utility/helpers.h" @@ -266,12 +265,6 @@ CThermostatModeScreen::keyHandler(uint8_t event) } if(event & keyRepeat) { _keyRepeat++; - if((event & key_Down) && (keyRepeat >= 4)) { - _keyRepeat = -1; - if(_rowSel == 0) { - _ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::FontDumpUI); - } - } if(_rowSel == 3) { if(event & key_Right) { _adjust(+1); diff --git a/src/OLED/WiFiScreen.h b/src/OLED/WiFiScreen.h index d3b8773..59afd88 100644 --- a/src/OLED/WiFiScreen.h +++ b/src/OLED/WiFiScreen.h @@ -36,7 +36,9 @@ public: bool animate(); bool keyHandler(uint8_t event); private: - int _rowSel, _colSel, _OTAsel; + int _rowSel; + int _colSel; + int _OTAsel; int _repeatCount; bool _bShowMAC; void _initUI(); diff --git a/src/OLED/fonts/Arial.c b/src/OLED/fonts/Arial.c index c728ffb..912d575 100644 --- a/src/OLED/fonts/Arial.c +++ b/src/OLED/fonts/Arial.c @@ -797,687 +797,6 @@ const FONT_INFO arial_8ptFontInfo = -// -// Font data for Arial 7pt -// - -// Character bitmaps for Arial 7pt -const uint8_t PROGMEM arial_7ptBitmaps [] = -{ - // @0 ' ' (2 pixels wide) - 0x00, 0x00, // - 0x00, 0x00, // - - // @4 '!' (1 pixels wide) - 0x3E, 0x80, // ##### # - - // @6 '"' (3 pixels wide) - 0x30, 0x00, // ## - 0x00, 0x00, // - 0x30, 0x00, // ## - - // @12 '#' (4 pixels wide) - 0x0B, 0x80, // # ### - 0x3E, 0x00, // ##### - 0x0B, 0x80, // # ### - 0x3E, 0x00, // ##### - - // @20 '$' (5 pixels wide) - 0x19, 0x00, // ## # - 0x24, 0x80, // # # # - 0x3F, 0xC0, // ######## - 0x24, 0x80, // # # # - 0x13, 0x00, // # ## - - // @30 '%' (6 pixels wide) - 0x10, 0x00, // # - 0x28, 0x00, // # # - 0x13, 0x80, // # ### - 0x1D, 0x00, // ### # - 0x22, 0x80, // # # # - 0x01, 0x00, // # - - // @42 '&' (6 pixels wide) - 0x03, 0x00, // ## - 0x1C, 0x80, // ### # - 0x24, 0x80, // # # # - 0x26, 0x80, // # ## # - 0x39, 0x00, // ### # - 0x02, 0x80, // # # - - // @54 ''' (1 pixels wide) - 0x30, 0x00, // ## - - // @56 '(' (3 pixels wide) - 0x0F, 0x80, // ##### - 0x10, 0x40, // # # - 0x20, 0x20, // # # - - // @62 ')' (3 pixels wide) - 0x20, 0x20, // # # - 0x10, 0x40, // # # - 0x0F, 0x80, // ##### - - // @68 '*' (3 pixels wide) - 0x28, 0x00, // # # - 0x30, 0x00, // ## - 0x28, 0x00, // # # - - // @74 '+' (5 pixels wide) - 0x02, 0x00, // # - 0x02, 0x00, // # - 0x0F, 0x80, // ##### - 0x02, 0x00, // # - 0x02, 0x00, // # - - // @84 ',' (1 pixels wide) - 0x00, 0xC0, // ## - - // @86 '-' (2 pixels wide) - 0x02, 0x00, // # - 0x02, 0x00, // # - - // @90 '.' (1 pixels wide) - 0x00, 0x80, // # - - // @92 '/' (3 pixels wide) - 0x01, 0x80, // ## - 0x0E, 0x00, // ### - 0x30, 0x00, // ## - - // @98 '0' (4 pixels wide) - 0x1F, 0x80, // ###### - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x1F, 0x00, // ##### - - // @106 '1' (2 pixels wide) - 0x10, 0x00, // # - 0x3F, 0x80, // ####### - - // @110 '2' (4 pixels wide) - 0x10, 0x80, // # # - 0x21, 0x80, // # ## - 0x26, 0x80, // # ## # - 0x18, 0x80, // ## # - - // @118 '3' (4 pixels wide) - 0x11, 0x00, // # # - 0x20, 0x80, // # # - 0x24, 0x80, // # # # - 0x1B, 0x00, // ## ## - - // @126 '4' (5 pixels wide) - 0x06, 0x00, // ## - 0x0A, 0x00, // # # - 0x12, 0x00, // # # - 0x3F, 0x80, // ####### - 0x02, 0x00, // # - - // @136 '5' (4 pixels wide) - 0x0D, 0x00, // ## # - 0x38, 0x80, // ### # - 0x28, 0x80, // # # # - 0x27, 0x00, // # ### - - // @144 '6' (4 pixels wide) - 0x1F, 0x00, // ##### - 0x28, 0x80, // # # # - 0x28, 0x80, // # # # - 0x17, 0x00, // # ### - - // @152 '7' (4 pixels wide) - 0x20, 0x00, // # - 0x23, 0x80, // # ### - 0x2C, 0x00, // # ## - 0x30, 0x00, // ## - - // @160 '8' (4 pixels wide) - 0x1B, 0x00, // ## ## - 0x24, 0x80, // # # # - 0x24, 0x80, // # # # - 0x1B, 0x00, // ## ## - - // @168 '9' (4 pixels wide) - 0x1D, 0x00, // ### # - 0x22, 0x80, // # # # - 0x22, 0x80, // # # # - 0x1F, 0x00, // ##### - - // @176 ':' (1 pixels wide) - 0x08, 0x80, // # # - - // @178 ';' (1 pixels wide) - 0x08, 0xC0, // # ## - - // @180 '<' (3 pixels wide) - 0x04, 0x00, // # - 0x0A, 0x00, // # # - 0x11, 0x00, // # # - - // @186 '=' (4 pixels wide) - 0x0A, 0x00, // # # - 0x0A, 0x00, // # # - 0x0A, 0x00, // # # - 0x0A, 0x00, // # # - - // @194 '>' (3 pixels wide) - 0x11, 0x00, // # # - 0x0A, 0x00, // # # - 0x04, 0x00, // # - - // @200 '?' (5 pixels wide) - 0x10, 0x00, // # - 0x20, 0x00, // # - 0x26, 0x80, // # ## # - 0x24, 0x00, // # # - 0x18, 0x00, // ## - - // @210 '@' (8 pixels wide) - 0x0F, 0x80, // ##### - 0x10, 0x40, // # # - 0x27, 0xA0, // # #### # - 0x28, 0xA0, // # # # # - 0x27, 0xA0, // # #### # - 0x2C, 0xA0, // # ## # # - 0x11, 0x40, // # # # - 0x0E, 0x40, // ### # - - // @226 'A' (7 pixels wide) - 0x00, 0x80, // # - 0x07, 0x00, // ### - 0x1A, 0x00, // ## # - 0x22, 0x00, // # # - 0x1A, 0x00, // ## # - 0x07, 0x00, // ### - 0x00, 0x80, // # - - // @240 'B' (4 pixels wide) - 0x3F, 0x80, // ####### - 0x24, 0x80, // # # # - 0x24, 0x80, // # # # - 0x1F, 0x00, // ##### - - // @248 'C' (5 pixels wide) - 0x1F, 0x00, // ##### - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x11, 0x00, // # # - - // @258 'D' (5 pixels wide) - 0x3F, 0x80, // ####### - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x1F, 0x00, // ##### - - // @268 'E' (5 pixels wide) - 0x3F, 0x80, // ####### - 0x24, 0x80, // # # # - 0x24, 0x80, // # # # - 0x24, 0x80, // # # # - 0x24, 0x80, // # # # - - // @278 'F' (4 pixels wide) - 0x3F, 0x80, // ####### - 0x24, 0x00, // # # - 0x24, 0x00, // # # - 0x20, 0x00, // # - - // @286 'G' (5 pixels wide) - 0x1F, 0x00, // ##### - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x24, 0x80, // # # # - 0x17, 0x00, // # ### - - // @296 'H' (5 pixels wide) - 0x3F, 0x80, // ####### - 0x04, 0x00, // # - 0x04, 0x00, // # - 0x04, 0x00, // # - 0x3F, 0x80, // ####### - - // @306 'I' (1 pixels wide) - 0x3F, 0x80, // ####### - - // @308 'J' (4 pixels wide) - 0x01, 0x80, // ## - 0x00, 0x80, // # - 0x00, 0x80, // # - 0x3F, 0x00, // ###### - - // @316 'K' (5 pixels wide) - 0x3F, 0x80, // ####### - 0x04, 0x00, // # - 0x0A, 0x00, // # # - 0x11, 0x00, // # # - 0x20, 0x80, // # # - - // @326 'L' (4 pixels wide) - 0x3F, 0x80, // ####### - 0x00, 0x80, // # - 0x00, 0x80, // # - 0x00, 0x80, // # - - // @334 'M' (7 pixels wide) - 0x3F, 0x80, // ####### - 0x18, 0x00, // ## - 0x07, 0x00, // ### - 0x00, 0x80, // # - 0x07, 0x00, // ### - 0x18, 0x00, // ## - 0x3F, 0x80, // ####### - - // @348 'N' (5 pixels wide) - 0x3F, 0x80, // ####### - 0x18, 0x00, // ## - 0x04, 0x00, // # - 0x03, 0x00, // ## - 0x3F, 0x80, // ####### - - // @358 'O' (5 pixels wide) - 0x1F, 0x00, // ##### - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x1F, 0x00, // ##### - - // @368 'P' (4 pixels wide) - 0x3F, 0x80, // ####### - 0x24, 0x00, // # # - 0x24, 0x00, // # # - 0x3C, 0x00, // #### - - // @376 'Q' (5 pixels wide) - 0x1F, 0x00, // ##### - 0x20, 0x80, // # # - 0x20, 0x80, // # # - 0x21, 0x80, // # ## - 0x1E, 0x80, // #### # - - // @386 'R' (5 pixels wide) - 0x3F, 0x80, // ####### - 0x24, 0x00, // # # - 0x24, 0x00, // # # - 0x26, 0x00, // # ## - 0x19, 0x80, // ## ## - - // @396 'S' (4 pixels wide) - 0x19, 0x00, // ## # - 0x24, 0x80, // # # # - 0x24, 0x80, // # # # - 0x13, 0x00, // # ## - - // @404 'T' (5 pixels wide) - 0x20, 0x00, // # - 0x20, 0x00, // # - 0x3F, 0x80, // ####### - 0x20, 0x00, // # - 0x20, 0x00, // # - - // @414 'U' (5 pixels wide) - 0x3F, 0x00, // ###### - 0x00, 0x80, // # - 0x00, 0x80, // # - 0x00, 0x80, // # - 0x3F, 0x00, // ###### - - // @424 'V' (7 pixels wide) - 0x30, 0x00, // ## - 0x0C, 0x00, // ## - 0x03, 0x00, // ## - 0x00, 0x80, // # - 0x03, 0x00, // ## - 0x0C, 0x00, // ## - 0x30, 0x00, // ## - - // @438 'W' (9 pixels wide) - 0x30, 0x00, // ## - 0x0F, 0x00, // #### - 0x00, 0x80, // # - 0x1F, 0x00, // ##### - 0x20, 0x00, // # - 0x1F, 0x00, // ##### - 0x00, 0x80, // # - 0x0F, 0x00, // #### - 0x30, 0x00, // ## - - // @456 'X' (5 pixels wide) - 0x20, 0x80, // # # - 0x1B, 0x00, // ## ## - 0x04, 0x00, // # - 0x1B, 0x00, // ## ## - 0x20, 0x80, // # # - - // @466 'Y' (5 pixels wide) - 0x20, 0x00, // # - 0x18, 0x00, // ## - 0x07, 0x80, // #### - 0x18, 0x00, // ## - 0x20, 0x00, // # - - // @476 'Z' (6 pixels wide) - 0x21, 0x80, // # ## - 0x22, 0x80, // # # # - 0x24, 0x80, // # # # - 0x28, 0x80, // # # # - 0x30, 0x80, // ## # - 0x20, 0x80, // # # - - // @488 '[' (2 pixels wide) - 0x3F, 0xE0, // ######### - 0x20, 0x20, // # # - - // @492 '\' (3 pixels wide) - 0x30, 0x00, // ## - 0x0E, 0x00, // ### - 0x01, 0x80, // ## - - // @498 ']' (2 pixels wide) - 0x20, 0x20, // # # - 0x3F, 0xE0, // ######### - - // @502 '^' (3 pixels wide) - 0x18, 0x00, // ## - 0x20, 0x00, // # - 0x18, 0x00, // ## - - // @508 '_' (5 pixels wide) - 0x00, 0x20, // # - 0x00, 0x20, // # - 0x00, 0x20, // # - 0x00, 0x20, // # - 0x00, 0x20, // # - - // @518 '`' (2 pixels wide) - 0x20, 0x00, // # - 0x10, 0x00, // # - - // @522 'a' (4 pixels wide) - 0x09, 0x80, // # ## - 0x0A, 0x80, // # # # - 0x0A, 0x80, // # # # - 0x0F, 0x80, // ##### - - // @530 'b' (4 pixels wide) - 0x3F, 0x80, // ####### - 0x08, 0x80, // # # - 0x08, 0x80, // # # - 0x07, 0x00, // ### - - // @538 'c' (4 pixels wide) - 0x07, 0x00, // ### - 0x08, 0x80, // # # - 0x08, 0x80, // # # - 0x05, 0x00, // # # - - // @546 'd' (4 pixels wide) - 0x07, 0x00, // ### - 0x08, 0x80, // # # - 0x08, 0x80, // # # - 0x3F, 0x80, // ####### - - // @554 'e' (4 pixels wide) - 0x07, 0x00, // ### - 0x0A, 0x80, // # # # - 0x0A, 0x80, // # # # - 0x06, 0x80, // ## # - - // @562 'f' (3 pixels wide) - 0x08, 0x00, // # - 0x1F, 0x80, // ###### - 0x28, 0x00, // # # - - // @568 'g' (4 pixels wide) - 0x07, 0x40, // ### # - 0x08, 0xA0, // # # # - 0x08, 0xA0, // # # # - 0x0F, 0xC0, // ###### - - // @576 'h' (4 pixels wide) - 0x3F, 0x80, // ####### - 0x08, 0x00, // # - 0x08, 0x00, // # - 0x07, 0x80, // #### - - // @584 'i' (1 pixels wide) - 0x2F, 0x80, // # ##### - - // @586 'j' (2 pixels wide) - 0x00, 0x20, // # - 0x2F, 0xC0, // # ###### - - // @590 'k' (4 pixels wide) - 0x3F, 0x80, // ####### - 0x02, 0x00, // # - 0x07, 0x00, // ### - 0x08, 0x80, // # # - - // @598 'l' (1 pixels wide) - 0x3F, 0x80, // ####### - - // @600 'm' (7 pixels wide) - 0x0F, 0x80, // ##### - 0x08, 0x00, // # - 0x08, 0x00, // # - 0x0F, 0x80, // ##### - 0x08, 0x00, // # - 0x08, 0x00, // # - 0x07, 0x80, // #### - - // @614 'n' (4 pixels wide) - 0x0F, 0x80, // ##### - 0x08, 0x00, // # - 0x08, 0x00, // # - 0x07, 0x80, // #### - - // @622 'o' (4 pixels wide) - 0x07, 0x00, // ### - 0x08, 0x80, // # # - 0x08, 0x80, // # # - 0x07, 0x00, // ### - - // @630 'p' (4 pixels wide) - 0x0F, 0xE0, // ####### - 0x08, 0x80, // # # - 0x08, 0x80, // # # - 0x07, 0x00, // ### - - // @638 'q' (4 pixels wide) - 0x07, 0x00, // ### - 0x08, 0x80, // # # - 0x08, 0x80, // # # - 0x0F, 0xE0, // ####### - - // @646 'r' (3 pixels wide) - 0x0F, 0x80, // ##### - 0x08, 0x00, // # - 0x08, 0x00, // # - - // @652 's' (4 pixels wide) - 0x04, 0x80, // # # - 0x0A, 0x80, // # # # - 0x0A, 0x80, // # # # - 0x09, 0x00, // # # - - // @660 't' (3 pixels wide) - 0x08, 0x00, // # - 0x1F, 0x80, // ###### - 0x08, 0x80, // # # - - // @666 'u' (4 pixels wide) - 0x0F, 0x00, // #### - 0x00, 0x80, // # - 0x00, 0x80, // # - 0x0F, 0x80, // ##### - - // @674 'v' (5 pixels wide) - 0x08, 0x00, // # - 0x07, 0x00, // ### - 0x00, 0x80, // # - 0x07, 0x00, // ### - 0x08, 0x00, // # - - // @684 'w' (5 pixels wide) - 0x0F, 0x00, // #### - 0x00, 0x80, // # - 0x0F, 0x00, // #### - 0x00, 0x80, // # - 0x0F, 0x00, // #### - - // @694 'x' (4 pixels wide) - 0x08, 0x80, // # # - 0x07, 0x00, // ### - 0x07, 0x00, // ### - 0x08, 0x80, // # # - - // @702 'y' (5 pixels wide) - 0x08, 0x00, // # - 0x07, 0x20, // ### # - 0x00, 0xC0, // ## - 0x07, 0x00, // ### - 0x08, 0x00, // # - - // @712 'z' (3 pixels wide) - 0x09, 0x80, // # ## - 0x0A, 0x80, // # # # - 0x0C, 0x80, // ## # - - // @718 '{' (3 pixels wide) - 0x02, 0x00, // # - 0x3D, 0xE0, // #### #### - 0x20, 0x20, // # # - - // @724 '|' (1 pixels wide) - 0x3F, 0xC0, // ######## - - // @726 '}' (3 pixels wide) - 0x20, 0x20, // # # - 0x3D, 0xE0, // #### #### - 0x02, 0x00, // # - - // @732 '~' (4 pixels wide) - 0x06, 0x00, // ## - 0x04, 0x00, // # - 0x02, 0x00, // # - 0x06, 0x00, // ## -}; - -// Character descriptors for Arial 7pt -// { [Char width in bits], [Char height in bits], [Offset into arial_7ptCharBitmaps in bytes] } -const FONT_CHAR_INFO PROGMEM arial_7ptDescriptors[] = -{ - {1, 12, 0}, // ' ' - {1, 12, 4}, // '!' - {3, 12, 6}, // '"' - {4, 12, 12}, // '#' - {5, 12, 20}, // '$' - {6, 12, 30}, // '%' - {6, 12, 42}, // '&' - {1, 12, 54}, // ''' - {3, 12, 56}, // '(' - {3, 12, 62}, // ')' - {3, 12, 68}, // '*' - {5, 12, 74}, // '+' - {1, 12, 84}, // ',' - {2, 12, 86}, // '-' - {1, 12, 90}, // '.' - {3, 12, 92}, // '/' - {4, 12, 98}, // '0' - {2, 12, 106}, // '1' - {4, 12, 110}, // '2' - {4, 12, 118}, // '3' - {5, 12, 126}, // '4' - {4, 12, 136}, // '5' - {4, 12, 144}, // '6' - {4, 12, 152}, // '7' - {4, 12, 160}, // '8' - {4, 12, 168}, // '9' - {1, 12, 176}, // ':' - {1, 12, 178}, // ';' - {3, 12, 180}, // '<' - {4, 12, 186}, // '=' - {3, 12, 194}, // '>' - {5, 12, 200}, // '?' - {8, 12, 210}, // '@' - {7, 12, 226}, // 'A' - {4, 12, 240}, // 'B' - {5, 12, 248}, // 'C' - {5, 12, 258}, // 'D' - {5, 12, 268}, // 'E' - {4, 12, 278}, // 'F' - {5, 12, 286}, // 'G' - {5, 12, 296}, // 'H' - {1, 12, 306}, // 'I' - {4, 12, 308}, // 'J' - {5, 12, 316}, // 'K' - {4, 12, 326}, // 'L' - {7, 12, 334}, // 'M' - {5, 12, 348}, // 'N' - {5, 12, 358}, // 'O' - {4, 12, 368}, // 'P' - {5, 12, 376}, // 'Q' - {5, 12, 386}, // 'R' - {4, 12, 396}, // 'S' - {5, 12, 404}, // 'T' - {5, 12, 414}, // 'U' - {7, 12, 424}, // 'V' - {9, 12, 438}, // 'W' - {5, 12, 456}, // 'X' - {5, 12, 466}, // 'Y' - {6, 12, 476}, // 'Z' - {2, 12, 488}, // '[' - {3, 12, 492}, // '\' - {2, 12, 498}, // ']' - {3, 12, 502}, // '^' - {5, 12, 508}, // '_' - {2, 12, 518}, // '`' - {4, 12, 522}, // 'a' - {4, 12, 530}, // 'b' - {4, 12, 538}, // 'c' - {4, 12, 546}, // 'd' - {4, 12, 554}, // 'e' - {3, 12, 562}, // 'f' - {4, 12, 568}, // 'g' - {4, 12, 576}, // 'h' - {1, 12, 584}, // 'i' - {2, 12, 586}, // 'j' - {4, 12, 590}, // 'k' - {1, 12, 598}, // 'l' - {7, 12, 600}, // 'm' - {4, 12, 614}, // 'n' - {4, 12, 622}, // 'o' - {4, 12, 630}, // 'p' - {4, 12, 638}, // 'q' - {3, 12, 646}, // 'r' - {4, 12, 652}, // 's' - {3, 12, 660}, // 't' - {4, 12, 666}, // 'u' - {5, 12, 674}, // 'v' - {5, 12, 684}, // 'w' - {4, 12, 694}, // 'x' - {5, 12, 702}, // 'y' - {3, 12, 712}, // 'z' - {3, 12, 718}, // '{' - {1, 12, 724}, // '|' - {3, 12, 726}, // '}' - {4, 12, 732}, // '~' -}; - - -// Font information for Arial 7pt -const FONT_INFO arial_7ptFontInfo = -{ - 9, // Character height - ' ', // Start character - '~', // End character - 1, // Width, in pixels, of space character - arial_7ptDescriptors, // Character descriptor array - arial_7ptBitmaps, // Character bitmap array -}; - // // Font data for Arial 8pt @@ -2280,943 +1599,6 @@ const FONT_INFO arial_8ptBoldFontInfo = }; -// -// Font data for Arial 12pt -// - -// Character bitmaps for Arial 12pt -const uint8_t PROGMEM arial_12ptBitmaps [] = -{ - // @0 ' ' (2 pixels wide) - 0x00, 0x00, 0x00, // - 0x00, 0x00, 0x00, // - - // @6 '!' (1 pixels wide) - 0x1F, 0xFA, 0x00, // ########## # - - // @9 '"' (4 pixels wide) - 0x1E, 0x00, 0x00, // #### - 0x00, 0x00, 0x00, // - 0x00, 0x00, 0x00, // - 0x1E, 0x00, 0x00, // #### - - // @21 '#' (9 pixels wide) - 0x01, 0x10, 0x00, // # # - 0x01, 0x1E, 0x00, // # #### - 0x03, 0xF0, 0x00, // ###### - 0x1D, 0x10, 0x00, // ### # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x1E, 0x00, // # #### - 0x03, 0xF0, 0x00, // ###### - 0x1D, 0x10, 0x00, // ### # # - 0x01, 0x10, 0x00, // # # - - // @48 '$' (7 pixels wide) - 0x07, 0x08, 0x00, // ### # - 0x08, 0x84, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x3F, 0xFF, 0x00, // ############## - 0x10, 0x42, 0x00, // # # # - 0x10, 0x44, 0x00, // # # # - 0x0C, 0x38, 0x00, // ## ### - - // @69 '%' (12 pixels wide) - 0x0F, 0x00, 0x00, // #### - 0x10, 0x80, 0x00, // # # - 0x10, 0x80, 0x00, // # # - 0x10, 0x86, 0x00, // # # ## - 0x0F, 0x18, 0x00, // #### ## - 0x00, 0x60, 0x00, // ## - 0x03, 0x80, 0x00, // ### - 0x0C, 0x3C, 0x00, // ## #### - 0x10, 0x42, 0x00, // # # # - 0x00, 0x42, 0x00, // # # - 0x00, 0x42, 0x00, // # # - 0x00, 0x3C, 0x00, // #### - - // @105 '&' (9 pixels wide) - 0x00, 0x38, 0x00, // ### - 0x0E, 0x44, 0x00, // ### # # - 0x11, 0x82, 0x00, // # ## # - 0x10, 0xC2, 0x00, // # ## # - 0x11, 0x22, 0x00, // # # # # - 0x0E, 0x14, 0x00, // ### # # - 0x00, 0x08, 0x00, // # - 0x00, 0x14, 0x00, // # # - 0x00, 0x22, 0x00, // # # - - // @132 ''' (1 pixels wide) - 0x1E, 0x00, 0x00, // #### - - // @135 '(' (3 pixels wide) - 0x01, 0xFC, 0x00, // ####### - 0x0E, 0x03, 0x80, // ### ### - 0x10, 0x00, 0x40, // # # - - // @144 ')' (3 pixels wide) - 0x10, 0x00, 0x40, // # # - 0x0E, 0x03, 0x80, // ### ### - 0x01, 0xFC, 0x00, // ####### - - // @153 '*' (5 pixels wide) - 0x08, 0x00, 0x00, // # - 0x0B, 0x00, 0x00, // # ## - 0x1C, 0x00, 0x00, // ### - 0x0B, 0x00, 0x00, // # ## - 0x08, 0x00, 0x00, // # - - // @168 '+' (7 pixels wide) - 0x00, 0x40, 0x00, // # - 0x00, 0x40, 0x00, // # - 0x00, 0x40, 0x00, // # - 0x03, 0xF8, 0x00, // ####### - 0x00, 0x40, 0x00, // # - 0x00, 0x40, 0x00, // # - 0x00, 0x40, 0x00, // # - - // @189 ',' (1 pixels wide) - 0x00, 0x03, 0x80, // ### - - // @192 '-' (4 pixels wide) - 0x00, 0x10, 0x00, // # - 0x00, 0x10, 0x00, // # - 0x00, 0x10, 0x00, // # - 0x00, 0x10, 0x00, // # - - // @204 '.' (1 pixels wide) - 0x00, 0x02, 0x00, // # - - // @207 '/' (4 pixels wide) - 0x00, 0x06, 0x00, // ## - 0x00, 0x78, 0x00, // #### - 0x07, 0x80, 0x00, // #### - 0x18, 0x00, 0x00, // ## - - // @219 '0' (7 pixels wide) - 0x07, 0xF8, 0x00, // ######## - 0x08, 0x04, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x07, 0xF8, 0x00, // ######## - - // @240 '1' (4 pixels wide) - 0x02, 0x00, 0x00, // # - 0x04, 0x00, 0x00, // # - 0x08, 0x00, 0x00, // # - 0x1F, 0xFE, 0x00, // ############ - - // @252 '2' (7 pixels wide) - 0x04, 0x02, 0x00, // # # - 0x08, 0x06, 0x00, // # ## - 0x10, 0x0A, 0x00, // # # # - 0x10, 0x12, 0x00, // # # # - 0x10, 0x22, 0x00, // # # # - 0x18, 0xC2, 0x00, // ## ## # - 0x07, 0x02, 0x00, // ### # - - // @273 '3' (7 pixels wide) - 0x04, 0x0C, 0x00, // # ## - 0x08, 0x04, 0x00, // # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x11, 0x82, 0x00, // # ## # - 0x0F, 0x44, 0x00, // #### # # - 0x00, 0x38, 0x00, // ### - - // @294 '4' (8 pixels wide) - 0x00, 0x30, 0x00, // ## - 0x00, 0x50, 0x00, // # # - 0x00, 0x90, 0x00, // # # - 0x03, 0x10, 0x00, // ## # - 0x04, 0x10, 0x00, // # # - 0x08, 0x10, 0x00, // # # - 0x1F, 0xFE, 0x00, // ############ - 0x00, 0x10, 0x00, // # - - // @318 '5' (7 pixels wide) - 0x03, 0x88, 0x00, // ### # - 0x1D, 0x04, 0x00, // ### # # - 0x11, 0x02, 0x00, // # # # - 0x11, 0x02, 0x00, // # # # - 0x11, 0x02, 0x00, // # # # - 0x10, 0x84, 0x00, // # # # - 0x10, 0x78, 0x00, // # #### - - // @339 '6' (7 pixels wide) - 0x07, 0xF8, 0x00, // ######## - 0x08, 0x84, 0x00, // # # # - 0x11, 0x02, 0x00, // # # # - 0x11, 0x02, 0x00, // # # # - 0x11, 0x02, 0x00, // # # # - 0x08, 0x84, 0x00, // # # # - 0x04, 0x78, 0x00, // # #### - - // @360 '7' (7 pixels wide) - 0x10, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - 0x10, 0x0E, 0x00, // # ### - 0x10, 0xF0, 0x00, // # #### - 0x13, 0x00, 0x00, // # ## - 0x1C, 0x00, 0x00, // ### - 0x10, 0x00, 0x00, // # - - // @381 '8' (7 pixels wide) - 0x06, 0x38, 0x00, // ## ### - 0x09, 0x44, 0x00, // # # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x09, 0x44, 0x00, // # # # # - 0x06, 0x38, 0x00, // ## ### - - // @402 '9' (7 pixels wide) - 0x07, 0x88, 0x00, // #### # - 0x08, 0x44, 0x00, // # # # - 0x10, 0x22, 0x00, // # # # - 0x10, 0x22, 0x00, // # # # - 0x10, 0x22, 0x00, // # # # - 0x08, 0x44, 0x00, // # # # - 0x07, 0xF8, 0x00, // ######## - - // @423 ':' (1 pixels wide) - 0x02, 0x02, 0x00, // # # - - // @426 ';' (1 pixels wide) - 0x02, 0x03, 0x80, // # ### - - // @429 '<' (7 pixels wide) - 0x00, 0x40, 0x00, // # - 0x00, 0xA0, 0x00, // # # - 0x00, 0xA0, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x02, 0x08, 0x00, // # # - - // @450 '=' (7 pixels wide) - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - - // @471 '>' (7 pixels wide) - 0x02, 0x08, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x01, 0x10, 0x00, // # # - 0x00, 0xA0, 0x00, // # # - 0x00, 0xA0, 0x00, // # # - 0x00, 0x40, 0x00, // # - - // @492 '?' (7 pixels wide) - 0x06, 0x00, 0x00, // ## - 0x08, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - 0x10, 0x3A, 0x00, // # ### # - 0x10, 0x40, 0x00, // # # - 0x08, 0x80, 0x00, // # # - 0x07, 0x00, 0x00, // ### - - // @513 '@' (15 pixels wide) - 0x00, 0xFC, 0x00, // ###### - 0x03, 0x02, 0x00, // ## # - 0x04, 0x01, 0x00, // # # - 0x08, 0x78, 0x80, // # #### # - 0x08, 0x84, 0x80, // # # # # - 0x11, 0x02, 0x40, // # # # # - 0x12, 0x02, 0x40, // # # # # - 0x12, 0x02, 0x40, // # # # # - 0x12, 0x04, 0x40, // # # # # - 0x11, 0x3E, 0x40, // # # ##### # - 0x13, 0xC2, 0x40, // # #### # # - 0x08, 0x02, 0x40, // # # # - 0x08, 0x04, 0x80, // # # # - 0x06, 0x08, 0x80, // ## # # - 0x01, 0xF1, 0x00, // ##### # - - // @558 'A' (9 pixels wide) - 0x00, 0x06, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x01, 0xE0, 0x00, // #### - 0x0E, 0x20, 0x00, // ### # - 0x10, 0x20, 0x00, // # # - 0x0E, 0x20, 0x00, // ### # - 0x01, 0xE0, 0x00, // #### - 0x00, 0x38, 0x00, // ### - 0x00, 0x06, 0x00, // ## - - // @585 'B' (9 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x19, 0x44, 0x00, // ## # # # - 0x06, 0x38, 0x00, // ## ### - - // @612 'C' (10 pixels wide) - 0x03, 0xF0, 0x00, // ###### - 0x04, 0x08, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x04, 0x08, 0x00, // # # - - // @642 'D' (10 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x04, 0x08, 0x00, // # # - 0x03, 0xF0, 0x00, // ###### - - // @672 'E' (9 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x02, 0x00, // # # - - // @699 'F' (8 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x00, 0x00, // # - - // @723 'G' (10 pixels wide) - 0x03, 0xF0, 0x00, // ###### - 0x04, 0x08, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x42, 0x00, // # # # - 0x10, 0x42, 0x00, // # # # - 0x08, 0x44, 0x00, // # # # - 0x04, 0x48, 0x00, // # # # - 0x00, 0x70, 0x00, // ### - - // @753 'H' (9 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x1F, 0xFE, 0x00, // ############ - - // @780 'I' (1 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - - // @783 'J' (6 pixels wide) - 0x00, 0x1C, 0x00, // ### - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x1F, 0xFC, 0x00, // ########### - - // @801 'K' (9 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x00, 0x20, 0x00, // # - 0x00, 0x40, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x01, 0xC0, 0x00, // ### - 0x02, 0x20, 0x00, // # # - 0x04, 0x18, 0x00, // # ## - 0x08, 0x04, 0x00, // # # - 0x10, 0x02, 0x00, // # # - - // @828 'L' (7 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - - // @849 'M' (11 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x0C, 0x00, 0x00, // ## - 0x03, 0x00, 0x00, // ## - 0x00, 0xC0, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x00, 0x06, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x00, 0xC0, 0x00, // ## - 0x03, 0x00, 0x00, // ## - 0x0C, 0x00, 0x00, // ## - 0x1F, 0xFE, 0x00, // ############ - - // @882 'N' (9 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x08, 0x00, 0x00, // # - 0x06, 0x00, 0x00, // ## - 0x01, 0x00, 0x00, // # - 0x00, 0xC0, 0x00, // ## - 0x00, 0x20, 0x00, // # - 0x00, 0x18, 0x00, // ## - 0x00, 0x04, 0x00, // # - 0x1F, 0xFE, 0x00, // ############ - - // @909 'O' (10 pixels wide) - 0x03, 0xF0, 0x00, // ###### - 0x04, 0x08, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x04, 0x08, 0x00, // # # - 0x03, 0xF0, 0x00, // ###### - - // @939 'P' (9 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x08, 0x80, 0x00, // # # - 0x07, 0x00, 0x00, // ### - - // @966 'Q' (10 pixels wide) - 0x03, 0xF0, 0x00, // ###### - 0x04, 0x08, 0x00, // # # - 0x08, 0x04, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x02, 0x00, // # # - 0x10, 0x0A, 0x00, // # # # - 0x10, 0x0A, 0x00, // # # # - 0x08, 0x04, 0x00, // # # - 0x04, 0x0E, 0x00, // # ### - 0x03, 0xFA, 0x00, // ####### # - - // @996 'R' (9 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x40, 0x00, // # # - 0x10, 0x60, 0x00, // # ## - 0x10, 0x58, 0x00, // # # ## - 0x08, 0x84, 0x00, // # # # - 0x07, 0x02, 0x00, // ### # - - // @1023 'S' (9 pixels wide) - 0x06, 0x08, 0x00, // ## # - 0x09, 0x04, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x82, 0x00, // # # # - 0x10, 0x42, 0x00, // # # # - 0x10, 0x42, 0x00, // # # # - 0x08, 0x44, 0x00, // # # # - 0x04, 0x38, 0x00, // # ### - - // @1050 'T' (9 pixels wide) - 0x10, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - 0x1F, 0xFE, 0x00, // ############ - 0x10, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - 0x10, 0x00, 0x00, // # - - // @1077 'U' (9 pixels wide) - 0x1F, 0xF8, 0x00, // ########## - 0x00, 0x04, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x04, 0x00, // # - 0x1F, 0xF8, 0x00, // ########## - - // @1104 'V' (9 pixels wide) - 0x18, 0x00, 0x00, // ## - 0x07, 0x00, 0x00, // ### - 0x00, 0xE0, 0x00, // ### - 0x00, 0x18, 0x00, // ## - 0x00, 0x06, 0x00, // ## - 0x00, 0x18, 0x00, // ## - 0x00, 0xE0, 0x00, // ### - 0x07, 0x00, 0x00, // ### - 0x18, 0x00, 0x00, // ## - - // @1131 'W' (15 pixels wide) - 0x18, 0x00, 0x00, // ## - 0x07, 0x80, 0x00, // #### - 0x00, 0x78, 0x00, // #### - 0x00, 0x06, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x01, 0xC0, 0x00, // ### - 0x0E, 0x00, 0x00, // ### - 0x10, 0x00, 0x00, // # - 0x0E, 0x00, 0x00, // ### - 0x01, 0xC0, 0x00, // ### - 0x00, 0x38, 0x00, // ### - 0x00, 0x06, 0x00, // ## - 0x00, 0x78, 0x00, // #### - 0x07, 0x80, 0x00, // #### - 0x18, 0x00, 0x00, // ## - - // @1176 'X' (11 pixels wide) - 0x00, 0x02, 0x00, // # - 0x10, 0x04, 0x00, // # # - 0x08, 0x08, 0x00, // # # - 0x06, 0x30, 0x00, // ## ## - 0x01, 0x40, 0x00, // # # - 0x00, 0x80, 0x00, // # - 0x01, 0x40, 0x00, // # # - 0x06, 0x30, 0x00, // ## ## - 0x08, 0x08, 0x00, // # # - 0x10, 0x04, 0x00, // # # - 0x00, 0x02, 0x00, // # - - // @1209 'Y' (9 pixels wide) - 0x10, 0x00, 0x00, // # - 0x0C, 0x00, 0x00, // ## - 0x02, 0x00, 0x00, // # - 0x01, 0x80, 0x00, // ## - 0x00, 0x7E, 0x00, // ###### - 0x01, 0x80, 0x00, // ## - 0x02, 0x00, 0x00, // # - 0x0C, 0x00, 0x00, // ## - 0x10, 0x00, 0x00, // # - - // @1236 'Z' (9 pixels wide) - 0x00, 0x02, 0x00, // # - 0x10, 0x06, 0x00, // # ## - 0x10, 0x1A, 0x00, // # ## # - 0x10, 0x22, 0x00, // # # # - 0x10, 0xC2, 0x00, // # ## # - 0x11, 0x02, 0x00, // # # # - 0x16, 0x02, 0x00, // # ## # - 0x18, 0x02, 0x00, // ## # - 0x10, 0x02, 0x00, // # # - - // @1263 '[' (3 pixels wide) - 0x1F, 0xFF, 0xC0, // ############### - 0x10, 0x00, 0x40, // # # - 0x10, 0x00, 0x40, // # # - - // @1272 '\' (4 pixels wide) - 0x18, 0x00, 0x00, // ## - 0x07, 0x80, 0x00, // #### - 0x00, 0x78, 0x00, // #### - 0x00, 0x06, 0x00, // ## - - // @1284 ']' (3 pixels wide) - 0x10, 0x00, 0x40, // # # - 0x10, 0x00, 0x40, // # # - 0x1F, 0xFF, 0xC0, // ############### - - // @1293 '^' (7 pixels wide) - 0x00, 0x80, 0x00, // # - 0x03, 0x00, 0x00, // ## - 0x0C, 0x00, 0x00, // ## - 0x10, 0x00, 0x00, // # - 0x0C, 0x00, 0x00, // ## - 0x03, 0x00, 0x00, // ## - 0x00, 0x80, 0x00, // # - - // @1314 '_' (9 pixels wide) - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - - // @1341 '`' (2 pixels wide) - 0x10, 0x00, 0x00, // # - 0x08, 0x00, 0x00, // # - - // @1347 'a' (7 pixels wide) - 0x00, 0x9C, 0x00, // # ### - 0x01, 0x22, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x02, 0x42, 0x00, // # # # - 0x02, 0x44, 0x00, // # # # - 0x01, 0xFE, 0x00, // ######## - - // @1368 'b' (7 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x01, 0x04, 0x00, // # # - 0x00, 0xF8, 0x00, // ##### - - // @1389 'c' (6 pixels wide) - 0x00, 0xF8, 0x00, // ##### - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x01, 0x04, 0x00, // # # - - // @1407 'd' (7 pixels wide) - 0x00, 0xF8, 0x00, // ##### - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x01, 0x04, 0x00, // # # - 0x1F, 0xFE, 0x00, // ############ - - // @1428 'e' (7 pixels wide) - 0x00, 0xF8, 0x00, // ##### - 0x01, 0x24, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x01, 0x24, 0x00, // # # # - 0x00, 0xE8, 0x00, // ### # - - // @1449 'f' (4 pixels wide) - 0x02, 0x00, 0x00, // # - 0x0F, 0xFE, 0x00, // ########### - 0x12, 0x00, 0x00, // # # - 0x12, 0x00, 0x00, // # # - - // @1461 'g' (7 pixels wide) - 0x00, 0xF8, 0x80, // ##### # - 0x01, 0x04, 0x40, // # # # - 0x02, 0x02, 0x40, // # # # - 0x02, 0x02, 0x40, // # # # - 0x02, 0x02, 0x40, // # # # - 0x01, 0x04, 0x80, // # # # - 0x03, 0xFF, 0x00, // ########## - - // @1482 'h' (6 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x01, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x01, 0xFE, 0x00, // ######## - - // @1500 'i' (1 pixels wide) - 0x13, 0xFE, 0x00, // # ######### - - // @1503 'j' (3 pixels wide) - 0x00, 0x00, 0x40, // # - 0x00, 0x00, 0x40, // # - 0x13, 0xFF, 0x80, // # ########### - - // @1512 'k' (7 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - 0x00, 0x10, 0x00, // # - 0x00, 0x20, 0x00, // # - 0x00, 0x60, 0x00, // ## - 0x00, 0x98, 0x00, // # ## - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - - // @1533 'l' (1 pixels wide) - 0x1F, 0xFE, 0x00, // ############ - - // @1536 'm' (11 pixels wide) - 0x03, 0xFE, 0x00, // ######### - 0x01, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x01, 0xFE, 0x00, // ######## - 0x01, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x01, 0xFE, 0x00, // ######## - - // @1569 'n' (6 pixels wide) - 0x03, 0xFE, 0x00, // ######### - 0x01, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x01, 0xFE, 0x00, // ######## - - // @1587 'o' (7 pixels wide) - 0x00, 0xF8, 0x00, // ##### - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x01, 0x04, 0x00, // # # - 0x00, 0xF8, 0x00, // ##### - - // @1608 'p' (7 pixels wide) - 0x03, 0xFF, 0xC0, // ############ - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x01, 0x04, 0x00, // # # - 0x00, 0xF8, 0x00, // ##### - - // @1629 'q' (7 pixels wide) - 0x00, 0xF8, 0x00, // ##### - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - 0x01, 0x04, 0x00, // # # - 0x03, 0xFF, 0xC0, // ############ - - // @1650 'r' (4 pixels wide) - 0x03, 0xFE, 0x00, // ######### - 0x01, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - 0x02, 0x00, 0x00, // # - - // @1662 's' (6 pixels wide) - 0x01, 0xC4, 0x00, // ### # - 0x02, 0x22, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x02, 0x22, 0x00, // # # # - 0x01, 0x1C, 0x00, // # ### - - // @1680 't' (4 pixels wide) - 0x02, 0x00, 0x00, // # - 0x0F, 0xFE, 0x00, // ########### - 0x02, 0x02, 0x00, // # # - 0x02, 0x02, 0x00, // # # - - // @1692 'u' (6 pixels wide) - 0x03, 0xFC, 0x00, // ######## - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x02, 0x00, // # - 0x00, 0x04, 0x00, // # - 0x03, 0xFE, 0x00, // ######### - - // @1710 'v' (7 pixels wide) - 0x03, 0x00, 0x00, // ## - 0x00, 0xC0, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x00, 0x06, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x00, 0xC0, 0x00, // ## - 0x03, 0x00, 0x00, // ## - - // @1731 'w' (11 pixels wide) - 0x03, 0x00, 0x00, // ## - 0x00, 0xF8, 0x00, // ##### - 0x00, 0x06, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x00, 0xC0, 0x00, // ## - 0x03, 0x00, 0x00, // ## - 0x00, 0xC0, 0x00, // ## - 0x00, 0x38, 0x00, // ### - 0x00, 0x06, 0x00, // ## - 0x00, 0xF8, 0x00, // ##### - 0x03, 0x00, 0x00, // ## - - // @1764 'x' (7 pixels wide) - 0x02, 0x02, 0x00, // # # - 0x01, 0x04, 0x00, // # # - 0x00, 0xD8, 0x00, // ## ## - 0x00, 0x20, 0x00, // # - 0x00, 0xD8, 0x00, // ## ## - 0x01, 0x04, 0x00, // # # - 0x02, 0x02, 0x00, // # # - - // @1785 'y' (7 pixels wide) - 0x03, 0x80, 0x00, // ### - 0x00, 0x60, 0x40, // ## # - 0x00, 0x1C, 0x40, // ### # - 0x00, 0x03, 0x80, // ### - 0x00, 0x1C, 0x00, // ### - 0x00, 0xE0, 0x00, // ### - 0x03, 0x00, 0x00, // ## - - // @1806 'z' (7 pixels wide) - 0x02, 0x02, 0x00, // # # - 0x02, 0x06, 0x00, // # ## - 0x02, 0x1A, 0x00, // # ## # - 0x02, 0x22, 0x00, // # # # - 0x02, 0xC2, 0x00, // # ## # - 0x03, 0x02, 0x00, // ## # - 0x02, 0x02, 0x00, // # # - - // @1827 '{' (5 pixels wide) - 0x00, 0x20, 0x00, // # - 0x00, 0x20, 0x00, // # - 0x0F, 0xDF, 0x80, // ###### ###### - 0x10, 0x00, 0x40, // # # - 0x10, 0x00, 0x40, // # # - - // @1842 '|' (1 pixels wide) - 0x1F, 0xFF, 0xC0, // ############### - - // @1845 '}' (5 pixels wide) - 0x10, 0x00, 0x40, // # # - 0x10, 0x00, 0x40, // # # - 0x0F, 0xDF, 0x80, // ###### ###### - 0x00, 0x20, 0x00, // # - 0x00, 0x20, 0x00, // # - - // @1860 '~' (8 pixels wide) - 0x00, 0x40, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x80, 0x00, // # - 0x00, 0x40, 0x00, // # - 0x00, 0x40, 0x00, // # - 0x00, 0x40, 0x00, // # - 0x00, 0x80, 0x00, // # -}; - -// Character descriptors for Arial 12pt -// { [Char width in bits], [Char height in bits], [Offset into arial_12ptCharBitmaps in bytes] } -const FONT_CHAR_INFO PROGMEM arial_12ptDescriptors[] = -{ - {2, 18, 0}, // ' ' - {1, 18, 6}, // '!' - {4, 18, 9}, // '"' - {9, 18, 21}, // '#' - {7, 18, 48}, // '$' - {12, 18, 69}, // '%' - {9, 18, 105}, // '&' - {1, 18, 132}, // ''' - {3, 18, 135}, // '(' - {3, 18, 144}, // ')' - {5, 18, 153}, // '*' - {7, 18, 168}, // '+' - {1, 18, 189}, // ',' - {4, 18, 192}, // '-' - {1, 18, 204}, // '.' - {4, 18, 207}, // '/' - {7, 18, 219}, // '0' - {4, 18, 240}, // '1' - {7, 18, 252}, // '2' - {7, 18, 273}, // '3' - {8, 18, 294}, // '4' - {7, 18, 318}, // '5' - {7, 18, 339}, // '6' - {7, 18, 360}, // '7' - {7, 18, 381}, // '8' - {7, 18, 402}, // '9' - {1, 18, 423}, // ':' - {1, 18, 426}, // ';' - {7, 18, 429}, // '<' - {7, 18, 450}, // '=' - {7, 18, 471}, // '>' - {7, 18, 492}, // '?' - {15, 18, 513}, // '@' - {9, 18, 558}, // 'A' - {9, 18, 585}, // 'B' - {10, 18, 612}, // 'C' - {10, 18, 642}, // 'D' - {9, 18, 672}, // 'E' - {8, 18, 699}, // 'F' - {10, 18, 723}, // 'G' - {9, 18, 753}, // 'H' - {1, 18, 780}, // 'I' - {6, 18, 783}, // 'J' - {9, 18, 801}, // 'K' - {7, 18, 828}, // 'L' - {11, 18, 849}, // 'M' - {9, 18, 882}, // 'N' - {10, 18, 909}, // 'O' - {9, 18, 939}, // 'P' - {10, 18, 966}, // 'Q' - {9, 18, 996}, // 'R' - {9, 18, 1023}, // 'S' - {9, 18, 1050}, // 'T' - {9, 18, 1077}, // 'U' - {9, 18, 1104}, // 'V' - {15, 18, 1131}, // 'W' - {11, 18, 1176}, // 'X' - {9, 18, 1209}, // 'Y' - {9, 18, 1236}, // 'Z' - {3, 18, 1263}, // '[' - {4, 18, 1272}, // '\' - {3, 18, 1284}, // ']' - {7, 18, 1293}, // '^' - {9, 18, 1314}, // '_' - {2, 18, 1341}, // '`' - {7, 18, 1347}, // 'a' - {7, 18, 1368}, // 'b' - {6, 18, 1389}, // 'c' - {7, 18, 1407}, // 'd' - {7, 18, 1428}, // 'e' - {4, 18, 1449}, // 'f' - {7, 18, 1461}, // 'g' - {6, 18, 1482}, // 'h' - {1, 18, 1500}, // 'i' - {3, 18, 1503}, // 'j' - {7, 18, 1512}, // 'k' - {1, 18, 1533}, // 'l' - {11, 18, 1536}, // 'm' - {6, 18, 1569}, // 'n' - {7, 18, 1587}, // 'o' - {7, 18, 1608}, // 'p' - {7, 18, 1629}, // 'q' - {4, 18, 1650}, // 'r' - {6, 18, 1662}, // 's' - {4, 18, 1680}, // 't' - {6, 18, 1692}, // 'u' - {7, 18, 1710}, // 'v' - {11, 18, 1731}, // 'w' - {7, 18, 1764}, // 'x' - {7, 18, 1785}, // 'y' - {7, 18, 1806}, // 'z' - {5, 18, 1827}, // '{' - {1, 18, 1842}, // '|' - {5, 18, 1845}, // '}' - {8, 18, 1860}, // '~' -}; - -// Font information for Arial 12pt -const FONT_INFO arial_12ptFontInfo = -{ - 18, // Character height - ' ', // Start character - '~', // End character - 1, - arial_12ptDescriptors, // Character descriptor array - arial_12ptBitmaps, // Character bitmap array -}; // // Font data for Arial Black 12pt diff --git a/src/OLED/fonts/FranklinGothic.cpp b/src/OLED/fonts/FranklinGothic.cpp deleted file mode 100644 index 37978a1..0000000 --- a/src/OLED/fonts/FranklinGothic.cpp +++ /dev/null @@ -1,1195 +0,0 @@ - -// -// Font data for Franklin Gothic Medium Cond 8pt -// -// Generated by The Dot Factory: -// http://www.eran.io/the-dot-factory-an-lcd-font-and-image-generator/ -// -///////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Dot Factory Settings -// -// Flip/Rotate Padding Removal Line Wrap Descriptors -// [X] Flip X Height(Y): None (O) At column [X] Generate descriptor array -// [ ] Flip Y Width(X): Tightest ( ) At bitmap Char Width: In Bits -// 90deg Char Height: In Bits -// Font Height: In Bits -// Comments Byte [ ] Multiple descriptor arrays -// [X] Variable Name Bit layout: RowMajor -// [X] BMP visualise [#] Order: MSBfirst Create new when exceeds [80] -// [X] Char descriptor Format: Hex -// Style: Cpp Leading: 0x Image width: In Bits -// Image height: In Bits -// Variable name format -// Bitmaps: const uint8_t PROGMEM {0}Bitmaps Space char generation -// Char Info: const FONT_CHAR_INFO PROGMEM {0}Descriptors [ ] Generate space bitmap -// Font Info: const FONT_INFO {0}FontInfo [2] pixels for space char -// Width: const uint8_t {0}Width -// Height: const uint8_t {0}Height -// -///////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "FranklinGothic.h" - -// Character bitmaps for Franklin Gothic Medium Cond 8pt -const uint8_t PROGMEM franklinGothicMediumCond_8ptBitmaps [] = -{ - // @0 ' ' (2 pixels wide) - 0x00, 0x00, // - 0x00, 0x00, // - - // @4 '!' (1 pixels wide) - 0x0F, 0xD0, // ###### # - - // @6 '"' (3 pixels wide) - 0x0E, 0x00, // ### - 0x00, 0x00, // - 0x0E, 0x00, // ### - - // @12 '#' (6 pixels wide) - 0x02, 0x40, // # # - 0x0F, 0xF0, // ######## - 0x02, 0x40, // # # - 0x02, 0x40, // # # - 0x0F, 0xF0, // ######## - 0x02, 0x40, // # # - - // @24 '$' (5 pixels wide) - 0x03, 0x20, // ## # - 0x04, 0x90, // # # # - 0x0F, 0xF8, // ######### - 0x04, 0x90, // # # # - 0x02, 0x60, // # ## - - // @34 '%' (7 pixels wide) - 0x06, 0x00, // ## - 0x09, 0x10, // # # # - 0x06, 0x60, // ## ## - 0x01, 0x80, // ## - 0x06, 0x60, // ## ## - 0x08, 0x90, // # # # - 0x00, 0x60, // ## - - // @48 '&' (6 pixels wide) - 0x00, 0x60, // ## - 0x06, 0x90, // ## # # - 0x09, 0x90, // # ## # - 0x09, 0x50, // # # # # - 0x06, 0x20, // ## # - 0x00, 0xD0, // ## # - - // @60 ''' (1 pixels wide) - 0x0E, 0x00, // ### - - // @62 '(' (2 pixels wide) - 0x07, 0xF8, // ######## - 0x08, 0x04, // # # - - // @66 ')' (2 pixels wide) - 0x08, 0x04, // # # - 0x07, 0xF8, // ######## - - // @70 '*' (3 pixels wide) - 0x06, 0x00, // ## - 0x0F, 0x00, // #### - 0x06, 0x00, // ## - - // @76 '+' (5 pixels wide) - 0x00, 0x80, // # - 0x00, 0x80, // # - 0x03, 0xE0, // ##### - 0x00, 0x80, // # - 0x00, 0x80, // # - - // @86 ',' (1 pixels wide) - 0x00, 0x1C, // ### - - // @88 '-' (2 pixels wide) - 0x00, 0x40, // # - 0x00, 0x40, // # - - // @92 '.' (1 pixels wide) - 0x00, 0x10, // # - - // @94 '/' (5 pixels wide) - 0x00, 0x04, // # - 0x00, 0x38, // ### - 0x00, 0xC0, // ## - 0x07, 0x00, // ### - 0x08, 0x00, // # - - // @104 '0' (5 pixels wide) - 0x07, 0xE0, // ###### - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x07, 0xE0, // ###### - - // @114 '1' (3 pixels wide) - 0x04, 0x10, // # # - 0x0F, 0xF0, // ######## - 0x00, 0x10, // # - - // @120 '2' (5 pixels wide) - 0x04, 0x10, // # # - 0x08, 0x30, // # ## - 0x08, 0x50, // # # # - 0x08, 0x90, // # # # - 0x07, 0x10, // ### # - - // @130 '3' (5 pixels wide) - 0x04, 0x20, // # # - 0x08, 0x10, // # # - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x06, 0xE0, // ## ### - - // @140 '4' (6 pixels wide) - 0x00, 0xC0, // ## - 0x01, 0x40, // # # - 0x02, 0x40, // # # - 0x04, 0x40, // # # - 0x0F, 0xF0, // ######## - 0x00, 0x40, // # - - // @152 '5' (5 pixels wide) - 0x0F, 0xA0, // ##### # - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x08, 0xE0, // # ### - - // @162 '6' (5 pixels wide) - 0x07, 0xE0, // ###### - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x04, 0xE0, // # ### - - // @172 '7' (5 pixels wide) - 0x08, 0x00, // # - 0x08, 0x00, // # - 0x08, 0xF0, // # #### - 0x0B, 0x00, // # ## - 0x0C, 0x00, // ## - - // @182 '8' (5 pixels wide) - 0x06, 0xE0, // ## ### - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x06, 0xE0, // ## ### - - // @192 '9' (5 pixels wide) - 0x07, 0x20, // ### # - 0x08, 0x90, // # # # - 0x08, 0x90, // # # # - 0x08, 0x90, // # # # - 0x07, 0xE0, // ###### - - // @202 ':' (1 pixels wide) - 0x02, 0x10, // # # - - // @204 ';' (1 pixels wide) - 0x02, 0x1C, // # ### - - // @206 '<' (5 pixels wide) - 0x01, 0x80, // ## - 0x01, 0x80, // ## - 0x02, 0x40, // # # - 0x02, 0x40, // # # - 0x04, 0x20, // # # - - // @216 '=' (4 pixels wide) - 0x01, 0x40, // # # - 0x01, 0x40, // # # - 0x01, 0x40, // # # - 0x01, 0x40, // # # - - // @224 '>' (5 pixels wide) - 0x04, 0x20, // # # - 0x02, 0x40, // # # - 0x02, 0x40, // # # - 0x01, 0x80, // ## - 0x01, 0x80, // ## - - // @234 '?' (4 pixels wide) - 0x06, 0x00, // ## - 0x08, 0xD0, // # ## # - 0x09, 0x00, // # # - 0x06, 0x00, // ## - - // @242 '@' (7 pixels wide) - 0x03, 0xC0, // #### - 0x04, 0x20, // # # - 0x09, 0x90, // # ## # - 0x0A, 0x50, // # # # # - 0x0B, 0x90, // # ### # - 0x08, 0x40, // # # - 0x07, 0x80, // #### - - // @256 'A' (5 pixels wide) - 0x00, 0x70, // ### - 0x03, 0xC0, // #### - 0x0C, 0x40, // ## # - 0x03, 0xC0, // #### - 0x00, 0x70, // ### - - // @266 'B' (5 pixels wide) - 0x0F, 0xF0, // ######## - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x06, 0xE0, // ## ### - - // @276 'C' (5 pixels wide) - 0x07, 0xE0, // ###### - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x06, 0x60, // ## ## - - // @286 'D' (5 pixels wide) - 0x0F, 0xF0, // ######## - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x04, 0x20, // # # - 0x03, 0xC0, // #### - - // @296 'E' (4 pixels wide) - 0x0F, 0xF0, // ######## - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x08, 0x10, // # # - - // @304 'F' (4 pixels wide) - 0x0F, 0xF0, // ######## - 0x09, 0x00, // # # - 0x09, 0x00, // # # - 0x08, 0x00, // # - - // @312 'G' (5 pixels wide) - 0x07, 0xE0, // ###### - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x08, 0x90, // # # # - 0x06, 0xF0, // ## #### - - // @322 'H' (5 pixels wide) - 0x0F, 0xF0, // ######## - 0x01, 0x00, // # - 0x01, 0x00, // # - 0x01, 0x00, // # - 0x0F, 0xF0, // ######## - - // @332 'I' (1 pixels wide) - 0x0F, 0xF0, // ######## - - // @334 'J' (2 pixels wide) - 0x00, 0x10, // # - 0x0F, 0xF0, // ######## - - // @338 'K' (5 pixels wide) - 0x0F, 0xF0, // ######## - 0x01, 0x00, // # - 0x03, 0x80, // ### - 0x04, 0x60, // # ## - 0x08, 0x10, // # # - - // @348 'L' (4 pixels wide) - 0x0F, 0xF0, // ######## - 0x00, 0x10, // # - 0x00, 0x10, // # - 0x00, 0x10, // # - - // @356 'M' (7 pixels wide) - 0x0F, 0xF0, // ######## - 0x0C, 0x00, // ## - 0x03, 0xC0, // #### - 0x00, 0x30, // ## - 0x03, 0xC0, // #### - 0x0C, 0x00, // ## - 0x0F, 0xF0, // ######## - - // @370 'N' (5 pixels wide) - 0x0F, 0xF0, // ######## - 0x06, 0x00, // ## - 0x01, 0x80, // ## - 0x00, 0x60, // ## - 0x0F, 0xF0, // ######## - - // @380 'O' (5 pixels wide) - 0x07, 0xE0, // ###### - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x08, 0x10, // # # - 0x07, 0xE0, // ###### - - // @390 'P' (4 pixels wide) - 0x0F, 0xF0, // ######## - 0x08, 0x80, // # # - 0x08, 0x80, // # # - 0x07, 0x00, // ### - - // @398 'Q' (5 pixels wide) - 0x07, 0xE0, // ###### - 0x08, 0x10, // # # - 0x08, 0x18, // # ## - 0x08, 0x14, // # # # - 0x07, 0xE4, // ###### # - - // @408 'R' (5 pixels wide) - 0x0F, 0xF0, // ######## - 0x08, 0x80, // # # - 0x08, 0xC0, // # ## - 0x08, 0xA0, // # # # - 0x07, 0x10, // ### # - - // @418 'S' (5 pixels wide) - 0x06, 0x20, // ## # - 0x09, 0x10, // # # # - 0x09, 0x10, // # # # - 0x08, 0x90, // # # # - 0x04, 0x60, // # ## - - // @428 'T' (5 pixels wide) - 0x08, 0x00, // # - 0x08, 0x00, // # - 0x0F, 0xF0, // ######## - 0x08, 0x00, // # - 0x08, 0x00, // # - - // @438 'U' (5 pixels wide) - 0x0F, 0xE0, // ####### - 0x00, 0x10, // # - 0x00, 0x10, // # - 0x00, 0x10, // # - 0x0F, 0xE0, // ####### - - // @448 'V' (5 pixels wide) - 0x0C, 0x00, // ## - 0x03, 0xE0, // ##### - 0x00, 0x10, // # - 0x03, 0xE0, // ##### - 0x0C, 0x00, // ## - - // @458 'W' (7 pixels wide) - 0x0F, 0x80, // ##### - 0x00, 0x70, // ### - 0x03, 0x80, // ### - 0x0C, 0x00, // ## - 0x03, 0xC0, // #### - 0x00, 0x70, // ### - 0x0F, 0x80, // ##### - - // @472 'X' (5 pixels wide) - 0x08, 0x10, // # # - 0x06, 0x60, // ## ## - 0x01, 0x80, // ## - 0x06, 0x60, // ## ## - 0x08, 0x10, // # # - - // @482 'Y' (5 pixels wide) - 0x08, 0x00, // # - 0x06, 0x00, // ## - 0x01, 0xF0, // ##### - 0x06, 0x00, // ## - 0x08, 0x00, // # - - // @492 'Z' (4 pixels wide) - 0x08, 0x30, // # ## - 0x08, 0xD0, // # ## # - 0x0B, 0x10, // # ## # - 0x0C, 0x10, // ## # - - // @500 '[' (2 pixels wide) - 0x0F, 0xFC, // ########## - 0x08, 0x04, // # # - - // @504 '\' (4 pixels wide) - 0x04, 0x00, // # - 0x03, 0x80, // ### - 0x00, 0x70, // ### - 0x00, 0x0C, // ## - - // @512 ']' (2 pixels wide) - 0x08, 0x04, // # # - 0x0F, 0xFC, // ########## - - // @516 '^' (5 pixels wide) - 0x00, 0x80, // # - 0x03, 0x00, // ## - 0x04, 0x00, // # - 0x03, 0x00, // ## - 0x00, 0x80, // # - - // @526 '_' (6 pixels wide) - 0x00, 0x04, // # - 0x00, 0x04, // # - 0x00, 0x04, // # - 0x00, 0x04, // # - 0x00, 0x04, // # - 0x00, 0x04, // # - - // @538 '`' (2 pixels wide) - 0x10, 0x00, // # - 0x08, 0x00, // # - - // @542 'a' (4 pixels wide) - 0x00, 0x60, // ## - 0x02, 0x90, // # # # - 0x02, 0x90, // # # # - 0x01, 0xF0, // ##### - - // @550 'b' (4 pixels wide) - 0x0F, 0xF0, // ######## - 0x02, 0x10, // # # - 0x02, 0x10, // # # - 0x01, 0xE0, // #### - - // @558 'c' (4 pixels wide) - 0x01, 0xE0, // #### - 0x02, 0x10, // # # - 0x02, 0x10, // # # - 0x01, 0x20, // # # - - // @566 'd' (4 pixels wide) - 0x01, 0xE0, // #### - 0x02, 0x10, // # # - 0x02, 0x10, // # # - 0x0F, 0xF0, // ######## - - // @574 'e' (4 pixels wide) - 0x01, 0xE0, // #### - 0x02, 0x90, // # # # - 0x02, 0x90, // # # # - 0x01, 0xA0, // ## # - - // @582 'f' (3 pixels wide) - 0x02, 0x00, // # - 0x07, 0xF0, // ####### - 0x0A, 0x00, // # # - - // @588 'g' (5 pixels wide) - 0x01, 0xA8, // ## # # - 0x02, 0x54, // # # # # - 0x02, 0x54, // # # # # - 0x03, 0x94, // ### # # - 0x04, 0x08, // # # - - // @598 'h' (4 pixels wide) - 0x0F, 0xF0, // ######## - 0x02, 0x00, // # - 0x02, 0x00, // # - 0x01, 0xF0, // ##### - - // @606 'i' (1 pixels wide) - 0x0B, 0xF0, // # ###### - - // @608 'j' (2 pixels wide) - 0x00, 0x04, // # - 0x0B, 0xFC, // # ######## - - // @612 'k' (4 pixels wide) - 0x0F, 0xF0, // ######## - 0x00, 0x80, // # - 0x01, 0x60, // # ## - 0x02, 0x10, // # # - - // @620 'l' (1 pixels wide) - 0x0F, 0xF0, // ######## - - // @622 'm' (7 pixels wide) - 0x03, 0xF0, // ###### - 0x02, 0x00, // # - 0x02, 0x00, // # - 0x01, 0xF0, // ##### - 0x02, 0x00, // # - 0x02, 0x00, // # - 0x01, 0xF0, // ##### - - // @636 'n' (4 pixels wide) - 0x03, 0xF0, // ###### - 0x02, 0x00, // # - 0x02, 0x00, // # - 0x01, 0xF0, // ##### - - // @644 'o' (4 pixels wide) - 0x01, 0xE0, // #### - 0x02, 0x10, // # # - 0x02, 0x10, // # # - 0x01, 0xE0, // #### - - // @652 'p' (4 pixels wide) - 0x03, 0xFC, // ######## - 0x02, 0x10, // # # - 0x02, 0x10, // # # - 0x01, 0xE0, // #### - - // @660 'q' (4 pixels wide) - 0x01, 0xE0, // #### - 0x02, 0x10, // # # - 0x02, 0x10, // # # - 0x03, 0xFC, // ######## - - // @668 'r' (3 pixels wide) - 0x03, 0xF0, // ###### - 0x01, 0x00, // # - 0x02, 0x00, // # - - // @674 's' (3 pixels wide) - 0x01, 0x10, // # # - 0x02, 0x90, // # # # - 0x02, 0x60, // # ## - - // @680 't' (3 pixels wide) - 0x02, 0x00, // # - 0x0F, 0xF0, // ######## - 0x02, 0x10, // # # - - // @686 'u' (4 pixels wide) - 0x03, 0xE0, // ##### - 0x00, 0x10, // # - 0x00, 0x20, // # - 0x03, 0xF0, // ###### - - // @694 'v' (5 pixels wide) - 0x02, 0x00, // # - 0x01, 0xC0, // ### - 0x00, 0x30, // ## - 0x01, 0xC0, // ### - 0x02, 0x00, // # - - // @704 'w' (5 pixels wide) - 0x03, 0xC0, // #### - 0x00, 0x30, // ## - 0x03, 0xC0, // #### - 0x00, 0x30, // ## - 0x03, 0xC0, // #### - - // @714 'x' (3 pixels wide) - 0x03, 0x30, // ## ## - 0x00, 0xC0, // ## - 0x03, 0x30, // ## ## - - // @720 'y' (3 pixels wide) - 0x03, 0xC4, // #### # - 0x00, 0x38, // ### - 0x03, 0xC0, // #### - - // @726 'z' (3 pixels wide) - 0x02, 0x30, // # ## - 0x02, 0xD0, // # ## # - 0x03, 0x10, // ## # - - // @732 '{' (3 pixels wide) - 0x00, 0x40, // # - 0x0F, 0xBC, // ##### #### - 0x08, 0x04, // # # - - // @738 '|' (1 pixels wide) - 0x0F, 0xFC, // ########## - - // @740 '}' (3 pixels wide) - 0x08, 0x04, // # # - 0x0F, 0xBC, // ##### #### - 0x00, 0x40, // # - - // @746 '~' (5 pixels wide) - 0x00, 0x40, // # - 0x00, 0x80, // # - 0x00, 0xC0, // ## - 0x00, 0x40, // # - 0x00, 0x80, // # -}; - -// Character descriptors for Franklin Gothic Medium Cond 8pt -// { [Char width in bits], [Char height in bits], [Offset into franklinGothicMediumCond_8ptCharBitmaps in bytes] } -const FONT_CHAR_INFO PROGMEM franklinGothicMediumCond_8ptDescriptors[] = -{ - {1, 15, 0}, // - {1, 15, 4}, // ! - {3, 15, 6}, // " - {6, 15, 12}, // # - {5, 15, 24}, // $ - {7, 15, 34}, // % - {6, 15, 48}, // & - {1, 15, 60}, // ' - {2, 15, 62}, // ( - {2, 15, 66}, // ) - {3, 15, 70}, // * - {5, 15, 76}, // + - {1, 15, 86}, // , - {2, 15, 88}, // - - {1, 15, 92}, // . - {5, 15, 94}, // / - {5, 15, 104}, // 0 - {3, 15, 114}, // 1 - {5, 15, 120}, // 2 - {5, 15, 130}, // 3 - {6, 15, 140}, // 4 - {5, 15, 152}, // 5 - {5, 15, 162}, // 6 - {5, 15, 172}, // 7 - {5, 15, 182}, // 8 - {5, 15, 192}, // 9 - {1, 15, 202}, // : - {1, 15, 204}, // ; - {5, 15, 206}, // < - {4, 15, 216}, // = - {5, 15, 224}, // > - {4, 15, 234}, // ? - {7, 15, 242}, // @ - {5, 15, 256}, // A - {5, 15, 266}, // B - {5, 15, 276}, // C - {5, 15, 286}, // D - {4, 15, 296}, // E - {4, 15, 304}, // F - {5, 15, 312}, // G - {5, 15, 322}, // H - {1, 15, 332}, // I - {2, 15, 334}, // J - {5, 15, 338}, // K - {4, 15, 348}, // L - {7, 15, 356}, // M - {5, 15, 370}, // N - {5, 15, 380}, // O - {4, 15, 390}, // P - {5, 15, 398}, // Q - {5, 15, 408}, // R - {5, 15, 418}, // S - {5, 15, 428}, // T - {5, 15, 438}, // U - {5, 15, 448}, // V - {7, 15, 458}, // W - {5, 15, 472}, // X - {5, 15, 482}, // Y - {4, 15, 492}, // Z - {2, 15, 500}, // [ - {4, 15, 504}, // \ . - {2, 15, 512}, // ] - {5, 15, 516}, // ^ - {6, 15, 526}, // _ - {2, 15, 538}, // ` - {4, 15, 542}, // a - {4, 15, 550}, // b - {4, 15, 558}, // c - {4, 15, 566}, // d - {4, 15, 574}, // e - {3, 15, 582}, // f - {5, 15, 588}, // g - {4, 15, 598}, // h - {1, 15, 606}, // i - {2, 15, 608}, // j - {4, 15, 612}, // k - {1, 15, 620}, // l - {7, 15, 622}, // m - {4, 15, 636}, // n - {4, 15, 644}, // o - {4, 15, 652}, // p - {4, 15, 660}, // q - {3, 15, 668}, // r - {3, 15, 674}, // s - {3, 15, 680}, // t - {4, 15, 686}, // u - {5, 15, 694}, // v - {5, 15, 704}, // w - {3, 15, 714}, // x - {3, 15, 720}, // y - {3, 15, 726}, // z - {3, 15, 732}, // { - {1, 15, 738}, // | - {3, 15, 740}, // } - {5, 15, 746}, // ~ -}; - - -// Font information for Franklin Gothic Medium Cond 8pt -const FONT_INFO franklinGothicMediumCond_8ptFontInfo = -{ - 15, // Character height - ' ', // Start character - 'z', // End character - 1, // Width, in pixels, of space character - franklinGothicMediumCond_8ptDescriptors, // Character descriptor array - franklinGothicMediumCond_8ptBitmaps, // Character bitmap array -}; - -// -// Font data for Franklin Gothic Medium Cond 7pt -// - -// Character bitmaps for Franklin Gothic Medium Cond 7pt -const uint8_t PROGMEM franklinGothicMediumCond_7ptBitmaps [] = -{ - // @0 ' ' (2 pixels wide) - 0x00, 0x00, // - 0x00, 0x00, // - - // @4 ',' (1 pixels wide) - 0xC0, // ## - - // @5 '.' (1 pixels wide) - 0x80, // # - - // @6 '/' (4 pixels wide) - 0x01, // # - 0x0E, // ### - 0x70, // ### - 0x80, // # - - // @10 '0' (4 pixels wide) - 0x78, // #### - 0x84, // # # - 0x84, // # # - 0x78, // #### - - // @14 '1' (3 pixels wide) - 0x44, // # # - 0xFC, // ###### - 0x04, // # - - // @17 '2' (4 pixels wide) - 0x44, // # # - 0x8C, // # ## - 0x94, // # # # - 0x64, // ## # - - // @21 '3' (4 pixels wide) - 0x48, // # # - 0x84, // # # - 0xA4, // # # # - 0x58, // # ## - - // @25 '4' (5 pixels wide) - 0x18, // ## - 0x68, // ## # - 0x88, // # # - 0xFC, // ###### - 0x08, // # - - // @30 '5' (4 pixels wide) - 0xE8, // ### # - 0xA4, // # # # - 0xA4, // # # # - 0x98, // # ## - - // @34 '6' (4 pixels wide) - 0x78, // #### - 0xA4, // # # # - 0xA4, // # # # - 0x18, // ## - - // @38 '7' (4 pixels wide) - 0x80, // # - 0x9C, // # ### - 0xA0, // # # - 0xC0, // ## - - // @42 '8' (4 pixels wide) - 0x58, // # ## - 0xA4, // # # # - 0xA4, // # # # - 0x58, // # ## - - // @46 '9' (4 pixels wide) - 0x60, // ## - 0x94, // # # # - 0x94, // # # # - 0x78, // #### - - // @50 ':' (1 pixels wide) - 0x88, // # # - - // @51 'A' (3 pixels wide) - 0x3C, // #### - 0xC8, // ## # - 0x3C, // #### - - // @54 'B' (4 pixels wide) - 0xFC, // ###### - 0xA4, // # # # - 0xA4, // # # # - 0x58, // # ## - - // @58 'C' (4 pixels wide) - 0x78, // #### - 0x84, // # # - 0x84, // # # - 0x48, // # # - - // @62 'D' (4 pixels wide) - 0xFC, // ###### - 0x84, // # # - 0x84, // # # - 0x78, // #### - - // @66 'E' (3 pixels wide) - 0xFC, // ###### - 0xA4, // # # # - 0xA4, // # # # - - // @69 'F' (3 pixels wide) - 0xFC, // ###### - 0x90, // # # - 0x90, // # # - - // @72 'G' (4 pixels wide) - 0x78, // #### - 0x84, // # # - 0x94, // # # # - 0x5C, // # ### - - // @76 'H' (4 pixels wide) - 0xFC, // ###### - 0x20, // # - 0x20, // # - 0xFC, // ###### - - // @80 'I' (1 pixels wide) - 0xFC, // ###### - - // @81 'J' (2 pixels wide) - 0x04, // # - 0xFC, // ###### - - // @83 'K' (4 pixels wide) - 0xFC, // ###### - 0x20, // # - 0x58, // # ## - 0x84, // # # - - // @87 'L' (3 pixels wide) - 0xFC, // ###### - 0x04, // # - 0x04, // # - - // @90 'M' (5 pixels wide) - 0xFC, // ###### - 0x60, // ## - 0x1C, // ### - 0x60, // ## - 0xFC, // ###### - - // @95 'N' (4 pixels wide) - 0xFC, // ###### - 0x60, // ## - 0x18, // ## - 0xFC, // ###### - - // @99 'O' (4 pixels wide) - 0x78, // #### - 0x84, // # # - 0x84, // # # - 0x78, // #### - - // @103 'P' (3 pixels wide) - 0xFC, // ###### - 0x90, // # # - 0x60, // ## - - // @106 'Q' (4 pixels wide) - 0x78, // #### - 0x84, // # # - 0x86, // # ## - 0x7A, // #### # - - // @110 'R' (4 pixels wide) - 0xFC, // ###### - 0x90, // # # - 0x98, // # ## - 0x64, // ## # - - // @114 'S' (4 pixels wide) - 0x48, // # # - 0xA4, // # # # - 0x94, // # # # - 0x48, // # # - - // @118 'T' (3 pixels wide) - 0x80, // # - 0xFC, // ###### - 0x80, // # - - // @121 'U' (4 pixels wide) - 0xF8, // ##### - 0x04, // # - 0x04, // # - 0xF8, // ##### - - // @125 'V' (3 pixels wide) - 0xF0, // #### - 0x0C, // ## - 0xF0, // #### - - // @128 'W' (5 pixels wide) - 0xF0, // #### - 0x0C, // ## - 0xF0, // #### - 0x0C, // ## - 0xF0, // #### - - // @133 'X' (3 pixels wide) - 0xCC, // ## ## - 0x30, // ## - 0xCC, // ## ## - - // @136 'Y' (5 pixels wide) - 0x80, // # - 0x60, // ## - 0x1C, // ### - 0x60, // ## - 0x80, // # - - // @141 'Z' (3 pixels wide) - 0x8C, // # ## - 0xB4, // # ## # - 0xC4, // ## # - - // @144 '\' (4 pixels wide) - 0x80, // # - 0x70, // ### - 0x0C, // ## - 0x03, // ## - - // @148 '`' (2 pixels wide) - 0x80, // # - 0x40, // # - - // @150 'a' (3 pixels wide) - 0x90, // # # - 0xA8, // # # # - 0x78, // #### - - // @153 'b' (3 pixels wide) - 0xFC, // ###### - 0x44, // # # - 0x38, // ### - - // @156 'c' (3 pixels wide) - 0x70, // ### - 0x88, // # # - 0x50, // # # - - // @159 'd' (3 pixels wide) - 0x38, // ### - 0x44, // # # - 0xFC, // ###### - - // @162 'e' (3 pixels wide) - 0x70, // ### - 0xA8, // # # # - 0x68, // ## # - - // @165 'f' (2 pixels wide) - 0x7C, // ##### - 0xA0, // # # - - // @167 'g' (4 pixels wide) - 0x2A, // # # # - 0x55, // # # # # - 0x65, // ## # # - 0x82, // # # - - // @171 'h' (3 pixels wide) - 0xFC, // ###### - 0x40, // # - 0x3C, // #### - - // @174 'i' (1 pixels wide) - 0xBE, // # ##### - - // @175 'j' (2 pixels wide) - 0x00, 0x80, // # - 0xBF, 0x80, // # ####### - - // @179 'k' (3 pixels wide) - 0xFC, // ###### - 0x30, // ## - 0x4C, // # ## - - // @182 'l' (1 pixels wide) - 0xFC, // ###### - - // @183 'm' (5 pixels wide) - 0xF8, // ##### - 0x80, // # - 0xF8, // ##### - 0x80, // # - 0x78, // #### - - // @188 'n' (3 pixels wide) - 0xF8, // ##### - 0x80, // # - 0x78, // #### - - // @191 'o' (3 pixels wide) - 0x70, // ### - 0x88, // # # - 0x70, // ### - - // @194 'p' (3 pixels wide) - 0xFE, // ####### - 0x88, // # # - 0x70, // ### - - // @197 'q' (3 pixels wide) - 0x70, // ### - 0x88, // # # - 0xFE, // ####### - - // @200 'r' (3 pixels wide) - 0xF8, // ##### - 0x40, // # - 0x80, // # - - // @203 's' (3 pixels wide) - 0x48, // # # - 0xA8, // # # # - 0x90, // # # - - // @206 't' (2 pixels wide) - 0xFC, // ###### - 0x44, // # # - - // @208 'u' (3 pixels wide) - 0xF0, // #### - 0x08, // # - 0xF8, // ##### - - // @211 'v' (3 pixels wide) - 0xE0, // ### - 0x18, // ## - 0xE0, // ### - - // @214 'w' (5 pixels wide) - 0xE0, // ### - 0x18, // ## - 0xE0, // ### - 0x18, // ## - 0xE0, // ### - - // @219 'x' (3 pixels wide) - 0x88, // # # - 0x70, // ### - 0x88, // # # - - // @222 'y' (3 pixels wide) - 0xE2, // ### # - 0x1C, // ### - 0xE0, // ### - - // @225 'z' (2 pixels wide) - 0xB8, // # ### - 0xC8, // ## # -}; - -// Character descriptors for Franklin Gothic Medium Cond 7pt -// { [Char width in bits], [Char height in bits], [Offset into franklinGothicMediumCond_7ptCharBitmaps in bytes] } -const FONT_CHAR_INFO PROGMEM franklinGothicMediumCond_7ptDescriptors[] = -{ - {1, 7, 0}, // - {0, 0, 0}, // ! - {0, 0, 0}, // " - {0, 0, 0}, // # - {0, 0, 0}, // $ - {0, 0, 0}, // % - {0, 0, 0}, // & - {0, 0, 0}, // ' - {0, 0, 0}, // ( - {0, 0, 0}, // ) - {0, 0, 0}, // * - {0, 0, 0}, // + - {1, 2, 4}, // , - {0, 0, 0}, // - - {1, 1, 5}, // . - {4, 8, 6}, // / - {4, 6, 10}, // 0 - {3, 6, 14}, // 1 - {4, 6, 17}, // 2 - {4, 6, 21}, // 3 - {5, 6, 25}, // 4 - {4, 6, 30}, // 5 - {4, 6, 34}, // 6 - {4, 6, 38}, // 7 - {4, 6, 42}, // 8 - {4, 6, 46}, // 9 - {1, 5, 50}, // : - {0, 0, 0}, // ; - {0, 0, 0}, // < - {0, 0, 0}, // = - {0, 0, 0}, // > - {0, 0, 0}, // ? - {0, 0, 0}, // @ - {3, 6, 51}, // A - {4, 6, 54}, // B - {4, 6, 58}, // C - {4, 6, 62}, // D - {3, 6, 66}, // E - {3, 6, 69}, // F - {4, 6, 72}, // G - {4, 6, 76}, // H - {1, 6, 80}, // I - {2, 6, 81}, // J - {4, 6, 83}, // K - {3, 6, 87}, // L - {5, 6, 90}, // M - {4, 6, 95}, // N - {4, 6, 99}, // O - {3, 6, 103}, // P - {4, 7, 106}, // Q - {4, 6, 110}, // R - {4, 6, 114}, // S - {3, 6, 118}, // T - {4, 6, 121}, // U - {3, 6, 125}, // V - {5, 6, 128}, // W - {3, 6, 133}, // X - {5, 6, 136}, // Y - {3, 6, 141}, // Z - {0, 0, 0}, // [ - {4, 8, 144}, // \ . - {0, 0, 0}, // ] - {0, 0, 0}, // ^ - {0, 0, 0}, // _ - {2, 2, 148}, // ` - {3, 5, 150}, // a - {3, 6, 153}, // b - {3, 5, 156}, // c - {3, 6, 159}, // d - {3, 5, 162}, // e - {2, 6, 165}, // f - {4, 8, 167}, // g - {3, 6, 171}, // h - {1, 7, 174}, // i - {2, 9, 175}, // j - {3, 6, 179}, // k - {1, 6, 182}, // l - {5, 5, 183}, // m - {3, 5, 188}, // n - {3, 5, 191}, // o - {3, 7, 194}, // p - {3, 7, 197}, // q - {3, 5, 200}, // r - {3, 5, 203}, // s - {2, 6, 206}, // t - {3, 5, 208}, // u - {3, 5, 211}, // v - {5, 5, 214}, // w - {3, 5, 219}, // x - {3, 7, 222}, // y - {2, 5, 225}, // z -}; - -// Font information for Franklin Gothic Medium Cond 7pt -const FONT_INFO franklinGothicMediumCond_7ptFontInfo = -{ - 12, // Character height - ' ', // Start character - 'z', // End character - 1, // width of space - franklinGothicMediumCond_7ptDescriptors, // Character descriptor array - franklinGothicMediumCond_7ptBitmaps, // Character bitmap array -}; - diff --git a/src/OLED/fonts/FranklinGothic.h b/src/OLED/fonts/FranklinGothic.h deleted file mode 100644 index f79ef14..0000000 --- a/src/OLED/fonts/FranklinGothic.h +++ /dev/null @@ -1,14 +0,0 @@ -#include "FontTypes.h" - -// Font data for Franklin Gothic Medium Cond 8pt -extern const uint8_t PROGMEM franklinGothicMediumCond_8ptBitmaps [] ; -extern const FONT_CHAR_INFO PROGMEM franklinGothicMediumCond_8ptDescriptors[] ; -extern const FONT_INFO franklinGothicMediumCond_8ptFontInfo; - -// Font data for Franklin Gothic Medium Cond 7pt -extern const uint8_t PROGMEM franklinGothicMediumCond_7ptBitmaps []; -extern const FONT_INFO franklinGothicMediumCond_7ptFontInfo; -extern const FONT_CHAR_INFO PROGMEM franklinGothicMediumCond_7ptDescriptors[]; - - - diff --git a/src/OLED/fonts/Icons.cpp b/src/OLED/fonts/Icons.cpp index 12191fe..aa79e65 100644 --- a/src/OLED/fonts/Icons.cpp +++ b/src/OLED/fonts/Icons.cpp @@ -447,43 +447,6 @@ const uint8_t verticalRepeatIcon [] PROGMEM = { }; const BITMAP_INFO verticalRepeatIconInfo(5, 11, verticalRepeatIcon); -// 'timerID1', 15x15px -const uint8_t timerID1Icon [] PROGMEM = { - 0x07, 0xc0, // ##### - 0x09, 0x20, // # # # - 0x11, 0x10, // # # # - 0x21, 0x08, // # # # - 0x2d, 0x08, // # ## # # - 0x25, 0xe8, // # # #### # - 0x24, 0x08, // # # # - 0x24, 0x08, // # # # - 0x10, 0x10, // # # - 0x08, 0x20, // # # - 0x07, 0xc0, // ##### - 0x00, 0x00, // - 0x00, 0x00 // -}; -const BITMAP_INFO TimerId1IconInfo(15, 13, timerID1Icon); - -// 'timerID2', 15x15px -const uint8_t timerID2Icon [] PROGMEM = { - 0x00, 0x00, // - 0x00, 0x00, // - 0x07, 0xc0, // ##### - 0x09, 0x20, // # # # - 0x11, 0x10, // # # # - 0x21, 0x08, // # # # - 0x2d, 0x08, // # ## # # - 0x25, 0xe8, // # # #### # - 0x28, 0x08, // # # # - 0x2c, 0x08, // # ## # - 0x10, 0x10, // # # - 0x08, 0x20, // # # - 0x07, 0xc0, // ##### - 0x00, 0x00, // - 0x00, 0x00 // -}; -const BITMAP_INFO TimerId2IconInfo(15, 15, timerID2Icon); // 'timer', 15x15px const uint8_t timerIcon [] PROGMEM = { @@ -558,61 +521,7 @@ const uint8_t PROGMEM verticalLargeRepeatIcon [] = }; const BITMAP_INFO VerticalRepeatLargeIconInfo(5, 15, verticalLargeRepeatIcon); -const uint8_t PROGMEM GPIO1OFFIcon[] = -{ - 0x3E, 0x00, // ##### - 0x41, 0x00, // # # - 0x88, 0x80, // # # # - 0x98, 0x80, // # ## # - 0x88, 0x80, // # # # - 0x88, 0x80, // # # # - 0x9C, 0x80, // # ### # - 0x41, 0x00, // # # - 0x3E, 0x00, // ##### -}; -const BITMAP_INFO GPIO1OffIconInfo(9, 9, GPIO1OFFIcon); -const uint8_t PROGMEM GPIO1ONIcon[] = -{ - 0x3E, 0x00, // ##### - 0x7F, 0x00, // ####### - 0xF7, 0x80, // #### #### - 0xE7, 0x80, // ### #### - 0xF7, 0x80, // #### #### - 0xF7, 0x80, // #### #### - 0xE3, 0x80, // ### ### - 0x7F, 0x00, // ####### - 0x3E, 0x00, // ##### -}; -const BITMAP_INFO GPIO1OnIconInfo(9, 9, GPIO1ONIcon); - -const uint8_t PROGMEM GPIO2OFFIcon[] = -{ - 0x3E, 0x00, // ##### - 0x41, 0x00, // # # - 0x9C, 0x80, // # ### # - 0x84, 0x80, // # # # - 0x9C, 0x80, // # ### # - 0x90, 0x80, // # # # - 0x9C, 0x80, // # ### # - 0x41, 0x00, // # # - 0x3E, 0x00, // ##### -}; -const BITMAP_INFO GPIO2OffIconInfo(9, 9, GPIO2OFFIcon); - -const uint8_t PROGMEM GPIO2ONIcon[] = -{ - 0x3E, 0x00, // ##### - 0x7F, 0x00, // ####### - 0xE3, 0x80, // ### ### - 0xFB, 0x80, // ##### ### - 0xE3, 0x80, // ### ### - 0xEF, 0x80, // ### ##### - 0xE3, 0x80, // ### ### - 0x7F, 0x00, // ####### - 0x3E, 0x00, // ##### -}; -const BITMAP_INFO GPIO2OnIconInfo(9, 9, GPIO2ONIcon); const uint8_t PROGMEM CrossIcon[] = { diff --git a/src/OLED/fonts/Tahoma16.c b/src/OLED/fonts/Tahoma16.c deleted file mode 100644 index 07ae5e0..0000000 --- a/src/OLED/fonts/Tahoma16.c +++ /dev/null @@ -1,314 +0,0 @@ -// -// Font data for Tahoma 16pt -// -// Generated by The Dot Factory: -// http://www.eran.io/the-dot-factory-an-lcd-font-and-image-generator/ -// -///////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Dot Factory Settings -// -// Flip/Rotate Padding Removal Line Wrap Descriptors -// [X] Flip X Height(Y): Tightest (O) At column [X] Generate descriptor array -// [ ] Flip Y Width(X): Tightest ( ) At bitmap Char Width: In Bits -// 90deg Char Height: In Bits -// Font Height: In Bits -// Comments Byte [ ] Multiple descriptor arrays -// [X] Variable Name Bit layout: RowMajor -// [X] BMP visualise [#] Order: MSBfirst Create new when exceeds [80] -// [X] Char descriptor Format: Hex -// Style: Cpp Leading: 0x Image width: In Bits -// Image height: In Bits -// Variable name format -// Bitmaps: const uint8_t PROGMEM {0}Bitmaps Space char generation -// Char Info: const FONT_CHAR_INFO PROGMEM {0}Descriptors [ ] Generate space bitmap -// Font Info: const FONT_INFO {0}FontInfo [2] pixels for space char -// Width: const uint8_t {0}Width -// Height: const uint8_t {0}Height -// -///////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "Tahoma16.h" - -// Character bitmaps for Tahoma 16pt -const uint8_t tahoma_16ptBitmaps[] PROGMEM = -{ - // @0 '.' (4 pixels wide) - 0x00, 0x0F, // #### - 0x00, 0x0F, // #### - 0x00, 0x0F, // #### - 0x00, 0x0F, // #### - - // @8 '0' (11 pixels wide) - 0x0F, 0xF0, // ######## - 0x3F, 0xFC, // ############ - 0x7F, 0xFE, // ############## - 0xFF, 0xFF, // ################ - 0xF0, 0x0F, // #### #### - 0xE0, 0x07, // ### ### - 0xF0, 0x0F, // #### #### - 0xFF, 0xFF, // ################ - 0x7F, 0xFE, // ############## - 0x3F, 0xFC, // ############ - 0x0F, 0xF0, // ######## - - // @30 '1' (10 pixels wide) - 0x38, 0x07, // ### ### - 0x38, 0x07, // ### ### - 0x38, 0x07, // ### ### - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0x00, 0x07, // ### - 0x00, 0x07, // ### - 0x00, 0x07, // ### - - // @50 '2' (11 pixels wide) - 0x70, 0x07, // ### ### - 0xE0, 0x0F, // ### #### - 0xE0, 0x1F, // ### ##### - 0xE0, 0x3F, // ### ###### - 0xE0, 0x7F, // ### ####### - 0xF1, 0xF7, // #### ##### ### - 0xFF, 0xE7, // ########### ### - 0x7F, 0xC7, // ######### ### - 0x7F, 0x87, // ######## ### - 0x3E, 0x07, // ##### ### - 0x00, 0x07, // ### - - // @72 '3' (11 pixels wide) - 0x70, 0x0E, // ### ### - 0xF0, 0x0F, // #### #### - 0xE0, 0x07, // ### ### - 0xE3, 0x87, // ### ### ### - 0xE3, 0x87, // ### ### ### - 0xE3, 0x87, // ### ### ### - 0xE7, 0xCF, // ### ##### #### - 0xFF, 0xFF, // ################ - 0x7E, 0xFE, // ###### ####### - 0x7E, 0xFE, // ###### ####### - 0x3C, 0x78, // #### #### - - // @94 '4' (12 pixels wide) - 0x00, 0xF0, // #### - 0x01, 0xF0, // ##### - 0x07, 0x70, // ### ### - 0x0E, 0x70, // ### ### - 0x38, 0x70, // ### ### - 0x70, 0x70, // ### ### - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0x00, 0x70, // ### - 0x00, 0x70, // ### - - // @118 '5' (11 pixels wide) - 0x00, 0x0E, // ### - 0xFF, 0x87, // ######### ### - 0xFF, 0x87, // ######### ### - 0xFF, 0x87, // ######### ### - 0xFF, 0x87, // ######### ### - 0xE3, 0x87, // ### ### ### - 0xE3, 0xCF, // ### #### #### - 0xE3, 0xFF, // ### ########## - 0xE3, 0xFE, // ### ######### - 0xE1, 0xFC, // ### ####### - 0xE0, 0xF8, // ### ##### - - // @140 '6' (11 pixels wide) - 0x07, 0xF0, // ####### - 0x1F, 0xFC, // ########### - 0x3F, 0xFE, // ############# - 0x7F, 0xFF, // ############### - 0xFB, 0x0F, // ##### ## #### - 0xF7, 0x07, // #### ### ### - 0xE7, 0x8F, // ### #### #### - 0xE7, 0xFF, // ### ########### - 0xE7, 0xFE, // ### ########## - 0xE3, 0xFC, // ### ######## - 0x01, 0xF8, // ###### - - // @162 '7' (11 pixels wide) - 0xE0, 0x01, // ### # - 0xE0, 0x07, // ### ### - 0xE0, 0x1F, // ### ##### - 0xE0, 0x7F, // ### ####### - 0xE1, 0xFF, // ### ######### - 0xE7, 0xFC, // ### ######### - 0xFF, 0xF0, // ############ - 0xFF, 0xC0, // ########## - 0xFF, 0x00, // ######## - 0xFC, 0x00, // ###### - 0xF0, 0x00, // #### - - // @184 '8' (11 pixels wide) - 0x3C, 0x3C, // #### #### - 0x7E, 0xFE, // ###### ####### - 0x7F, 0xFE, // ############## - 0xFF, 0xFF, // ################ - 0xE7, 0x8F, // ### #### #### - 0xE3, 0x87, // ### ### ### - 0xE3, 0xC7, // ### #### ### - 0xFF, 0xFF, // ################ - 0x7F, 0xFE, // ############## - 0x7E, 0xFE, // ###### ####### - 0x3C, 0x7C, // #### ##### - - // @206 '9' (11 pixels wide) - 0x1F, 0x80, // ###### - 0x3F, 0xC7, // ######## ### - 0x7F, 0xE7, // ########## ### - 0xFF, 0xE7, // ########### ### - 0xF1, 0xE7, // #### #### ### - 0xE0, 0xEF, // ### ### #### - 0xF0, 0xDF, // #### ## ##### - 0xFF, 0xFE, // ############### - 0x7F, 0xFC, // ############# - 0x3F, 0xF8, // ########### - 0x0F, 0xE0, // ####### - - // @228 '`' (8 pixels wide) - 0x3C, 0x00, // #### - 0x7E, 0x00, // ###### - 0xE7, 0x00, // ### ### - 0xC3, 0x00, // ## ## - 0xC3, 0x00, // ## ## - 0xE7, 0x00, // ### ### - 0x7E, 0x00, // ###### - 0x3C, 0x00, // #### - - // @244 'C' (12 pixels wide) - 0x07, 0xE0, // ###### - 0x1F, 0xF8, // ########## - 0x3F, 0xFC, // ############ - 0x7F, 0xFE, // ############## - 0xF8, 0x1F, // ##### ##### - 0xF0, 0x0F, // #### #### - 0xE0, 0x07, // ### ### - 0xE0, 0x07, // ### ### - 0xE0, 0x07, // ### ### - 0xE0, 0x07, // ### ### - 0x70, 0x0E, // ### ### - 0x78, 0x1E, // #### #### - - // @268 ':' (4 pixels wide) - 0x3C, 0x3C, // #### #### - 0x3C, 0x3C, // #### #### - 0x3C, 0x3C, // #### #### - 0x3C, 0x3C, // #### #### - - // @276 ' ' (4 pixels wide) - 0x00, 0x00, // - 0x00, 0x00, // - 0x00, 0x00, // - 0x00, 0x00, // - - // @284 '-' (4 pixels wide) - 0x03, 0xC0, // #### - 0x03, 0xC0, // #### - 0x03, 0xC0, // #### - 0x03, 0xC0, // #### - 0x03, 0xC0, // #### - 0x03, 0xC0, // #### - 0x03, 0xC0, // #### - 0x03, 0xC0, // #### - - // @300 'F' (9 pixels wide) - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0xFF, 0xFF, // ################ - 0xE3, 0x80, // ### ### - 0xE3, 0x80, // ### ### - 0xE3, 0x80, // ### ### - 0xE3, 0x80, // ### ### - 0xE3, 0x80, // ### ### - 0xE3, 0x80, // ### ### - -}; - -// Character descriptors for Tahoma 16pt -// { [Char width in bits], [Char height in bits], [Offset into tahoma_16ptCharBitmaps in bytes] } -const FONT_CHAR_INFO tahoma_16ptDescriptors[] PROGMEM = -{ - {4, 16, 276}, // ' ' - {0, 0, 0}, // '!' - {0, 0, 0}, // '"' - {0, 0, 0}, // '#' - {0, 0, 0}, // '$' - {0, 0, 0}, // '%' - {0, 0, 0}, // '&' - {0, 0, 0}, // ''' - {0, 0, 0}, // '(' - {0, 0, 0}, // ')' - {0, 0, 0}, // '*' - {0, 0, 0}, // '+' - {0, 0, 0}, // , - {8, 16, 284}, // - - {4, 16, 0}, // '.' - {0, 0, 0}, // '/' - {11, 16, 8}, // '0' - {10, 16, 30}, // '1' - {11, 16, 50}, // '2' - {11, 16, 72}, // '3' - {12, 16, 94}, // '4' - {11, 16, 118}, // '5' - {11, 16, 140}, // '6' - {11, 16, 162}, // '7' - {11, 16, 184}, // '8' - {11, 16, 206}, // '9' - {4, 16, 268}, // ':' - {0, 0, 0}, // ';' - {0, 0, 0}, // '<' - {0, 0, 0}, // '=' - {0, 0, 0}, // '>' - {0, 0, 0}, // '?' - {0, 0, 0}, // '@' - {0, 0, 0}, // 'A' - {0, 0, 0}, // 'B' - {12, 16, 244}, // 'C' - {0, 0, 0}, // 'D' - {0, 0, 0}, // 'E' - {10, 16, 300}, // 'F' - {0, 0, 0}, // 'G' - {0, 0, 0}, // 'H' - {0, 0, 0}, // 'I' - {0, 0, 0}, // 'J' - {0, 0, 0}, // 'K' - {0, 0, 0}, // 'L' - {0, 0, 0}, // 'M' - {0, 0, 0}, // 'N' - {0, 0, 0}, // 'O' - {0, 0, 0}, // 'P' - {0, 0, 0}, // 'Q' - {0, 0, 0}, // 'R' - {0, 0, 0}, // 'S' - {0, 0, 0}, // 'T' - {0, 0, 0}, // 'U' - {0, 0, 0}, // 'V' - {0, 0, 0}, // 'W' - {0, 0, 0}, // 'X' - {0, 0, 0}, // 'Y' - {0, 0, 0}, // 'Z' - {0, 0, 0}, // '[' - {0, 0, 0}, // '\' - {0, 0, 0}, // ']' - {0, 0, 0}, // '^' - {0, 0, 0}, // '_' - {8, 16, 228}, // '`' use for degree symbol -}; - -// Font information for Tahoma 16pt -// easier to leave in RAM, not that big anyway -const FONT_INFO tahoma_16ptFontInfo = -{ - 16, // Character height - ' ', // Start character - '`', // End character - 2, // Width, in pixels, of space character - tahoma_16ptDescriptors, // Character descriptor array - tahoma_16ptBitmaps, // Character bitmap array -}; diff --git a/src/OLED/fonts/Tahoma16.h b/src/OLED/fonts/Tahoma16.h deleted file mode 100644 index e3a185a..0000000 --- a/src/OLED/fonts/Tahoma16.h +++ /dev/null @@ -1,7 +0,0 @@ -#include "FontTypes.h" - -// Font data for Tahoma 16pt -extern const uint8_t tahoma_16ptBitmaps[] PROGMEM; // stored in program flash memory -extern const FONT_CHAR_INFO tahoma_16ptDescriptors[] PROGMEM; // stored in program flash memory -extern const FONT_INFO tahoma_16ptFontInfo; -