Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
467c43e
+ screen saver
cxandy Jul 23, 2017
ecb5599
add support AZSMZ TFT TOUCH
cxandy Nov 17, 2017
39f2363
add support AZSMZ TFT TOUCH
cxandy Nov 17, 2017
0f1a1c0
Add AZSMZ TFT TOUCH
cxandy Nov 17, 2017
eba3566
Update README.md
cxandy Nov 18, 2017
ab16fc1
Update README.md
cxandy Nov 18, 2017
221cc4f
Update README.md
cxandy Nov 23, 2017
665e221
Update README.md
cxandy Nov 23, 2017
55151f4
Add files via upload
cxandy Nov 23, 2017
744f37c
Update esp8266-weather-station-color.ino
cxandy Nov 27, 2017
932791c
Update README.md
cxandy Nov 27, 2017
ba2d544
Update README.md
cxandy Nov 27, 2017
c407f89
Update README.md
cxandy Nov 27, 2017
e903086
Update README.md
cxandy Nov 27, 2017
5ba27f1
Update README.md
cxandy Nov 27, 2017
7cbcc93
Update esp8266-weather-station-color.ino
cxandy Dec 17, 2017
15e59d5
Add files via upload
cxandy Dec 17, 2017
0902b5f
Update configportal.h
cxandy Dec 26, 2017
886a355
Update esp8266-weather-station-color.ino
cxandy Dec 26, 2017
6c2b8b7
Update esp8266-weather-station-color.ino
cxandy Dec 26, 2017
7b161f3
Update configportal.h
cxandy Dec 28, 2017
6b0c5f4
Update esp8266-weather-station-color.ino
cxandy Dec 28, 2017
8ecd930
Update README.md
cxandy Jan 3, 2018
eaf9945
Add files via upload
cxandy Jan 18, 2018
17d3b62
Add files via upload
cxandy Jan 18, 2018
5fed32d
Add files via upload
cxandy Jan 18, 2018
4ed1ffb
Add files via upload
cxandy Jan 18, 2018
64701cd
Create Flash.md
cxandy Jan 18, 2018
da3c104
Update Flash.md
cxandy Jan 18, 2018
54804dd
Update Flash.md
cxandy Jan 18, 2018
7fb661e
Update Flash.md
cxandy Jan 18, 2018
aafcf79
Update Flash.md
cxandy Jan 18, 2018
d5c8bb3
Update Flash.md
cxandy Jan 18, 2018
1c6accc
Update Flash.md
cxandy Jan 18, 2018
b7f2487
Update Flash.md
cxandy Jan 18, 2018
cb637d5
Update Flash.md
cxandy Jan 18, 2018
9aa4ea9
Update Flash.md
cxandy Jan 18, 2018
f32a52a
Update Flash.md
cxandy Jan 18, 2018
67cd5ce
Update Flash.md
cxandy Jan 18, 2018
fb006ab
Update Flash.md
cxandy Jan 18, 2018
0f69a87
Update Flash.md
cxandy Jan 18, 2018
fc12d71
Update Flash.md
cxandy Jan 18, 2018
8376208
Add files via upload
cxandy Jan 19, 2018
e623535
Add files via upload
cxandy Jan 19, 2018
65506d7
Add files via upload
cxandy Jan 19, 2018
49f6c44
Update README.md
cxandy Jan 19, 2018
21634bd
Update README.md
cxandy Jan 19, 2018
16a293d
Update README.md
cxandy Jan 19, 2018
2f7f862
Update README.md
cxandy Jan 19, 2018
07ae811
Add files via upload
cxandy Jan 19, 2018
9bcf263
Update README.md
cxandy Jan 19, 2018
09135d6
Update README.md
cxandy Jan 19, 2018
84c4fc5
Add files via upload
cxandy Jan 20, 2018
44146e2
Add files via upload
cxandy Jan 30, 2018
9cf4b11
Update Flash.md
cxandy Jan 30, 2018
6ac25fd
Update Flash.md
cxandy Jan 30, 2018
6d4f017
Update Flash.md
cxandy Jan 30, 2018
e1e4d6e
Add files via upload
cxandy Jan 30, 2018
29c3a5b
Delete A-TFT-WEATHER-20180120.bin
cxandy Jan 31, 2018
e922ed1
Add files via upload
cxandy Jan 31, 2018
bc03031
Update README.md
cxandy Jan 31, 2018
9ddb34f
Update README.md
cxandy Jan 31, 2018
bbe18b9
Update README.md
cxandy Jan 31, 2018
b104f6d
Update README.md
cxandy Jan 31, 2018
8b76a0b
Add files via upload
cxandy Jan 31, 2018
0c9288a
Add files via upload
cxandy Feb 24, 2018
1067ac8
Delete AZSMZ-TFT-TOUCH-1.6-WIRE.jpg
cxandy Feb 24, 2018
98b7677
Add files via upload
cxandy Feb 24, 2018
124bb14
Update README.md
cxandy Feb 24, 2018
8984fd0
Add files via upload
cxandy Feb 24, 2018
cd596ee
Delete dht11.jpg
cxandy Feb 24, 2018
a378524
Add files via upload
cxandy Feb 24, 2018
f50e162
Update README.md
cxandy Feb 24, 2018
1e5c397
Update README.md
cxandy Feb 24, 2018
3d49e2f
Update README.md
cxandy Feb 25, 2018
4c85142
Update README.md
cxandy Mar 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update esp8266-weather-station-color.ino
  • Loading branch information
