fix build

This commit is contained in:
2020-02-02 12:44:15 +01:00
parent 554a819f97
commit 65a95a2b4b
94 changed files with 96 additions and 14 deletions

3
.gitignore vendored Normal file → Executable file
View File

@@ -1,5 +1,4 @@
.pioenvs .pio
.piolibdeps
.vscode/.browse.c_cpp.db* .vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json .vscode/c_cpp_properties.json
.vscode/launch.json .vscode/launch.json

0
.gitlab-ci.yml Normal file → Executable file
View File

0
.travis.yml Normal file → Executable file
View File

12
.vscode/extensions.json vendored Normal file → Executable file
View File

@@ -1,7 +1,7 @@
{ {
// See http://go.microsoft.com/fwlink/?LinkId=827846 // See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format // for the documentation about the extensions.json format
"recommendations": [ "recommendations": [
"platformio.platformio-ide" "platformio.platformio-ide"
] ]
} }

0
.vscode/settings.json vendored Normal file → Executable file
View File

0
data/example.config.json Normal file → Executable file
View File

2
data/mqttConfig.json Normal file → Executable file
View File

@@ -1,6 +1,6 @@
{ {
"mqttClientName" : "bb1", "mqttClientName" : "bb1",
"mqttBrokerHost" : "192.168.1.2", "mqttBrokerHost" : "192.168.1.134",
"mqttBrokerPort" : 1883, "mqttBrokerPort" : 1883,
"mqttRootTopic" : "wirelos/bb1" "mqttRootTopic" : "wirelos/bb1"
} }

0
data/www/favicon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

0
data/www/gradients.json Normal file → Executable file
View File

0
data/www/index.html Normal file → Executable file
View File

0
data/www/script.js Normal file → Executable file
View File

0
data/www/styles.css Normal file → Executable file
View File

0
data/www/test-controls.html Normal file → Executable file
View File

0
include/README Normal file → Executable file
View File

0
lib/README Normal file → Executable file
View File

View File

View File

View File

0
lib/esp32_lora_wifi/ESP32/library.properties Normal file → Executable file
View File

0
lib/esp32_lora_wifi/ESP32/src/dummy.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/LoRa/.travis.yml Normal file → Executable file
View File

0
lib/esp32_lora_wifi/LoRa/API.md Normal file → Executable file
View File

0
lib/esp32_lora_wifi/LoRa/LICENSE Normal file → Executable file
View File

0
lib/esp32_lora_wifi/LoRa/README.md Normal file → Executable file
View File

View File

View File

View File

0
lib/esp32_lora_wifi/LoRa/keywords.txt Normal file → Executable file
View File

0
lib/esp32_lora_wifi/LoRa/library.properties Normal file → Executable file
View File

0
lib/esp32_lora_wifi/LoRa/src/LoRa.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/LoRa/src/LoRa.h Normal file → Executable file
View File

View File

0
lib/esp32_lora_wifi/Preferences/keywords.txt Normal file → Executable file
View File

0
lib/esp32_lora_wifi/Preferences/library.properties Normal file → Executable file
View File

0
lib/esp32_lora_wifi/Preferences/src/Preferences.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/Preferences/src/Preferences.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/SPI/keywords.txt Normal file → Executable file
View File

0
lib/esp32_lora_wifi/SPI/library.properties Normal file → Executable file
View File

0
lib/esp32_lora_wifi/SPI/src/SPI.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/SPI/src/SPI.h Normal file → Executable file
View File

View File

View File

View File

View File

View File

0
lib/esp32_lora_wifi/WiFi/examples/WiFiScan/images.h Normal file → Executable file
View File

View File

View File

View File

View File

0
lib/esp32_lora_wifi/WiFi/keywords.txt Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/library.properties Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFi.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFi.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiAP.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiAP.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiClient.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiClient.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiGeneric.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiGeneric.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiMulti.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiMulti.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiSTA.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiSTA.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiScan.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiScan.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiServer.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiServer.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiType.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiUdp.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFi/src/WiFiUdp.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/WiFiClientSecure/keywords.txt Normal file → Executable file
View File

View File

View File

View File

View File

0
lib/esp32_lora_wifi/WiFiClientSecure/src/ssl_client.h Normal file → Executable file
View File

0
lib/esp32_lora_wifi/Wire/keywords.txt Normal file → Executable file
View File

0
lib/esp32_lora_wifi/Wire/library.properties Normal file → Executable file
View File

0
lib/esp32_lora_wifi/Wire/src/Wire.cpp Normal file → Executable file
View File

0
lib/esp32_lora_wifi/Wire/src/Wire.h Normal file → Executable file
View File

8
platformio.ini Normal file → Executable file
View File

