Skip to content

Fix WiFi definitions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions EmbUI/EmbUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ void EmbUI::begin(){
});

server.on(PSTR("/version"), HTTP_ANY, [this](AsyncWebServerRequest *request) {
String buf;
buf = F("VERSION: "); buf+=F(VERSION);
buf += F("\nGIT: "); buf+=F(PIO_SRC_REV);
buf += F("\nOK\n");
request->send(200, FPSTR(PGmimetxt), buf.c_str());
//String buf;
//buf = F("EmbUI ver: "); buf+=F(VERSION);
//buf += F("\nGIT: "); buf+=F(PIO_SRC_REV);
//buf += F("\nOK\n");
request->send(200, FPSTR(PGmimetxt), F("EmbUI ver: " TOSTRING(EMBUIVER)));
});

server.on(PSTR("/cmd"), HTTP_ANY, [this](AsyncWebServerRequest *request) {
Expand Down
14 changes: 9 additions & 5 deletions EmbUI/EmbUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#include <AsyncMqttClient.h>
#include "LList.h"

// STRING Macro
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)

class Interface;

#ifndef DELAY_AFTER_FS_WRITING
Expand Down Expand Up @@ -135,11 +139,11 @@ static const char PGnocache[] PROGMEM = "no-cache, no-store, must-revalidate";
#define __SSDPMANUF ("obliterator")
#endif

static const char PGnameModel[] PROGMEM = __SSDPNAME;
static const char PGurlModel[] PROGMEM = __SSDPURLMODEL;
static const char PGversion[] PROGMEM = VERSION;
static const char PGurlManuf[] PROGMEM = __SSDPURLMANUF;
static const char PGnameManuf[] PROGMEM = __SSDPMANUF;
static const char PGnameModel[] PROGMEM = TOSTRING(__SSDPNAME);
static const char PGurlModel[] PROGMEM = TOSTRING(__SSDPURLMODEL);
static const char PGversion[] PROGMEM = TOSTRING(EMBUIVER);
static const char PGurlManuf[] PROGMEM = TOSTRING(__SSDPURLMANUF);
static const char PGnameManuf[] PROGMEM = TOSTRING(__SSDPMANUF);
#endif

class EmbUI
Expand Down
16 changes: 8 additions & 8 deletions EmbUI/gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

void EmbUI::led_handle(){
if (LED_PIN == -1) return;
if (wifi_mode == 1)
if (wifi_mode == WIFI_STA)
digitalWrite(LED_PIN, !digitalRead(LED_PIN));
if (wifi_mode == 2)
if (wifi_mode == WIFI_AP)
digitalWrite(LED_PIN, LOW + LED_INVERT);
}

Expand All @@ -32,10 +32,10 @@ void EmbUI::btn(){
led_inv();
i = true;
}
if (old_wifi_mode == 1)
wifi_mode = 2;
if (old_wifi_mode == 2)
wifi_mode = 1;
if (old_wifi_mode == WIFI_STA)
wifi_mode = WIFI_AP;
if (old_wifi_mode == WIFI_AP)
wifi_mode = WIFI_STA;
}
if (t + 15000 < millis()) // Нажатие 10 секунд
{
Expand All @@ -46,9 +46,9 @@ void EmbUI::btn(){
}
if (wifi_mode != old_wifi_mode) // событие после отпуска кнопки от 5 секунд
{
if (wifi_mode == 1)
if (wifi_mode == WIFI_STA)
var(F("wifi"), F("AP"));
if (wifi_mode == 2)
if (wifi_mode == WIFI_AP)
var(F("wifi"), F("STA"));
// тут сохранить настройки
wifi_connect();
Expand Down
2 changes: 1 addition & 1 deletion EmbUI/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void Interface::json_frame_interface(const String &name){
if (name != "") {
json[F("app")] = name;
json[F("mc")] = embui->mc;
json[F("ver")] = F(VERSION);
json[F("ver")] = F(TOSTRING(EMBUIVER));
}
json[F("final")] = false;

Expand Down
41 changes: 41 additions & 0 deletions library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "EmbUI",
"frameworks": "arduino",
"keywords": "embui, arduino",
"description": "Embeded Web UI framework for esp8266/esp32 IoT prototyping",
"url": "https://github.com/DmytroKorniienko/EmbUI",
"authors": [
{
"name": "Anton Zolotarev",
"url": "https://github.com/anton-zolotarev"
},
{
"name": "Dmytro Korniienko",
"url": "https://github.com/DmytroKorniienko",
"maintainer": true
},
{
"name": "Emil Muratov",
"url": "https://github.com/vortigont",
"email": "[email protected]"
}
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/DmytroKorniienko/EmbUI.git"
},
"platforms": ["espressif8266"],
"version": "2.0.1",
"dependencies": {
"bblanchon/ArduinoJson": "*",
"AsyncWebServer-mod": "https://github.com/DmytroKorniienko/ESPAsyncWebServer",
"AsyncMqttClient": "*"
},
"build": {
"flags": [
"-DEMBUIVER=2.0.1"
],
"srcDir": "EmbUI"
}
}