cxandy authored Nov 27, 2017
commit 744f37c7844dc2da9e4643b3930f0d105b42f6ed
76 changes: 41 additions & 35 deletions esp8266-weather-station-color.ino
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ See more at https://blog.squix.org

int readNTC() {
float average = (4096 * 1.0 * serialResistance / XPT2046_ReadRaw(CFG_AUX)) - serialResistance;
Serial.print("NTC R=");
Serial.println(average);
// Serial.print("NTC R=");
// Serial.println(average);
float steinhart;
steinhart = average * 1.0 / nominalResistance; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
Expand Down Expand Up @@ -138,6 +138,22 @@ Carousel carousel(&gfx, 0, 0, 240, 100);

void calibrationCallback(int16_t x, int16_t y);
CalibrationCallback calibration = &calibrationCallback;

void touchCalibration() {
Serial.println("Touchpad calibration .....");
touchController.startCalibration(&calibration);
while (!touchController.isCalibrationFinished()) {
gfx.fillBuffer(0);
gfx.setColor(MINI_YELLOW);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.drawString(120, 160, "Please calibrate\ntouch screen by\ntouch point");
touchController.continueCalibration();
gfx.commit();
yield();
}
touchController.saveCalibration();
}

#endif

WGConditions conditions;
Expand Down Expand Up @@ -196,7 +212,6 @@ void setup() {
// The LED pin needs to set HIGH
// Use this pin to save energy
// Turn on the background LED
Serial.println(TFT_LED);
pinMode(TFT_LED, OUTPUT);

#ifdef TFT_LED_LOW
Expand All @@ -217,20 +232,8 @@ void setup() {
SPIFFS.begin();
//SPIFFS.remove("/calibration.txt");
boolean isCalibrationAvailable = touchController.loadCalibration();

if (!isCalibrationAvailable) {
Serial.println("Calibration not available");
touchController.startCalibration(&calibration);
while (!touchController.isCalibrationFinished()) {
gfx.fillBuffer(0);
gfx.setColor(MINI_YELLOW);
gfx.setTextAlignment(TEXT_ALIGN_CENTER);
gfx.drawString(120, 160, "Please calibrate\ntouch screen by\ntouch point");
touchController.continueCalibration();
gfx.commit();
yield();
}
touchController.saveCalibration();
touchCalibration();
}

#endif
Expand All @@ -245,7 +248,7 @@ void setup() {
}

long lastDrew = 0;
bool btnClick;
bool btnClick,btnLongClick;

float temperature = 0.0;

Expand Down Expand Up @@ -323,16 +326,15 @@ void loop() {
digitalWrite(TOUCH_CS, HIGH);
digitalWrite(BTN_1, 0);
pinMode(BTN_1, INPUT_PULLUP);
delay(1);
int btnState = digitalRead(BTN_1);
if (btnState == LOW){
if(canBtnPress){
timerPress = millis();
canBtnPress = false;
} else {
if ((!btnClick) && ((millis() - timerPress)>3000)) { // long press to pen init
SPIFFS.remove("/calibration.txt");
ESP.restart();
btnClick = true;
if ((!btnClick) && ((millis() - timerPress)>3000)) { // long press to pen init
btnLongClick = true;
}
}
}else if(!canBtnPress){
Expand All @@ -350,16 +352,17 @@ void loop() {

#ifdef HAVE_TOUCHPAD
power = XPT2046_ReadRaw(CFG_POWER) * 2.5 * 4 / 4096;
#ifdef NTC
temperature = readNTC()/10.0;
#endif
if (btnLongClick) {
touchCalibration();
btnLongClick = false;
}
#else
power = analogRead(A0) * 49 / 10240.0;
#endif

#ifdef NTC
temperature = readNTC()/10.0;
Serial.print("ntc:");
Serial.println(temperature);
#endif

gfx.fillBuffer(MINI_BLACK);
if (screen == 0) {
drawTime();
Expand Down Expand Up @@ -398,7 +401,9 @@ void loop() {
delay(1000);
drawProgress(100,"Going to Sleep!");
// go to deepsleep for xx minutes or 0 = permanently
XPT2046_EnableIrq();
#ifdef HAVE_TOUCHPAD
XPT2046_EnableIrq();
#endif
ESP.deepSleep(0, WAKE_RF_DEFAULT); // 0 delay = permanently to sleep
}

Expand Down Expand Up @@ -541,15 +546,16 @@ void drawCurrentWeather() {
degreeSign = "°C";
}

String temp = conditions.currentTemp + degreeSign;
#ifdef LM75
if (canBtnPress) temperature = lm75();
String temp = temperature + degreeSign;
#else
#ifdef NTC
String temp = temperature + degreeSign;
#else
String temp = conditions.currentTemp + degreeSign;
#endif
temp = temperature + degreeSign;
#endif

#ifdef HAVE_TOUCHPAD
#ifdef NTC
temp = (int)temperature + degreeSign;
#endif
#endif

gfx.drawString(220, 78, temp);
Expand Down