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;
|
||||
}
|
||||
|
||||
bool TouchController::loadCalibration() {
|
||||
|
||||
bool TouchControllerWS::loadCalibration() {
|
||||
// always use this to "mount" the filesystem
|
||||
bool result = SPIFFS.begin();
|
||||
Serial.println("SPIFFS opened: " + result);
|
||||
@@ -32,7 +32,7 @@ bool TouchController::loadCalibration() {
|
||||
|
||||
}
|
||||
|
||||
bool TouchController::saveCalibration() {
|
||||
bool TouchControllerWS::saveCalibration() {
|
||||
bool result = SPIFFS.begin();
|
||||
|
||||
// open the file in write mode
|
||||
@@ -49,12 +49,12 @@ bool TouchController::saveCalibration() {
|
||||
f.close();
|
||||
}
|
||||
|
||||
void TouchController::startCalibration(CalibrationCallback *calibrationCallback) {
|
||||
void TouchControllerWS::startCalibration(CalibrationCallback *calibrationCallback) {
|
||||
state = 0;
|
||||
this->calibrationCallback = calibrationCallback;
|
||||
}
|
||||
|
||||
void TouchController::continueCalibration() {
|
||||
void TouchControllerWS::continueCalibration() {
|
||||
TS_Point p = touchScreen->getPoint();
|
||||
|
||||
if (state == 0) {
|
||||
@@ -80,22 +80,22 @@ void TouchController::continueCalibration() {
|
||||
|
||||
}
|
||||
}
|
||||
bool TouchController::isCalibrationFinished() {
|
||||
bool TouchControllerWS::isCalibrationFinished() {
|
||||
return state == 2;
|
||||
}
|
||||
|
||||
bool TouchController::isTouched() {
|
||||
bool TouchControllerWS::isTouched() {
|
||||
touchScreen->touched();
|
||||
}
|
||||
|
||||
bool TouchController::isTouched(int16_t debounceMillis) {
|
||||
bool TouchControllerWS::isTouched(int16_t debounceMillis) {
|
||||
if (touchScreen->touched() && millis() - lastTouched > debounceMillis) {
|
||||
lastTouched = millis();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
TS_Point TouchController::getPoint() {
|
||||
TS_Point TouchControllerWS::getPoint() {
|
||||
TS_Point p = touchScreen->getPoint();
|
||||
int x = (p.y - ax) * dx;
|
||||
int y = 320 - (p.x - ay) * dy;
|
||||
@@ -1,14 +1,14 @@
|
||||
#include <FS.h>
|
||||
#include <XPT2046_Touchscreen.h>
|
||||
|
||||
#ifndef _TOUCH_CONTROLLERH_
|
||||
#define _TOUCH_CONTROLLERH_
|
||||
#ifndef _TOUCH_CONTROLLERWSH_
|
||||
#define _TOUCH_CONTROLLERWSH_
|
||||
|
||||
typedef void (*CalibrationCallback)(int16_t x, int16_t y);
|
||||
|
||||
class TouchController {
|
||||
class TouchControllerWS {
|
||||
public:
|
||||
TouchController(XPT2046_Touchscreen *touchScreen);
|
||||
TouchControllerWS(XPT2046_Touchscreen *touchScreen);
|
||||
bool loadCalibration();
|
||||
bool saveCalibration();
|
||||
void startCalibration(CalibrationCallback *callback);
|
||||
@@ -18,13 +18,19 @@ SOFTWARE.
|
||||
See more at https://blog.squix.org
|
||||
*/
|
||||
|
||||
|
||||
/*****************************
|
||||
* Important: see settings.h to configure your settings!!!
|
||||
* ***************************/
|
||||
#include "settings.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <SPI.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
|
||||
#ifdef HAVE_TOUCHPAD
|
||||
#include <XPT2046_Touchscreen.h>
|
||||
#include "TouchController.h"
|
||||
#include "TouchControllerWS.h"
|
||||
#endif
|
||||
|
||||
/***
|
||||
@@ -49,10 +55,7 @@ See more at https://blog.squix.org
|
||||
#include "moonphases.h"
|
||||
#include "weathericons.h"
|
||||
|
||||
/*****************************
|
||||
* Important: see settings.h to configure your settings!!!
|
||||
* ***************************/
|
||||
#include "settings.h"
|
||||
|
||||
|
||||
|
||||
#define MINI_BLACK 0
|
||||
@@ -85,7 +88,7 @@ Carousel carousel(&gfx, 0, 0, 240, 100);
|
||||
|
||||
#ifdef HAVE_TOUCHPAD
|
||||
XPT2046_Touchscreen ts(TOUCH_CS, TOUCH_IRQ);
|
||||
TouchController touchController(&ts);
|
||||
TouchControllerWS touchController(&ts);
|
||||
|
||||
void calibrationCallback(int16_t x, int16_t y);
|
||||
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
|
||||
|
||||
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 WUNDERGROUND_COUNTRY = "CH";
|
||||
const String WUNDERGROUND_CITY = "Zurich";
|
||||
|
||||
Reference in New Issue
Block a user