pull/18/head
lewisxhe 2019-06-28 09:29:58 +08:00
rodzic e6f6120a09
commit 749693133d
5 zmienionych plików z 2068 dodań i 5 usunięć

Wyświetl plik

@ -5,6 +5,7 @@
#include <Button2.h>
#include "esp_adc_cal.h"
#include <Ticker.h>
#include "bmp.h"
#define TFT_MOSI 19
#define TFT_SCLK 18
@ -12,11 +13,12 @@
#define TFT_DC 16
#define TFT_RST 23
#define TFT_BL 14 // Dispaly backlight control pin
#define ADC_PIN 34
#define BUTTON_1 35
#define BUTTON_2 0
#define BUTTONS_MAP {BUTTON_1,BUTTON_2}
#define TFT_BL 4 // Dispaly backlight control pin
#define ADC_EN 14
#define ADC_PIN 34
#define BUTTON_1 35
#define BUTTON_2 0
#define BUTTONS_MAP {BUTTON_1,BUTTON_2}
TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke custom library
@ -35,6 +37,7 @@ void showVoltage()
uint16_t v = analogRead(ADC_PIN);
float battery_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
String voltage = "Voltage :" + String(battery_voltage) + "V";
Serial.println(voltage);
tft.fillScreen(TFT_BLACK);
tft.setTextDatum(MC_DATUM);
tft.drawString(voltage, tft.width() / 2, tft.height() / 2 );
@ -56,6 +59,8 @@ void button_init()
tft.drawString("Press again to wake up", tft.width() / 2, tft.height() / 2 );
delay(6000);
digitalWrite(TFT_BL, !r);
tft.writecommand(TFT_DISPOFF);
tft.writecommand(TFT_SLPIN);
esp_sleep_enable_ext1_wakeup(GPIO_SEL_35, ESP_EXT1_WAKEUP_ALL_LOW);
esp_deep_sleep_start();
});
@ -108,6 +113,7 @@ void wifi_scan()
tft.println(buff);
}
}
WiFi.mode(WIFI_OFF);
}
void setup()
@ -115,6 +121,7 @@ void setup()
Serial.begin(115200);
delay(1000);
Serial.println("Start");
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
@ -130,6 +137,20 @@ void setup()
digitalWrite(TFT_BL, HIGH);
}
tft.setRotation(1);
tft.pushImage(0, 0, 240, 135, ttgo);
delay(5000);
tft.setRotation(0);
int i = 5;
while (i--) {
tft.fillScreen(TFT_RED);
delay(1000);
tft.fillScreen(TFT_BLUE);
delay(1000);
tft.fillScreen(TFT_GREEN);
delay(1000);
}
button_init();
esp_adc_cal_characteristics_t adc_chars;

2042
bmp.h 100644

Plik diff jest za duży Load Diff

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.