Small fixes for candy merge
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
#include "TouchController.h"
|
#include "TouchControllerWS.h"
|
||||||
|
|
||||||
TouchController::TouchController(XPT2046_Touchscreen *touchScreen) {
|
TouchControllerWS::TouchControllerWS(XPT2046_Touchscreen *touchScreen) {
|
||||||
this->touchScreen = touchScreen;
|
this->touchScreen = touchScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchController::loadCalibration() {
|
bool TouchControllerWS::loadCalibration() {
|
||||||
// always use this to "mount" the filesystem
|
// always use this to "mount" the filesystem
|
||||||
bool result = SPIFFS.begin();
|
bool result = SPIFFS.begin();
|
||||||
Serial.println("SPIFFS opened: " + result);
|
Serial.println("SPIFFS opened: " + result);
|
||||||
@@ -32,7 +32,7 @@ bool TouchController::loadCalibration() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchController::saveCalibration() {
|
bool TouchControllerWS::saveCalibration() {
|
||||||
bool result = SPIFFS.begin();
|
bool result = SPIFFS.begin();
|
||||||
|
|
||||||
// open the file in write mode
|
// open the file in write mode
|
||||||
@@ -49,12 +49,12 @@ bool TouchController::saveCalibration() {
|
|||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchController::startCalibration(CalibrationCallback *calibrationCallback) {
|
void TouchControllerWS::startCalibration(CalibrationCallback *calibrationCallback) {
|
||||||
state = 0;
|
state = 0;
|
||||||
this->calibrationCallback = calibrationCallback;
|
this->calibrationCallback = calibrationCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchController::continueCalibration() {
|
void TouchControllerWS::continueCalibration() {
|
||||||
TS_Point p = touchScreen->getPoint();
|
TS_Point p = touchScreen->getPoint();
|
||||||
|
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
@@ -80,22 +80,22 @@ void TouchController::continueCalibration() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool TouchController::isCalibrationFinished() {
|
bool TouchControllerWS::isCalibrationFinished() {
|
||||||
return state == 2;
|
return state == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchController::isTouched() {
|
bool TouchControllerWS::isTouched() {
|
||||||
touchScreen->touched();
|
touchScreen->touched();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchController::isTouched(int16_t debounceMillis) {
|
bool TouchControllerWS::isTouched(int16_t debounceMillis) {
|
||||||
if (touchScreen->touched() && millis() - lastTouched > debounceMillis) {
|
if (touchScreen->touched() && millis() - lastTouched > debounceMillis) {
|
||||||
lastTouched = millis();
|
lastTouched = millis();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TS_Point TouchController::getPoint() {
|
TS_Point TouchControllerWS::getPoint() {
|
||||||
TS_Point p = touchScreen->getPoint();
|
TS_Point p = touchScreen->getPoint();
|
||||||
int x = (p.y - ax) * dx;
|
int x = (p.y - ax) * dx;
|
||||||
int y = 320 - (p.x - ay) * dy;
|
int y = 320 - (p.x - ay) * dy;
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
#include <XPT2046_Touchscreen.h>
|
#include <XPT2046_Touchscreen.h>
|
||||||
|
|
||||||
#ifndef _TOUCH_CONTROLLERH_
|
#ifndef _TOUCH_CONTROLLERWSH_
|
||||||
#define _TOUCH_CONTROLLERH_
|
#define _TOUCH_CONTROLLERWSH_
|
||||||
|
|
||||||
typedef void (*CalibrationCallback)(int16_t x, int16_t y);
|
typedef void (*CalibrationCallback)(int16_t x, int16_t y);
|
||||||
|
|
||||||
class TouchController {
|
class TouchControllerWS {
|
||||||
public:
|
public:
|
||||||
TouchController(XPT2046_Touchscreen *touchScreen);
|
TouchControllerWS(XPT2046_Touchscreen *touchScreen);
|
||||||
bool loadCalibration();
|
bool loadCalibration();
|
||||||
bool saveCalibration();
|
bool saveCalibration();
|
||||||
void startCalibration(CalibrationCallback *callback);
|
void startCalibration(CalibrationCallback *callback);
|
||||||
@@ -18,13 +18,19 @@ SOFTWARE.
|
|||||||
See more at https://blog.squix.org
|
See more at https://blog.squix.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
* Important: see settings.h to configure your settings!!!
|
||||||
|
* ***************************/
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHPAD
|
#ifdef HAVE_TOUCHPAD
|
||||||
#include <XPT2046_Touchscreen.h>
|
#include <XPT2046_Touchscreen.h>
|
||||||
#include "TouchController.h"
|
#include "TouchControllerWS.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -49,10 +55,7 @@ See more at https://blog.squix.org
|
|||||||
#include "moonphases.h"
|
#include "moonphases.h"
|
||||||
#include "weathericons.h"
|
#include "weathericons.h"
|
||||||
|
|
||||||
/*****************************
|
|
||||||
* Important: see settings.h to configure your settings!!!
|
|
||||||
* ***************************/
|
|
||||||
#include "settings.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define MINI_BLACK 0
|
#define MINI_BLACK 0
|
||||||
@@ -85,7 +88,7 @@ Carousel carousel(&gfx, 0, 0, 240, 100);
|
|||||||
|
|
||||||
#ifdef HAVE_TOUCHPAD
|
#ifdef HAVE_TOUCHPAD
|
||||||
XPT2046_Touchscreen ts(TOUCH_CS, TOUCH_IRQ);
|
XPT2046_Touchscreen ts(TOUCH_CS, TOUCH_IRQ);
|
||||||
TouchController touchController(&ts);
|
TouchControllerWS touchController(&ts);
|
||||||
|
|
||||||
void calibrationCallback(int16_t x, int16_t y);
|
void calibrationCallback(int16_t x, int16_t y);
|
||||||
CalibrationCallback calibration = &calibrationCallback;
|
CalibrationCallback calibration = &calibrationCallback;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const int SLEEP_INTERVAL_SECS = 0; // Going to Sleep after idle times, set 0 f
|
|||||||
// e.g. http://api.wunderground.com/api/808ba87ed77c4511/conditions/q/CA/SAN_FRANCISCO.json <- note that in the US you use the state instead of country code
|
// e.g. http://api.wunderground.com/api/808ba87ed77c4511/conditions/q/CA/SAN_FRANCISCO.json <- note that in the US you use the state instead of country code
|
||||||
|
|
||||||
const String DISPLAYED_CITY_NAME = "Zürich";
|
const String DISPLAYED_CITY_NAME = "Zürich";
|
||||||
const String WUNDERGRROUND_API_KEY = "WUNDERGROUND_API_KEY";
|
const String WUNDERGRROUND_API_KEY = "WUNDERGROUND_KEY";
|
||||||
const String WUNDERGRROUND_LANGUAGE = "EN";
|
const String WUNDERGRROUND_LANGUAGE = "EN";
|
||||||
const String WUNDERGROUND_COUNTRY = "CH";
|
const String WUNDERGROUND_COUNTRY = "CH";
|
||||||
const String WUNDERGROUND_CITY = "Zurich";
|
const String WUNDERGROUND_CITY = "Zurich";
|
||||||
|
|||||||
Reference in New Issue
Block a user