Added build version to web interface, WiFi reset button
This commit is contained in:
parent
fdd32456bc
commit
df184bb4ec
@ -193,6 +193,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<small>
|
||||
<span id="gitRev"></span>
|
||||
<span id="lastBuildTime"></span>
|
||||
</small>
|
||||
</footer>
|
||||
<script src="/js/script.js"></script>
|
||||
</body>
|
||||
|
||||
|
@ -53,6 +53,12 @@ fetch('/api/settings', {
|
||||
document.getElementById('timePerScreen').value = jsonData.timerSeconds / 60;
|
||||
document.getElementById('ledBrightness').value = jsonData.ledBrightness;
|
||||
|
||||
if (jsonData.gitRev)
|
||||
document.getElementById('gitRev').innerHTML = "Version: " + jsonData.gitRev;
|
||||
|
||||
if (jsonData.lastBuildTime)
|
||||
document.getElementById('lastBuildTime').innerHTML = " / " + new Date((jsonData.lastBuildTime* 1000)).toLocaleString();
|
||||
|
||||
var source = document.getElementById("screens-template").innerHTML;
|
||||
var template = Handlebars.compile(source);
|
||||
var context = { screens: jsonData.screens };
|
||||
|
4045
data/yarn.lock
4045
data/yarn.lock
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@ monitor_speed = 115200
|
||||
upload_speed = 921600
|
||||
monitor_filters = esp32_exception_decoder, colorize
|
||||
extra_scripts = post:scripts/extra_script.py
|
||||
build_flags = !python scripts/git_rev.py
|
||||
lib_deps =
|
||||
bblanchon/ArduinoJson@^6.21.2
|
||||
fbiego/ESP32Time@^2.0.1
|
||||
@ -50,6 +51,8 @@ framework = arduino
|
||||
board = lolin_s3_mini
|
||||
board_build.partitions = partition.csv
|
||||
build_flags =
|
||||
!python scripts/git_rev.py
|
||||
-DLAST_BUILD_TIME=$UNIX_TIME
|
||||
-D IS_S3
|
||||
-D IS_BW
|
||||
-D CONFIG_FREERTOS_USE_TRACE_FACILITY
|
||||
@ -101,18 +104,3 @@ build_flags =
|
||||
-DASYNCWEBSERVER_REGEX
|
||||
-D HOSTNAME="\"btclocks3d\""
|
||||
|
||||
[env:esp32_c6]
|
||||
platform = espressif32
|
||||
board = esp32-s3-devkitc-1
|
||||
board_build.partitions = partition.csv
|
||||
;upload_protocol = esp-builtin
|
||||
build_flags =
|
||||
-D NO_DISPLAY
|
||||
-D NO_MCP
|
||||
-D IS_BW
|
||||
-D WITH_RGB_LED
|
||||
-D NEOPIXEL_COUNT=1
|
||||
-D NEOPIXEL_PIN=38
|
||||
-D CONFIG_ASYNC_TCP_PRIORITY=500
|
||||
-DASYNCWEBSERVER_REGEX
|
||||
-D HOSTNAME="\"btclocks3d\""
|
8
scripts/git_rev.py
Normal file
8
scripts/git_rev.py
Normal file
@ -0,0 +1,8 @@
|
||||
import subprocess
|
||||
|
||||
revision = (
|
||||
subprocess.check_output(["git", "rev-parse", "HEAD"])
|
||||
.strip()
|
||||
.decode("utf-8")
|
||||
)
|
||||
print("'-DGIT_REV=\"%s\"'" % revision)
|
@ -28,6 +28,8 @@ Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
String softAP_SSID;
|
||||
String softAP_password;
|
||||
WiFiMulti wifiMulti;
|
||||
|
||||
WiFiManager wm;
|
||||
bool screenVisible[5];
|
||||
|
||||
@ -42,7 +44,6 @@ void setupSoftAP()
|
||||
|
||||
void setupComponents()
|
||||
{
|
||||
|
||||
#ifdef WITH_RGB_LED
|
||||
pixels.begin();
|
||||
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
|
||||
@ -52,8 +53,8 @@ void setupComponents()
|
||||
pixels.show();
|
||||
#endif
|
||||
|
||||
//delay(3000);
|
||||
//Serial.println("Leds should be on");
|
||||
// delay(3000);
|
||||
// Serial.println("Leds should be on");
|
||||
|
||||
#ifndef NO_MCP
|
||||
if (!mcp.begin_I2C())
|
||||
@ -75,7 +76,7 @@ void setupComponents()
|
||||
pixels.setPixelColor(2, pixels.Color(0, 255, 0));
|
||||
pixels.setPixelColor(3, pixels.Color(0, 255, 0));
|
||||
pixels.show();
|
||||
// delay(200);
|
||||
// delay(200);
|
||||
pinMode(MCP_INT_PIN, INPUT);
|
||||
mcp.setupInterrupts(true, false, LOW);
|
||||
}
|
||||
@ -108,7 +109,35 @@ void synchronizeTime()
|
||||
|
||||
void setupWifi()
|
||||
{
|
||||
#ifndef NO_MCP
|
||||
if (mcp.digitalRead(3) == LOW)
|
||||
{
|
||||
pixels.setPixelColor(0, pixels.Color(0, 0, 255));
|
||||
pixels.setPixelColor(1, pixels.Color(0, 0, 255));
|
||||
pixels.setPixelColor(2, pixels.Color(0, 0, 255));
|
||||
pixels.setPixelColor(3, pixels.Color(0, 0, 255));
|
||||
pixels.show();
|
||||
|
||||
delay(1500);
|
||||
|
||||
if (mcp.digitalRead(3) == LOW)
|
||||
{
|
||||
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
|
||||
pixels.setPixelColor(1, pixels.Color(0, 0, 255));
|
||||
pixels.setPixelColor(2, pixels.Color(255, 0, 0));
|
||||
pixels.setPixelColor(3, pixels.Color(0, 0, 255));
|
||||
pixels.show();
|
||||
Serial.println("Erasing WiFi Config, restarting");
|
||||
wm.resetSettings();
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
setupSoftAP();
|
||||
|
||||
wm.setAPCallback([&](WiFiManager *wifiManager)
|
||||
{
|
||||
showSetupQr(softAP_SSID, softAP_password);
|
||||
@ -161,7 +190,8 @@ uint getCurrentScreen()
|
||||
|
||||
void setCurrentScreen(uint screen)
|
||||
{
|
||||
if (screen != SCREEN_CUSTOM) {
|
||||
if (screen != SCREEN_CUSTOM)
|
||||
{
|
||||
preferences.putUInt("currentScreen", screen);
|
||||
}
|
||||
|
||||
@ -273,8 +303,8 @@ void previousScreen()
|
||||
|
||||
void showNetworkSettings()
|
||||
{
|
||||
std::array<String, 7> epdContent = { "", "", "", "", "", "", ""};
|
||||
|
||||
std::array<String, 7> epdContent = {"", "", "", "", "", "", ""};
|
||||
|
||||
String ipAddr = WiFi.localIP().toString();
|
||||
String subNet = WiFi.subnetMask().toString();
|
||||
|
||||
@ -282,9 +312,10 @@ void showNetworkSettings()
|
||||
|
||||
int ipAddrPos = 0;
|
||||
int subnetPos = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
epdContent[2 + i] = ipAddr.substring(0, ipAddr.indexOf('.')) + "/" + subNet.substring(0, subNet.indexOf('.'));
|
||||
ipAddrPos = ipAddr.indexOf('.') + 1;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
epdContent[2 + i] = ipAddr.substring(0, ipAddr.indexOf('.')) + "/" + subNet.substring(0, subNet.indexOf('.'));
|
||||
ipAddrPos = ipAddr.indexOf('.') + 1;
|
||||
subnetPos = subNet.indexOf('.') + 1;
|
||||
ipAddr = ipAddr.substring(ipAddrPos);
|
||||
subNet = subNet.substring(subnetPos);
|
||||
@ -333,4 +364,4 @@ void onI2CRequest()
|
||||
{
|
||||
Wire.print("I2C Packets.");
|
||||
Serial.println("onRequest");
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <WiFi.h>
|
||||
#include <Arduino.h>
|
||||
#include <WiFiManager.h>
|
||||
#include <WiFiMulti.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "shared.hpp"
|
||||
|
@ -154,6 +154,13 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
|
||||
#endif
|
||||
root["ledFlashOnUpdate"] = preferences.getBool("ledFlashOnUpd", false);
|
||||
root["ledBrightness"] = preferences.getUInt("ledBrightness", 128);
|
||||
|
||||
#ifdef GIT_REV
|
||||
root["gitRev"] = String(GIT_REV);
|
||||
#endif
|
||||
#ifdef LAST_BUILD_TIME
|
||||
root["lastBuildTime"] = String(LAST_BUILD_TIME);
|
||||
#endif
|
||||
JsonArray screens = root.createNestedArray("screens");
|
||||
|
||||
for (int i = 0; i < screenNameMap.size(); i++)
|
||||
|
@ -18,6 +18,7 @@ bool useBitcoind = true;
|
||||
void checkBitcoinBlock(void *pvParameters)
|
||||
{
|
||||
int blockHeight = preferences.getUInt("blockHeight", currentBlockHeight);
|
||||
|
||||
HTTPClient http;
|
||||
http.setReuse(true);
|
||||
useBitcoind = wifiClientInsecure.connect(preferences.getString("rpcHost", BITCOIND_HOST).c_str(), preferences.getUInt("rpcPort", BITCOIND_PORT));
|
||||
@ -103,7 +104,8 @@ void setupBlockNotify()
|
||||
{
|
||||
// bitcoinQueue = xQueueCreate(10, sizeof(BitcoinEvent) * 2);
|
||||
|
||||
if (blockNotifyTaskHandle == nullptr) {
|
||||
if (blockNotifyTaskHandle == nullptr)
|
||||
{
|
||||
xTaskCreate(checkBitcoinBlock, "checkBitcoinBlock", 4096, NULL, 1, &blockNotifyTaskHandle);
|
||||
vTaskSuspend(blockNotifyTaskHandle);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void initDisplays()
|
||||
int *taskParam = new int;
|
||||
*taskParam = i;
|
||||
|
||||
xTaskCreate(updateDisplay, "EpdUpd" + char(i), 2048, taskParam, 1, &tasks[i]); // create task
|
||||
xTaskCreate(updateDisplay, "EpdUpd" + char(i), 4096, taskParam, 1, &tasks[i]); // create task
|
||||
// delay(1000);
|
||||
}
|
||||
epdContent = {"B", "T", "C", "L", "O", "C", "K"};
|
||||
|
Loading…
Reference in New Issue
Block a user