Fix the compat problem with previous platformio version
This commit is contained in:
parent
7f61520933
commit
6a14f0af4b
|
@ -2,4 +2,6 @@
|
||||||
.clang_complete
|
.clang_complete
|
||||||
.ccls
|
.ccls
|
||||||
.cache/
|
.cache/
|
||||||
|
build/
|
||||||
|
|
||||||
*~
|
*~
|
|
@ -0,0 +1,17 @@
|
||||||
|
PLT=$(HOME)/.platformio/penv/bin/pio
|
||||||
|
install-platform:
|
||||||
|
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||||
|
|
||||||
|
compile:
|
||||||
|
$(PLT) run
|
||||||
|
|
||||||
|
upload:
|
||||||
|
$(PLT) run -t upload
|
||||||
|
|
||||||
|
dlist:
|
||||||
|
$(PLT) device list
|
||||||
|
|
||||||
|
monitor:
|
||||||
|
$(PLT) device monitor
|
||||||
|
|
||||||
|
all: compile upload
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,11 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
Import("env")
|
||||||
|
|
||||||
|
# include toolchain paths
|
||||||
|
env.Replace(COMPILATIONDB_INCLUDE_TOOLCHAIN=True)
|
||||||
|
print(">> ", env)
|
||||||
|
# override compilation DB path
|
||||||
|
# path = os.path.join("$BUILD_DIR", "compile_commands.json")
|
||||||
|
# print(">> ", path)
|
||||||
|
# env.Replace(COMPILATIONDB_PATH=path)
|
|
@ -29,10 +29,11 @@
|
||||||
//#include <Fonts/FreeMonoOblique9pt7b.h>
|
//#include <Fonts/FreeMonoOblique9pt7b.h>
|
||||||
//#include <Fonts/FreeMono12pt7b.h>
|
//#include <Fonts/FreeMono12pt7b.h>
|
||||||
|
|
||||||
namespace Euler {
|
|
||||||
class Face : public Watchy {
|
class Face : public Watchy {
|
||||||
public:
|
public:
|
||||||
|
Face(const watchySettings &s) : Watchy(s) {}
|
||||||
void drawWatchFace();
|
void drawWatchFace();
|
||||||
};
|
};
|
||||||
} // namespace Euler
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,16 +27,17 @@
|
||||||
|
|
||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include <Fonts/FreeMono12pt7b.h>
|
#include <Fonts/FreeMono12pt7b.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class Watchy;
|
class Watchy;
|
||||||
|
|
||||||
namespace Euler {
|
class Home : public Screen {
|
||||||
class Home : public Screen{
|
public:
|
||||||
public:
|
Home(Watchy &w) : Screen(w){};
|
||||||
Home(Watchy &w) : Screen(w) {};
|
uint8_t getBattery();
|
||||||
uint8_t getBattery();
|
std::string getAccel();
|
||||||
void draw() override;
|
void draw() override;
|
||||||
};
|
};
|
||||||
} // namespace Euler
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,16 +27,14 @@
|
||||||
|
|
||||||
#include <Watchy.h>
|
#include <Watchy.h>
|
||||||
|
|
||||||
namespace Euler {
|
class Screen {
|
||||||
|
protected:
|
||||||
|
Watchy &api;
|
||||||
|
Screen *parent;
|
||||||
|
|
||||||
class Screen {
|
public:
|
||||||
protected:
|
Screen(Watchy &api, Screen *parent = nullptr) : api(api), parent(parent){};
|
||||||
Watchy &api;
|
virtual void draw();
|
||||||
Screen *parent;
|
};
|
||||||
public:
|
|
||||||
Screen(Watchy &api, Screen *parent = nullptr) : api(api), parent(parent) {};
|
|
||||||
virtual void draw();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/* -*- C++ -*-
|
||||||
|
* Euler - A watchy firmware for crazy people.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SETTINGS_H
|
||||||
|
#define SETTINGS_H
|
||||||
|
|
||||||
|
//Weather Settings
|
||||||
|
#define CITY_ID "2964574" //Dublin Ireland https://openweathermap.org/current#cityid
|
||||||
|
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id=" //open weather api
|
||||||
|
#define TEMP_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
|
#define TEMP_LANG "en"
|
||||||
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
//NTP Settings
|
||||||
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
|
#define GMT_OFFSET_SEC 3600 * 1 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
// wifi
|
||||||
|
#define WIFI_AP_TIMEOUT 60
|
||||||
|
#define WIFI_AP_SSID "Watchy AP"
|
||||||
|
|
||||||
|
watchySettings settings{
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
.weatherLang = TEMP_LANG,
|
||||||
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
|
.ntpServer = NTP_SERVER,
|
||||||
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -9,16 +9,29 @@
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev]
|
||||||
platform = espressif32
|
;platform = espressif32
|
||||||
|
platform = espressif32 @ ^6.0.1
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/sqfmi/Watchy
|
;https://github.com/sqfmi/Watchy
|
||||||
|
sqfmi/Watchy ;
|
||||||
|
https://github.com/tzapu/WiFiManager.git#v2.0.11-beta
|
||||||
lib_ldf_mode = deep+
|
lib_ldf_mode = deep+
|
||||||
board_build.partitions = min_spiffs.csv
|
board_build.partitions = min_spiffs.csv
|
||||||
;
|
extra_scripts = pre:compile_commands.py
|
||||||
|
|
||||||
upload_port = /dev/ttyUSB0
|
upload_port = /dev/ttyUSB0
|
||||||
monitor_port = /dev/ttyUSB0
|
monitor_port = /dev/ttyUSB0
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
|
;upload_speed = 3000000
|
||||||
|
|
||||||
|
; upload_speed = 3000000
|
||||||
|
; upload_port = /dev/cu.usbserial-MQK8G8
|
||||||
|
; monitor_port = /dev/cu.usbserial-MQK8G8
|
||||||
|
; monitor_speed = 115200
|
||||||
|
; monitor_filters = esp32_exception_decoder
|
||||||
|
|
||||||
|
[platformio]
|
||||||
|
build_dir=./build
|
|
@ -1,8 +1,25 @@
|
||||||
|
#define ARDUINO_WATCHY_V20
|
||||||
#include "Face.h"
|
#include "Face.h"
|
||||||
|
#include "Settings.h"
|
||||||
|
|
||||||
Euler::Face face;
|
Face face(settings);
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
|
WiFiManager wm;
|
||||||
|
bool res;
|
||||||
|
Serial.begin(115200);
|
||||||
|
// res = wm.autoConnect("EulerAP","password");
|
||||||
|
wm.preloadWiFi("Marissa-mns", "wx2KpsbjG2pd");
|
||||||
|
// if(!res) {
|
||||||
|
// Serial.println("Failed to connect");
|
||||||
|
// // ESP.restart();
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// //if you get here you have connected to the WiFi
|
||||||
|
// Serial.println("connected...yeey :)");
|
||||||
|
// face.showSyncNTP();
|
||||||
|
// }
|
||||||
|
|
||||||
face.init();
|
face.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
src/Face.cpp
20
src/Face.cpp
|
@ -27,9 +27,7 @@
|
||||||
#include "esp32-hal-cpu.h"
|
#include "esp32-hal-cpu.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
|
||||||
namespace Euler{
|
void Face::drawWatchFace() {
|
||||||
|
|
||||||
void Face::drawWatchFace(){
|
|
||||||
Home home(Home(*this));
|
Home home(Home(*this));
|
||||||
|
|
||||||
home.draw();
|
home.draw();
|
||||||
|
@ -45,9 +43,10 @@ void Face::drawWatchFace(){
|
||||||
// //drawSteps();
|
// //drawSteps();
|
||||||
// drawWeather();
|
// drawWeather();
|
||||||
// drawBattery();
|
// drawBattery();
|
||||||
// display.drawBitmap(120, 77, WIFI_CONFIGURED ? wifi : wifioff, 26, 18, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
// display.drawBitmap(120, 77, WIFI_CONFIGURED ? wifi : wifioff, 26, 18,
|
||||||
// if(BLE_CONFIGURED){
|
// DARKMODE ? GxEPD_WHITE : GxEPD_BLACK); if(BLE_CONFIGURED){
|
||||||
// display.drawBitmap(100, 75, bluetooth, 13, 21, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
// display.drawBitmap(100, 75, bluetooth, 13, 21, DARKMODE ? GxEPD_WHITE
|
||||||
|
// : GxEPD_BLACK);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -110,8 +109,9 @@ void Face::drawWatchFace(){
|
||||||
// display.getTextBounds(String(temperature), 100, 150, &x1, &y1, &w, &h);
|
// display.getTextBounds(String(temperature), 100, 150, &x1, &y1, &w, &h);
|
||||||
// display.setCursor(155 - w, 150);
|
// display.setCursor(155 - w, 150);
|
||||||
// display.println(temperature);
|
// display.println(temperature);
|
||||||
// display.drawBitmap(165, 110, strcmp(TEMP_UNIT, "metric") == 0 ? celsius : fahrenheit, 26, 20, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
// display.drawBitmap(165, 110, strcmp(TEMP_UNIT, "metric") == 0 ? celsius :
|
||||||
// const unsigned char* weatherIcon;
|
// fahrenheit, 26, 20, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK); const unsigned
|
||||||
|
// char* weatherIcon;
|
||||||
|
|
||||||
// //https://openweathermap.org/weather-conditions
|
// //https://openweathermap.org/weather-conditions
|
||||||
// if(weatherConditionCode > 801){//Cloudy
|
// if(weatherConditionCode > 801){//Cloudy
|
||||||
|
@ -132,6 +132,6 @@ void Face::drawWatchFace(){
|
||||||
// weatherIcon = rain;
|
// weatherIcon = rain;
|
||||||
// }else
|
// }else
|
||||||
// return;
|
// return;
|
||||||
// display.drawBitmap(145, 158, weatherIcon, WEATHER_ICON_WIDTH, WEATHER_ICON_HEIGHT, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
// display.drawBitmap(145, 158, weatherIcon, WEATHER_ICON_WIDTH,
|
||||||
|
// WEATHER_ICON_HEIGHT, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
|
|
61
src/Home.cpp
61
src/Home.cpp
|
@ -23,11 +23,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Home.h"
|
#include "Home.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
#define DARKMODE true
|
#define DARKMODE true
|
||||||
|
|
||||||
namespace Euler {
|
|
||||||
|
|
||||||
uint8_t Home::getBattery() {
|
uint8_t Home::getBattery() {
|
||||||
float VBAT = api.getBatteryVoltage();
|
float VBAT = api.getBatteryVoltage();
|
||||||
|
|
||||||
|
@ -45,12 +44,62 @@ uint8_t Home::getBattery() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Home::getAccel() {
|
||||||
|
Accel acc;
|
||||||
|
std::string s("");
|
||||||
|
|
||||||
|
long previousMillis = 0;
|
||||||
|
long interval = 200;
|
||||||
|
|
||||||
|
// unsigned long currentMillis = millis();
|
||||||
|
|
||||||
|
// if (currentMillis - previousMillis > interval) {
|
||||||
|
//previousMillis = currentMillis;
|
||||||
|
// Get acceleration data
|
||||||
|
bool res = sensor.getAccel(acc);
|
||||||
|
uint8_t direction = sensor.getDirection();
|
||||||
|
if (res == false) {
|
||||||
|
s = "FFF";
|
||||||
|
} else {
|
||||||
|
String dirc = "EEE";
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
case DIRECTION_DISP_DOWN:
|
||||||
|
dirc = "F UP";
|
||||||
|
|
||||||
|
case DIRECTION_DISP_UP:
|
||||||
|
dirc = "F DN";
|
||||||
|
case DIRECTION_BOTTOM_EDGE:
|
||||||
|
dirc = "B ED";
|
||||||
|
|
||||||
|
case DIRECTION_TOP_EDGE:
|
||||||
|
dirc = "T ED";
|
||||||
|
case DIRECTION_RIGHT_EDGE:
|
||||||
|
dirc = "R ED";
|
||||||
|
case DIRECTION_LEFT_EDGE:
|
||||||
|
dirc = "L ED";
|
||||||
|
}
|
||||||
|
//sprintf(s, "X: %d Y: %d Z: %d\nD: %s", acc.x, acc.y, acc.z, dirc);
|
||||||
|
std::ostringstream out;
|
||||||
|
out << "X: " << acc.x << "\nY: " << acc.y << "\nZ: " << acc.z << "\nD: " << dirc;
|
||||||
|
s = out.str();
|
||||||
|
//s = std::format("X: {} Y: {} Z: {}\nD: {}", acc.x, acc.y, acc.z, dirc)
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return "GGG";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Home::draw() {
|
void Home::draw() {
|
||||||
api.display.setFont(&FreeMono12pt7b);
|
api.display.setFont(&FreeMono12pt7b);
|
||||||
api.display.setCursor(0, 0);
|
api.display.setCursor(0, 0);
|
||||||
api.display.print("\n");
|
api.display.print("\n");
|
||||||
api.display.printf("%02x %02x %02x %02x %02x", api.currentTime.Month,
|
api.display.printf("%02d %02d %02d %02d 00\nB:%f\n%s",
|
||||||
api.currentTime.Day, api.currentTime.Hour,
|
api.currentTime.Month, api.currentTime.Day,
|
||||||
api.currentTime.Minute, getBattery());
|
api.currentTime.Hour, api.currentTime.Minute,
|
||||||
|
api.getBatteryVoltage(),
|
||||||
|
getAccel().c_str());
|
||||||
|
api.display.display(true);
|
||||||
};
|
};
|
||||||
} // namespace Euler
|
|
||||||
|
|
Loading…
Reference in New Issue