Skip to content

Commit

Permalink
1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
klausahrenberg committed Sep 22, 2020
1 parent ff117c3 commit 5994187
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
7 changes: 5 additions & 2 deletions WNeoCoolcam/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ board_build.ldscript = eagle.flash.1m.ld
upload_resetmethod = nodemcu
upload_speed = 921600
build_flags =
-I /home/klausahrenberg/Projects/Atom/WAdapter/WAdapter
-I ../../WAdapter/WAdapter
lib_deps =
ESP8266WiFi
ESP8266WebServer
ottowinter/ESPAsyncWebServer-esphome@^1.2.7
AsyncTCP
ESP8266mDNS
DNSServer
EEPROM
NTPClient
Time
Hash
Wire
PubSubClient
Adafruit NeoPixel
2 changes: 1 addition & 1 deletion WNeoCoolcam/src/WNeoCoolcam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


#define APPLICATION "Neo Coolcam"
#define VERSION "1.13"
#define VERSION "1.15"
#define FLAG_SETTINGS 0x17
#define DEBUG false

Expand Down
24 changes: 11 additions & 13 deletions WNeoCoolcam/src/WNeoDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include "WProperty.h"
#include "W2812Led.h"

#ifndef _BV
#define _BV(bit) (1 << (bit))
#endif

#define COUNT_DEVICE_TYPES 4
#define COUNT_DEVICE_MODES 3
#define COUNT_MAX_RELAIS 4
Expand All @@ -32,8 +36,7 @@ static struct SwitchDevices supportedDevices [5] =
{ 4, {12, NO_PIN, NO_PIN, NO_PIN}, {13, NO_PIN, NO_PIN, NO_PIN}, {MODE_BUTTON, NO_PIN, NO_PIN, NO_PIN}}, //Neo Coolcam
{13, {12, NO_PIN, NO_PIN, NO_PIN}, { 0, 4, NO_PIN, NO_PIN}, {MODE_BUTTON, MODE_SWITCH, NO_PIN, NO_PIN}}, //Sonoff Mini
{13, {12, NO_PIN, NO_PIN, NO_PIN}, { 0, NO_PIN, NO_PIN, NO_PIN}, {MODE_BUTTON, NO_PIN, NO_PIN, NO_PIN}}, //Sonoff Basic
{ 2, { 5, NO_PIN, NO_PIN, NO_PIN}, { 0, NO_PIN, NO_PIN, NO_PIN}, {MODE_BUTTON, NO_PIN, NO_PIN, NO_PIN}}, //Wemos: Relay at D1, Switch at D3
{ 2, { 5, 4, NO_PIN, NO_PIN}, {NO_PIN, NO_PIN, NO_PIN, NO_PIN}, {MODE_BUTTON, NO_PIN, NO_PIN, NO_PIN}} //Dimmable LED
{ 2, { 5, NO_PIN, NO_PIN, NO_PIN}, { 0, NO_PIN, NO_PIN, NO_PIN}, {MODE_BUTTON, NO_PIN, NO_PIN, NO_PIN}} //Wemos: Relay at D1, Switch at D3
};

class WNeoDevice: public WDevice {
Expand Down Expand Up @@ -150,7 +153,7 @@ class WNeoDevice: public WDevice {
}
}

virtual void printConfigPage(ESP8266WebServer* webServer, WStringStream* page) {
virtual void printConfigPage(AsyncWebServerRequest* request, WStringStream* page) {
network->notice(F("NeoDevice config page"));
page->printAndReplace(FPSTR(HTTP_CONFIG_PAGE_BEGIN), getId());
//deviceType
Expand All @@ -160,7 +163,6 @@ class WNeoDevice: public WDevice {
page->printAndReplace(FPSTR(HTTP_COMBOBOX_ITEM), "2", (getDeviceType() == 2 ? "selected" : ""), "Sonoff Basic");
//page->printAndReplace(FPSTR(HTTP_COMBOBOX_ITEM), "3", (getDeviceType() == 3 ? "selected" : ""), "Sonoff 4-channel");
page->printAndReplace(FPSTR(HTTP_COMBOBOX_ITEM), "3", (getDeviceType() == 3 ? "selected" : ""), "Wemos: Relay at D1, Switch at D3");
page->printAndReplace(FPSTR(HTTP_COMBOBOX_ITEM), "4", (getDeviceType() == 4 ? "selected" : ""), "Dimmable LED: Relay 1 at Pin 5, Relay 2 at Pin 4, Switch at Pin 12");
page->print(FPSTR(HTTP_COMBOBOX_END));
//deviceMode
page->printAndReplace(FPSTR(HTTP_COMBOBOX_BEGIN), "Device Mode:", "dm");
Expand All @@ -176,16 +178,12 @@ class WNeoDevice: public WDevice {
page->print(FPSTR(HTTP_CONFIG_SAVE_BUTTON));
}

void saveConfigPage(ESP8266WebServer* webServer, WStringStream* page) {
void saveConfigPage(AsyncWebServerRequest* request, WStringStream* page) {
network->notice(F("Save NeoDevice config page"));
this->showAsWebthingDevice->setBoolean(webServer->arg("sa") == HTTP_TRUE);
this->deviceType->setByte(webServer->arg("dt").toInt());
this->deviceMode->setByte(webServer->arg("dm").toInt());
this->supportingW2812->setBoolean(webServer->arg("sw") == "true");
}

virtual void loop(unsigned long now) {
WDevice::loop(now);
this->showAsWebthingDevice->setBoolean(request->arg("sa") == HTTP_TRUE);
this->deviceType->setByte(request->arg("dt").toInt());
this->deviceMode->setByte(request->arg("dm").toInt());
this->supportingW2812->setBoolean(request->arg("sw") == "true");
}

protected:
Expand Down
Binary file removed WNeoCoolcam_1.13.bin
Binary file not shown.
Binary file added WNeoCoolcam_1.15.bin
Binary file not shown.

0 comments on commit 5994187

Please sign in to comment.