2020-04-01 08:07:17 +00:00
|
|
|
|
|
|
|
#include <Wire.h>
|
|
|
|
#include <Adafruit_GFX.h>
|
|
|
|
#include <Adafruit_SSD1306.h>
|
|
|
|
|
|
|
|
#include "display.h"
|
|
|
|
#include "settings.h"
|
2020-11-03 19:11:10 +00:00
|
|
|
#include "pins.h"
|
2020-04-01 08:07:17 +00:00
|
|
|
|
2020-05-11 11:42:29 +00:00
|
|
|
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
|
2020-04-01 08:07:17 +00:00
|
|
|
|
|
|
|
void setup_display()
|
|
|
|
{
|
|
|
|
pinMode(OLED_RST, OUTPUT);
|
|
|
|
digitalWrite(OLED_RST, LOW);
|
|
|
|
delay(20);
|
|
|
|
digitalWrite(OLED_RST, HIGH);
|
|
|
|
|
|
|
|
Wire.begin(OLED_SDA, OLED_SCL);
|
|
|
|
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false))
|
|
|
|
{
|
|
|
|
Serial.println("SSD1306 allocation failed");
|
|
|
|
while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
display.clearDisplay();
|
|
|
|
display.setTextColor(WHITE);
|
|
|
|
display.setTextSize(1);
|
|
|
|
display.setCursor(0,0);
|
|
|
|
display.print("LORA SENDER ");
|
2020-04-03 21:21:35 +00:00
|
|
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
|
|
|
display.ssd1306_command(1);
|
2020-04-01 08:07:17 +00:00
|
|
|
display.display();
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_display(String header, int wait)
|
|
|
|
{
|
|
|
|
display.clearDisplay();
|
|
|
|
display.setTextColor(WHITE);
|
|
|
|
display.setTextSize(2);
|
|
|
|
display.setCursor(0,0);
|
|
|
|
display.println(header);
|
2020-04-03 21:21:35 +00:00
|
|
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
|
|
|
display.ssd1306_command(1);
|
2020-04-01 08:07:17 +00:00
|
|
|
display.display();
|
|
|
|
delay(wait);
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_display(String header, String line1, int wait)
|
|
|
|
{
|
|
|
|
display.clearDisplay();
|
|
|
|
display.setTextColor(WHITE);
|
|
|
|
display.setTextSize(2);
|
|
|
|
display.setCursor(0,0);
|
|
|
|
display.println(header);
|
|
|
|
display.setTextSize(1);
|
|
|
|
display.setCursor(0,16);
|
|
|
|
display.println(line1);
|
2020-04-03 21:21:35 +00:00
|
|
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
|
|
|
display.ssd1306_command(1);
|
2020-04-01 08:07:17 +00:00
|
|
|
display.display();
|
|
|
|
delay(wait);
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_display(String header, String line1, String line2, int wait)
|
|
|
|
{
|
|
|
|
display.clearDisplay();
|
|
|
|
display.setTextColor(WHITE);
|
|
|
|
display.setTextSize(2);
|
|
|
|
display.setCursor(0,0);
|
|
|
|
display.println(header);
|
|
|
|
display.setTextSize(1);
|
|
|
|
display.setCursor(0,16);
|
|
|
|
display.println(line1);
|
|
|
|
display.setCursor(0,26);
|
|
|
|
display.println(line2);
|
2020-04-03 21:21:35 +00:00
|
|
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
|
|
|
display.ssd1306_command(1);
|
2020-04-01 08:07:17 +00:00
|
|
|
display.display();
|
|
|
|
delay(wait);
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_display(String header, String line1, String line2, String line3, int wait)
|
|
|
|
{
|
|
|
|
display.clearDisplay();
|
|
|
|
display.setTextColor(WHITE);
|
|
|
|
display.setTextSize(2);
|
|
|
|
display.setCursor(0,0);
|
|
|
|
display.println(header);
|
|
|
|
display.setTextSize(1);
|
|
|
|
display.setCursor(0,16);
|
|
|
|
display.println(line1);
|
|
|
|
display.setCursor(0,26);
|
|
|
|
display.println(line2);
|
|
|
|
display.setCursor(0,36);
|
|
|
|
display.println(line3);
|
2020-04-03 21:21:35 +00:00
|
|
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
|
|
|
display.ssd1306_command(1);
|
2020-04-01 08:07:17 +00:00
|
|
|
display.display();
|
|
|
|
delay(wait);
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_display(String header, String line1, String line2, String line3, String line4, int wait)
|
|
|
|
{
|
|
|
|
display.clearDisplay();
|
|
|
|
display.setTextColor(WHITE);
|
|
|
|
display.setTextSize(2);
|
|
|
|
display.setCursor(0,0);
|
|
|
|
display.println(header);
|
|
|
|
display.setTextSize(1);
|
|
|
|
display.setCursor(0,16);
|
|
|
|
display.println(line1);
|
|
|
|
display.setCursor(0,26);
|
|
|
|
display.println(line2);
|
|
|
|
display.setCursor(0,36);
|
|
|
|
display.println(line3);
|
|
|
|
display.setCursor(0,46);
|
|
|
|
display.println(line4);
|
2020-04-03 21:21:35 +00:00
|
|
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
|
|
|
display.ssd1306_command(1);
|
2020-04-01 08:07:17 +00:00
|
|
|
display.display();
|
|
|
|
delay(wait);
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait)
|
|
|
|
{
|
|
|
|
display.clearDisplay();
|
|
|
|
display.setTextColor(WHITE);
|
|
|
|
display.setTextSize(2);
|
|
|
|
display.setCursor(0,0);
|
|
|
|
display.println(header);
|
|
|
|
display.setTextSize(1);
|
|
|
|
display.setCursor(0,16);
|
|
|
|
display.println(line1);
|
|
|
|
display.setCursor(0,26);
|
|
|
|
display.println(line2);
|
|
|
|
display.setCursor(0,36);
|
|
|
|
display.println(line3);
|
|
|
|
display.setCursor(0,46);
|
|
|
|
display.println(line4);
|
|
|
|
display.setCursor(0,56);
|
|
|
|
display.println(line5);
|
2020-04-03 21:21:35 +00:00
|
|
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
|
|
|
display.ssd1306_command(1);
|
2020-04-01 08:07:17 +00:00
|
|
|
display.display();
|
|
|
|
delay(wait);
|
|
|
|
}
|