-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add config parameters * rename filename setup http handler * Add config And Create embedded file header script * ログ表記揺れ修正 * ConfigNamesを使用するように変更 * ADD: config API INVALID KEY check * Add configs to backup API * ADD: Invalid key error to config set API * Alerts sample * move set_default_config to constructor * ADD: Factory Reset API * Update API document * Change displaySkipReconfigure * FIX:mDNS setInstanceName/AddService before begin * FIX: mDNS Instance Name duplication * finalize v44 * DEBUG_BUILD OFF
- Loading branch information
1 parent
0128245
commit 3778faf
Showing
34 changed files
with
1,133 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#Import("env", "projenv") | ||
|
||
import os | ||
import shutil | ||
import glob | ||
import pathlib | ||
|
||
def readall(path): | ||
f = open(path, 'r') | ||
data = f.read() | ||
f.close() | ||
return data | ||
|
||
|
||
def create_name_from_filename(filename): | ||
ret = filename | ||
ret = ret.replace(".", "_") | ||
ret = ret.replace(" ", "_") | ||
return ret | ||
|
||
|
||
EMBED_DIR=os.path.join(os.getcwd(), "embed") # embedしたいファイルがおいてあるディレクトリ | ||
OUT_DIR=os.path.join(os.getcwd(), "include", "embed") # 変換した .h ファイルの出力先 | ||
TEMPLATE_FILE=os.path.join(os.getcwd(), "build_script", "template.cpp") | ||
|
||
print("=" * 78) | ||
print("create_embed.py executing.") | ||
print(f"EMBED_DIR = {EMBED_DIR}") | ||
print(f"OUT_DIR = {OUT_DIR}") | ||
print("=" * 78) | ||
|
||
# access to global build environment | ||
#print(env.Dump()) | ||
|
||
# access to project build environment (is used source files in "src" folder) | ||
#print(projenv.Dump()) | ||
|
||
# | ||
# Script to build cpp file from embed directory | ||
# | ||
# see: https://thingpulse.com/embed-binary-data-on-esp32/ | ||
# see: https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html#before-pre-and-after-post-actions | ||
|
||
if os.path.exists(OUT_DIR): | ||
shutil.rmtree(OUT_DIR) | ||
|
||
os.mkdir(OUT_DIR) | ||
template = readall(TEMPLATE_FILE) | ||
|
||
for file in pathlib.Path(EMBED_DIR).iterdir(): | ||
output = template | ||
data = readall(file) | ||
|
||
output_name = create_name_from_filename(file.name) | ||
|
||
# 変数名部分を置換。 変数名は全部大文字とする | ||
output = output.replace("$$REPLACE_NAME$$", output_name.upper()).replace("$$REPLACE_CONTENT$$", data) | ||
output_cpp_path = os.path.join(OUT_DIR, output_name + ".h") | ||
|
||
f = open(output_cpp_path, 'w') | ||
data = f.write(output) | ||
f.close() | ||
|
||
print(f"generated {output_cpp_path}") | ||
|
||
|
||
print("=" * 78) | ||
print("DONE") | ||
print("=" * 78) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <Arduino.h> | ||
|
||
static const char $$REPLACE_NAME$$[] PROGMEM = R"=====( | ||
$$REPLACE_CONTENT$$ | ||
)====="; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
curl -X POST -d "mDNS=ebx32&opMode=always&displayFlip=yes&displayBrightness=50&oledType=SSD&st7789=yes&st7789Mode=st7789_normal&mhz19b=no&mhz19bPwmPin=14&mhz19bRxPin=32&mhz19bTxPin=33&mqttBroker=&mqttName=&tempAlerts=&tempAlerts.warn1.L=-99&tempAlerts.warn1.H=10&tempAlerts.warn2.L=10&tempAlerts.warn2.H=40&tempAlerts.caut1.L=10&tempAlerts.caut1.H=15&tempAlerts.caut2.L=28&tempAlerts.caut2.H=30&humiAlerts.warn1.L=0&humiAlerts.warn1.H=20&humiAlerts.warn2.L=75&humiAlerts.warn2.H=100&humiAlerts.caut1.L=20&humiAlerts.caut1.H=35&humiAlerts.caut2.L=65&humiAlerts.caut2.H=75&luxAlerts.warn1.L=0&luxAlerts.warn1.H=1&luxAlerts.warn2.L=2000&luxAlerts.warn2.H=99999&luxAlerts.caut1.L=-1&luxAlerts.caut1.H=-1&luxAlerts.caut2.L=-1&luxAlerts.caut2.H=-1&presAlerts.warn1.L=0&presAlerts.warn1.H=995&presAlerts.warn2.L=1025&presAlerts.warn2.H=3000&presAlerts.caut1.L=995&presAlerts.caut1.H=1000&presAlerts.caut2.L=3000&presAlerts.caut2.H=3000&co2Alerts.warn1.L=0&co2Alerts.warn1.H=200&co2Alerts.warn2.L=1000&co2Alerts.warn2.H=9999&co2Alerts.caut1.L=200&co2Alerts.caut1.H=300&co2Alerts.caut2.L=800&co2Alerts.caut2.H=1000" http://ebx32.local/config | ||
|
||
curl -X POST -d "tempAlerts.warn1.L=-99&tempAlerts.warn1.H=10&tempAlerts.warn2.L=10&tempAlerts.warn2.H=40&tempAlerts.caut1.L=10&tempAlerts.caut1.H=15&tempAlerts.caut2.L=28&tempAlerts.caut2.H=30&humiAlerts.warn1.L=0&humiAlerts.warn1.H=20&humiAlerts.warn2.L=75&humiAlerts.warn2.H=100&humiAlerts.caut1.L=20&humiAlerts.caut1.H=35&humiAlerts.caut2.L=65&humiAlerts.caut2.H=75&luxAlerts.warn1.L=0&luxAlerts.warn1.H=1&luxAlerts.warn2.L=2000&luxAlerts.warn2.H=99999&luxAlerts.caut1.L=-1&luxAlerts.caut1.H=-1&luxAlerts.caut2.L=-1&luxAlerts.caut2.H=-1&presAlerts.warn1.L=0&presAlerts.warn1.H=995&presAlerts.warn2.L=1025&presAlerts.warn2.H=3000&presAlerts.caut1.L=995&presAlerts.caut1.H=1000&presAlerts.caut2.L=3000&presAlerts.caut2.H=3000&co2Alerts.warn1.L=0&co2Alerts.warn1.H=200&co2Alerts.warn2.L=1000&co2Alerts.warn2.H=9999&co2Alerts.caut1.L=200&co2Alerts.caut1.H=300&co2Alerts.caut2.L=800&co2Alerts.caut2.H=1000" http://ebx32.local/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#pragma once | ||
|
||
#include <Arduino.h> | ||
|
||
/** | ||
* Configで使用される、名称の定数クラス。 | ||
* 実際の値は ConfigValue クラスにある | ||
*/ | ||
class ConfigNames { | ||
public: | ||
static const String SETTING_ID; | ||
static const String SSID; | ||
static const String PASSWORD; | ||
static const String MDNS; | ||
|
||
static const String OPMODE; | ||
|
||
static const String DISPLAY_FLIP; | ||
static const String DISPLAY_BRIGHTNESS; | ||
static const String DISPLAY_RECONFIG; | ||
|
||
static const String OLED_TYPE; | ||
|
||
static const String ST7789; | ||
static const String ST7789_MODE; | ||
|
||
static const String MHZ19B; | ||
static const String MHZ19B_PWM; | ||
static const String MHZ19B_RX; | ||
static const String MHZ19B_TX; | ||
static const String MHZ19B_ABC; | ||
|
||
static const String MQTT_BROKER; | ||
static const String MQTT_NAME; | ||
|
||
static const String TEMP_ALERT; | ||
static const String HUMI_ALERT; | ||
static const String LUX_ALERT; | ||
static const String PRES_ALERT; | ||
static const String CO2_ALERT; | ||
|
||
static const String ALERT_WARN1_LO; | ||
static const String ALERT_WARN1_HI; | ||
static const String ALERT_WARN2_LO; | ||
static const String ALERT_WARN2_HI; | ||
static const String ALERT_CAUTION1_LO; | ||
static const String ALERT_CAUTION1_HI; | ||
static const String ALERT_CAUTION2_LO; | ||
static const String ALERT_CAUTION2_HI; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <Arduino.h> | ||
|
||
static const char STYLE_CSS[] PROGMEM = R"=====( | ||
body { | ||
background-color: aliceblue; | ||
} | ||
|
||
body.setup_done { | ||
background-color: paleturquoise; | ||
} | ||
|
||
input[type='text'] { | ||
width: 200px; | ||
} | ||
|
||
input.num { | ||
width: 50px; | ||
} | ||
|
||
input[type='submit'] { | ||
width: 200px; | ||
height: 48px; | ||
} | ||
|
||
a.setup_again { | ||
font-size: 150%; | ||
} | ||
)====="; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.