@@ -8,7 +8,7 @@ lib_deps =
Hash Hash
TaskScheduler TaskScheduler
SPIFFS SPIFFS
ArduinoJson ArduinoJson@5.13.4
Ai Esp32 Rotary Encoder Ai Esp32 Rotary Encoder
ESP8266_SSD1306 ESP8266_SSD1306
ESPmDNS ESPmDNS
@@ -20,11 +20,11 @@ lib_deps =
PubSubClient PubSubClient
Update Update
https://gitlab.com/wirelos/sprocket-lib.git#develop https://gitlab.com/wirelos/sprocket-lib.git#develop
https://gitlab.com/wirelos/sprocket-network-wifi.git https://gitlab.com/wirelos/sprocket-network-wifi.git#next
https://gitlab.com/wirelos/sprocket-plugin-gpio.git https://gitlab.com/wirelos/sprocket-plugin-gpio.git
https://gitlab.com/wirelos/sprocket-plugin-display.git https://gitlab.com/wirelos/sprocket-plugin-display.git
https://gitlab.com/wirelos/sprocket-plugin-web.git https://gitlab.com/wirelos/sprocket-plugin-web.git#next
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git https://gitlab.com/wirelos/sprocket-plugin-mqtt.git#next
[env:default] [env:default]
platform = ${common.platform} platform = ${common.platform}

38
src/RotaryPlugin.cpp Normal file
View File

@@ -0,0 +1,38 @@
#include "RotaryPlugin.h"
RotaryPlugin::RotaryPlugin(RotaryConfig cfg)
{
config = cfg;
rotaryEncoder = new AiEsp32RotaryEncoder(config.pinA, config.pinB, config.pinButton, config.pinVcc);
rotaryEncoder->begin();
rotaryEncoder->setBoundaries(config.lowerBound, config.upperBound, config.circulateValues);
}
void RotaryPlugin::activate(Scheduler *userScheduler)
{
// add update task
inputTask.set(TASK_MILLISECOND * config.updateInterval, TASK_FOREVER, std::bind(&RotaryPlugin::checkInput, this));
userScheduler->addTask(inputTask);
inputTask.enable();
// add dummy subscription
subscribe(config.topic, [](String msg){});
subscribe(String(config.topic) + "/btn", [](String msg){});
PRINT_MSG(Serial, "PLUGIN", "RotaryPlugin activated");
}
void RotaryPlugin::checkInput()
{
rotaryEncoder->enable();
if (rotaryEncoder->encoderChanged())
{
int encReading = rotaryEncoder->readEncoder();
publish(config.topic, String(encReading));
}
ButtonState newBtnState = rotaryEncoder->currentButtonState();
if(newBtnState != btnState){
btnState = newBtnState;
publish(String(config.topic) + String("/btn"), String(btnState));
}
}

45
src/RotaryPlugin.h Normal file
View File

@@ -0,0 +1,45 @@
#ifndef __ROTARY_PLUGIN_H__
#define __ROTARY_PLUGIN_H__
#define _TASK_SLEEP_ON_IDLE_RUN
#define _TASK_STD_FUNCTION
#include <functional>
#include <vector>
#include <FS.h>
#include <TaskSchedulerDeclarations.h>
#include <Plugin.h>
#include <utils/print.h>
#include <utils/misc.h>
#include "AiEsp32RotaryEncoder.h"
using namespace std;
using namespace std::placeholders;
struct RotaryConfig
{
int pinA;
int pinB;
int pinButton;
int pinVcc;
int updateInterval;
int lowerBound;
int upperBound;
bool circulateValues;
const char* topic;
//const char* topicButton;
};
class RotaryPlugin : public Plugin {
public:
Task inputTask;
int currentVal = 0;
ButtonState btnState = BUT_RELEASED;
AiEsp32RotaryEncoder* rotaryEncoder;
RotaryConfig config;
RotaryPlugin(RotaryConfig cfg);
void activate(Scheduler* userScheduler);
void checkInput();
};
#endif

0
src/config.h Normal file → Executable file
View File

2
src/main.cpp Normal file → Executable file
View File

@@ -7,9 +7,9 @@
#include <WebConfigPlugin.h> #include <WebConfigPlugin.h>
#include <WebApiPlugin.h> #include <WebApiPlugin.h>
#include <MqttPlugin.h> #include <MqttPlugin.h>
#include "inputs/rotary/RotaryPlugin.h"
#include "inputs/analog/AnalogInputPlugin.h" #include "inputs/analog/AnalogInputPlugin.h"
#include "inputs/digital/DigitalInputPlugin.h" #include "inputs/digital/DigitalInputPlugin.h"
#include "RotaryPlugin.h"
WiFiNet *network; WiFiNet *network;
Sprocket *sprocket; Sprocket *sprocket;

0
test/README Normal file → Executable file
View File