Compare commits

..

11 Commits

Author SHA1 Message Date
CaCO3
1ceb47fbc7 . 2025-02-25 00:22:47 +01:00
CaCO3
a413d0228e . 2025-02-25 00:10:29 +01:00
CaCO3
e22eaa2736 . 2025-02-25 00:01:17 +01:00
CaCO3
154d159595 . 2025-02-24 23:58:27 +01:00
CaCO3
23a5458a2b . 2025-02-24 23:53:57 +01:00
CaCO3
89097fa5a2 . 2025-02-24 23:46:38 +01:00
CaCO3
6952db0298 swap HTML folders after extracting 2025-02-24 23:26:55 +01:00
CaCO3
550889c373 rename html folder 2025-02-24 23:10:03 +01:00
CaCO3
1200ee1289 Merge branch 'fix-gz' of https://github.com/jomjol/AI-on-the-edge-device into fix-gz 2025-02-24 21:57:09 +01:00
CaCO3
fceccb90b0 delete HTML directory on an update 2025-02-24 21:56:49 +01:00
CaCO3
d68c95d626 delete HTML directory on an update 2025-02-24 21:30:14 +01:00
16 changed files with 244 additions and 412 deletions

View File

@@ -1,4 +1,4 @@
## [16.0.0-RC6] - 2024-02-28
## [16.0.0-RC6] - 2024-xx-xx
For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.7.0...v16.0.0)
@@ -9,25 +9,13 @@ Please check the [issues](https://github.com/jomjol/AI-on-the-edge-device/issues
#### Core Changes
Only changes since RC5 are listed:
- [#3436](https://github.com/jomjol/AI-on-the-edge-device/pull/3436) Added basic authentification of the Web Interface and the REST API, see https://jomjol.github.io/AI-on-the-edge-device-docs/Password-Protection
- [#3520](https://github.com/jomjol/AI-on-the-edge-device/pull/3520) Rewrite InfluxDB Interfache
- [#3500](https://github.com/jomjol/AI-on-the-edge-device/pull/3500) Update smartled driver
- [#3454](https://github.com/jomjol/AI-on-the-edge-device/pull/3454) Add thermometer
- [#3538](https://github.com/jomjol/AI-on-the-edge-device/pull/3538) add .gz
- [#3565](https://github.com/jomjol/AI-on-the-edge-device/pull/3565) corrected enable/disable texts to make it more intuitive
- [#3568](https://github.com/jomjol/AI-on-the-edge-device/pull/3568) compress all HTML files
- xxx
**:warning: Please check your Homeassistant instance to make sure it is handled correctly!**
#### Bug Fixes
Only changes since RC5 are listed:
- [#3450](https://github.com/jomjol/AI-on-the-edge-device/pull/3450) fix crash fue to empty CAM parameters in migration
- [#3446](https://github.com/jomjol/AI-on-the-edge-device/pull/3446) fix for incorrect decimal shift
- xxx
## [16.0.0-RC5] - 2024-12-05

View File

@@ -250,13 +250,6 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Frank Haverland</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SybexX">
<img src="https://avatars.githubusercontent.com/u/587201?v=4" width="100;" alt="SybexX"/>
<br />
<sub><b>michael</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Slider0007">
<img src="https://avatars.githubusercontent.com/u/115730895?v=4" width="100;" alt="Slider0007"/>
@@ -264,6 +257,13 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Slider0007</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SybexX">
<img src="https://avatars.githubusercontent.com/u/587201?v=4" width="100;" alt="SybexX"/>
<br />
<sub><b>michael</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/nliaudat">
<img src="https://avatars.githubusercontent.com/u/6782613?v=4" width="100;" alt="nliaudat"/>
@@ -368,13 +368,6 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>parhedberg</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/fsck-block">
<img src="https://avatars.githubusercontent.com/u/58307481?v=4" width="100;" alt="fsck-block"/>
<br />
<sub><b>fsck-block</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/slovdahl">
<img src="https://avatars.githubusercontent.com/u/1417619?v=4" width="100;" alt="slovdahl"/>
@@ -396,6 +389,13 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>LordGuilly</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/bilalmirza74">
<img src="https://avatars.githubusercontent.com/u/84387676?v=4" width="100;" alt="bilalmirza74"/>
<br />
<sub><b>Bilal Mirza</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/muggenhor">
<img src="https://avatars.githubusercontent.com/u/484066?v=4" width="100;" alt="muggenhor"/>
@@ -406,17 +406,10 @@ There are some ideas and feature requests which are not currently being pursued
</tr>
<tr>
<td align="center">
<a href="https://github.com/bilalmirza74">
<img src="https://avatars.githubusercontent.com/u/84387676?v=4" width="100;" alt="bilalmirza74"/>
<a href="https://github.com/ppisljar">
<img src="https://avatars.githubusercontent.com/u/13629809?v=4" width="100;" alt="ppisljar"/>
<br />
<sub><b>Bilal Mirza</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/AngryApostrophe">
<img src="https://avatars.githubusercontent.com/u/89547888?v=4" width="100;" alt="AngryApostrophe"/>
<br />
<sub><b>AngryApostrophe</b></sub>
<sub><b>Peter Pisljar</b></sub>
</a>
</td>
<td align="center">
@@ -433,13 +426,6 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Ranjana761</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SURYANSH-RAI">
<img src="https://avatars.githubusercontent.com/u/79277130?v=4" width="100;" alt="SURYANSH-RAI"/>
<br />
<sub><b>SURYANSH RAI</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SkylightXD">
<img src="https://avatars.githubusercontent.com/u/16561545?v=4" width="100;" alt="SkylightXD"/>
@@ -447,8 +433,6 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>SkylightXD</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/ottk3">
<img src="https://avatars.githubusercontent.com/u/5236802?v=4" width="100;" alt="ottk3"/>
@@ -463,6 +447,8 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Tobias Bieniek</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/tkopczuk">
<img src="https://avatars.githubusercontent.com/u/101632?v=4" width="100;" alt="tkopczuk"/>
@@ -491,8 +477,6 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>flox_x</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/gneluka">
<img src="https://avatars.githubusercontent.com/u/32097881?v=4" width="100;" alt="gneluka"/>
@@ -507,6 +491,8 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>kalwados</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/kub3let">
<img src="https://avatars.githubusercontent.com/u/95883234?v=4" width="100;" alt="kub3let"/>
@@ -535,8 +521,13 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>smartboart</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/AngryApostrophe">
<img src="https://avatars.githubusercontent.com/u/89547888?v=4" width="100;" alt="AngryApostrophe"/>
<br />
<sub><b>AngryApostrophe</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/wetneb">
<img src="https://avatars.githubusercontent.com/u/309908?v=4" width="100;" alt="wetneb"/>
@@ -544,6 +535,8 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Antonin Delpeuch</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/adarazs">
<img src="https://avatars.githubusercontent.com/u/6269603?v=4" width="100;" alt="adarazs"/>
@@ -579,8 +572,6 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Dave</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/FarukhS52">
<img src="https://avatars.githubusercontent.com/u/129654632?v=4" width="100;" alt="FarukhS52"/>
@@ -588,6 +579,8 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Farookh Zaheer Siddiqui</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/hex7c0">
<img src="https://avatars.githubusercontent.com/u/4419146?v=4" width="100;" alt="hex7c0"/>
@@ -623,8 +616,6 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>Joerg Rosenkranz</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/Innovatorcloudy">
<img src="https://avatars.githubusercontent.com/u/183274513?v=4" width="100;" alt="Innovatorcloudy"/>
@@ -632,6 +623,8 @@ There are some ideas and feature requests which are not currently being pursued
<sub><b>KrishCode</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/myxor">
<img src="https://avatars.githubusercontent.com/u/1397377?v=4" width="100;" alt="myxor"/>
@@ -659,13 +652,6 @@ There are some ideas and feature requests which are not currently being pursued
<br />
<sub><b>Michael Geissler</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/ppisljar">
<img src="https://avatars.githubusercontent.com/u/13629809?v=4" width="100;" alt="ppisljar"/>
<br />
<sub><b>Peter Pisljar</b></sub>
</a>
</td>
</tr>
<tbody>

View File

@@ -96,15 +96,15 @@ void task_do_Update_ZIP(void *pvParameter)
/* ZIP file got extracted, replace the old html folder with the new one */
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Renaming folder " + outHtml + " to " + outHtmlOld + "...");
RenameFolder(outHtml, outHtmlOld);
::rename(outHtml.c_str(), outHtmlOld.c_str());
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Renaming folder " + outHtmlTmp + " to " + outHtml + "...");
RenameFolder(outHtmlTmp, outHtml);
::rename(outHtmlTmp.c_str(), outHtml.c_str());
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Deleting folder " + outHtmlOld + "...");
removeFolder(outHtmlOld.c_str(), TAG);
if (retfirmware.length() > 0)
{
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Found firmware.bin");
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Found firmware.bin");
ota_update_task(retfirmware);
}

View File

@@ -365,35 +365,19 @@ size_t findDelimiterPos(string input, string delimiter)
bool RenameFile(string from, string to)
{
// ESP_LOGI(logTag, "Renaming File: %s", from.c_str());
// ESP_LOGI(logTag, "Deleting file: %s", fn.c_str());
/* Delete file */
FILE *fpSourceFile = fopen(from.c_str(), "rb");
// Sourcefile does not exist otherwise there is a mistake when renaming!
// Sourcefile existiert nicht sonst gibt es einen Fehler beim Kopierversuch!
if (!fpSourceFile)
{
ESP_LOGE(TAG, "RenameFile: File %s does not exist!", from.c_str());
ESP_LOGE(TAG, "DeleteFile: File %s existiert nicht!", from.c_str());
return false;
}
fclose(fpSourceFile);
rename(from.c_str(), to.c_str());
return true;
}
bool RenameFolder(string from, string to)
{
// ESP_LOGI(logTag, "Renaming Folder: %s", from.c_str());
DIR *fpSourceFolder = opendir(from.c_str());
// Sourcefolder does not exist otherwise there is a mistake when renaming!
if (!fpSourceFolder)
{
ESP_LOGE(TAG, "RenameFolder: Folder %s does not exist!", from.c_str());
return false;
}
closedir(fpSourceFolder);
rename(from.c_str(), to.c_str());
return true;
@@ -403,7 +387,7 @@ bool FileExists(string filename)
{
FILE *fpSourceFile = fopen(filename.c_str(), "rb");
// Sourcefile does not exist
// Sourcefile existiert nicht sonst gibt es einen Fehler beim Kopierversuch!
if (!fpSourceFile)
{
return false;
@@ -414,36 +398,22 @@ bool FileExists(string filename)
return true;
}
bool FolderExists(string foldername)
bool DeleteFile(string fn)
{
DIR *fpSourceFolder = opendir(foldername.c_str());
// Sourcefolder does not exist
if (!fpSourceFolder)
{
return false;
}
closedir(fpSourceFolder);
return true;
}
bool DeleteFile(string filename)
{
// ESP_LOGI(logTag, "Deleting file: %s", filename.c_str());
// ESP_LOGI(logTag, "Deleting file: %s", fn.c_str());
/* Delete file */
FILE *fpSourceFile = fopen(filename.c_str(), "rb");
FILE *fpSourceFile = fopen(fn.c_str(), "rb");
// Sourcefile does not exist otherwise there is a mistake in copying!
// Sourcefile existiert nicht sonst gibt es einen Fehler beim Kopierversuch!
if (!fpSourceFile)
{
ESP_LOGD(TAG, "DeleteFile: File %s existiert nicht!", filename.c_str());
ESP_LOGD(TAG, "DeleteFile: File %s existiert nicht!", fn.c_str());
return false;
}
fclose(fpSourceFile);
unlink(filename.c_str());
unlink(fn.c_str());
return true;
}

View File

@@ -16,12 +16,10 @@ std::size_t file_size(const std::string& file_name);
void FindReplace(std::string& line, std::string& oldString, std::string& newString);
bool CopyFile(string input, string output);
bool DeleteFile(string filename);
bool DeleteFile(string fn);
bool RenameFile(string from, string to);
bool RenameFolder(string from, string to);
bool MakeDir(std::string _what);
bool FileExists(string filename);
bool FolderExists(string foldername);
string RundeOutput(double _in, int _anzNachkomma);

View File

@@ -1,6 +1,4 @@
#include "openmetrics.h"
#include "functional"
#include "esp_log.h"
/**
* create a singe metric from the given input
@@ -12,66 +10,10 @@ std::string createMetric(const std::string &metricName, const std::string &help,
metricName + " " + value + "\n";
}
typedef struct sequence_metric {
const char *name;
const char *help;
const char *type;
std::function<std::string(NumberPost *number)> valueFunc;
} sequence_metric_t;
sequence_metric_t sequenceMetrics[4] = {
{ "flow_value", "current value of meter readout", "gauge", [](NumberPost *number)-> std::string {return number->ReturnValue;} },
{ "flow_raw_value", "current raw value of meter readout", "gauge", [](NumberPost *number)-> std::string {return number->ReturnRawValue;} },
{ "flow_pre_value", "previous value of meter readout", "gauge", [](NumberPost *number)-> std::string {return number->ReturnPreValue;} },
{ "flow_error", "Error message text != 'no error'", "gauge", [](NumberPost *number)-> std::string {return number->ErrorMessageText.compare("no error") == 0 ? "0" : "1";} },
};
std::string createSequenceMetrics(std::string prefix, const std::vector<NumberPost *> &numbers)
{
std::string result;
for (int i = 0; i<sizeof(sequenceMetrics)/sizeof(sequence_metric_t);i++)
{
std::string res;
for (const auto &number : numbers)
{
std::string value = sequenceMetrics[i].valueFunc(number);
if (value.find("N") != std::string::npos) {
value = "NaN";
}
ESP_LOGD("METRICS", "metric=%s, name=%s, value = %s ",sequenceMetrics[i].name,number->name.c_str(), value.c_str());
// only valid data is reported (https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#missing-data)
if (value.length() > 0)
{
auto label = number->name;
// except newline, double quote, and backslash (https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#abnf)
// to keep it simple, these characters are just removed from the label
replaceAll(label, "\\", "");
replaceAll(label, "\"", "");
replaceAll(label, "\n", "");
res += prefix + "_" + sequenceMetrics[i].name + "{sequence=\"" + label + "\"} " + value + "\n";
}
}
// prepend metadata if a valid metric was created
if (res.length() > 0)
{
res = "# HELP " + prefix + "_" + sequenceMetrics[i].name + " " + sequenceMetrics[i].help + "\n"
+ "# TYPE " + prefix + "_" + sequenceMetrics[i].name + " " + sequenceMetrics[i].type + "\n"
+ res;
}
result += res;
}
return result;
}
/**
* Generate the MetricFamily from all available sequences
* @returns the string containing the text wire format of the MetricFamily
**/
/*
std::string createSequenceMetrics(std::string prefix, const std::vector<NumberPost *> &numbers)
{
std::string res;
@@ -99,4 +41,3 @@ std::string createSequenceMetrics(std::string prefix, const std::vector<NumberPo
}
return res;
}
*/

View File

@@ -254,35 +254,6 @@ extern "C" void app_main(void)
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "==================== Start ======================");
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
// SD card: basic R/W check
// ********************************************
int iSDCardStatus = SDCardCheckRW();
if (iSDCardStatus < 0) {
if (iSDCardStatus <= -1 && iSDCardStatus >= -2) { // write error
StatusLED(SDCARD_CHECK, 1, true);
}
else if (iSDCardStatus <= -3 && iSDCardStatus >= -5) { // read error
StatusLED(SDCARD_CHECK, 2, true);
}
else if (iSDCardStatus == -6) { // delete error
StatusLED(SDCARD_CHECK, 3, true);
}
setSystemStatusFlag(SYSTEM_STATUS_SDCARD_CHECK_BAD); // reduced web interface going to be loaded
}
// SD card: Create further mandatory directories (if not already existing)
// Correct creation of these folders will be checked with function "SDCardCheckFolderFilePresence"
// ********************************************
MakeDir("/sdcard/firmware"); // mandatory for OTA firmware update
MakeDir("/sdcard/img_tmp"); // mandatory for setting up alignment marks
MakeDir("/sdcard/demo"); // mandatory for demo mode
MakeDir("/sdcard/config/certs"); // mandatory for mqtt certificates
// Check for updates
// ********************************************
CheckOTAUpdate();
CheckUpdate();
// Init external PSRAM
// ********************************************
esp_err_t PSRAMStatus = esp_psram_init();
@@ -381,6 +352,22 @@ extern "C" void app_main(void)
}
}
// SD card: basic R/W check
// ********************************************
int iSDCardStatus = SDCardCheckRW();
if (iSDCardStatus < 0) {
if (iSDCardStatus <= -1 && iSDCardStatus >= -2) { // write error
StatusLED(SDCARD_CHECK, 1, true);
}
else if (iSDCardStatus <= -3 && iSDCardStatus >= -5) { // read error
StatusLED(SDCARD_CHECK, 2, true);
}
else if (iSDCardStatus == -6) { // delete error
StatusLED(SDCARD_CHECK, 3, true);
}
setSystemStatusFlag(SYSTEM_STATUS_SDCARD_CHECK_BAD); // reduced web interface going to be loaded
}
// Migrate parameter in config.ini to new naming (firmware 15.0 and newer)
// ********************************************
migrateConfiguration();
@@ -393,6 +380,19 @@ extern "C" void app_main(void)
// ********************************************
setCpuFrequency();
// SD card: Create further mandatory directories (if not already existing)
// Correct creation of these folders will be checked with function "SDCardCheckFolderFilePresence"
// ********************************************
MakeDir("/sdcard/firmware"); // mandatory for OTA firmware update
MakeDir("/sdcard/img_tmp"); // mandatory for setting up alignment marks
MakeDir("/sdcard/demo"); // mandatory for demo mode
MakeDir("/sdcard/config/certs"); // mandatory for mqtt certificates
// Check for updates
// ********************************************
CheckOTAUpdate();
CheckUpdate();
// Start SoftAP for initial remote setup
// Note: Start AP if no wlan.ini and/or config.ini available, e.g. SD card empty; function does not exit anymore until reboot
// ********************************************

View File

@@ -37,58 +37,23 @@ void test_createSequenceMetrics()
NumberPost *number_1 = new NumberPost;
number_1->name = "main";
number_1->ReturnValue = "123.456";
number_1->ReturnRawValue = "N23.456";
number_1->ReturnPreValue = "986.543";
number_1->ErrorMessageText = "";
NUMBERS.push_back(number_1);
const std::string metricNamePrefix = "ai_on_the_edge_device";
const std::string metricName1 = metricNamePrefix + "_flow_value";
const std::string metricName2 = metricNamePrefix + "_flow_raw_value";
const std::string metricName3 = metricNamePrefix + "_flow_pre_value";
const std::string metricName4 = metricNamePrefix + "_flow_error";
std::string expected1 ;
expected1 = "# HELP " + metricName1 + " current value of meter readout\n# TYPE " + metricName1 + " gauge\n" +
metricName1 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n";
expected1 += "# HELP " + metricName2 + " current raw value of meter readout\n# TYPE " + metricName2 + " gauge\n" +
metricName2 + "{sequence=\"" + number_1->name + "\"} " + "NaN" + "\n";
expected1 += "# HELP " + metricName3 + " previous value of meter readout\n# TYPE " + metricName3 + " gauge\n" +
metricName3 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnPreValue + "\n";
expected1 += "# HELP " + metricName4 + " Error message text != 'no error'\n# TYPE " + metricName4 + " gauge\n" +
metricName4 + "{sequence=\"" + number_1->name + "\"} " + "1" + "\n";
const std::string metricName = metricNamePrefix + "_flow_value";
std::string expected1 = "# HELP " + metricName + " current value of meter readout\n# TYPE " + metricName + " gauge\n" +
metricName + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n";
TEST_ASSERT_EQUAL_STRING(expected1.c_str(), createSequenceMetrics(metricNamePrefix, NUMBERS).c_str());
NumberPost *number_2 = new NumberPost;
number_2->name = "secondary";
number_2->ReturnValue = "1.0";
number_2->ReturnRawValue = "01.000";
number_2->ReturnPreValue = "0.987";
number_2->ErrorMessageText = "no error";
NUMBERS.push_back(number_2);
std::string expected2 ;
expected2 = "# HELP " + metricName1 + " current value of meter readout\n# TYPE " + metricName1 + " gauge\n" +
metricName1 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n" +
metricName1 + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnValue + "\n";
expected2 += "# HELP " + metricName2 + " current raw value of meter readout\n# TYPE " + metricName2 + " gauge\n" +
metricName2 + "{sequence=\"" + number_1->name + "\"} " + "NaN" + "\n" +
metricName2 + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnRawValue + "\n";
expected2 += "# HELP " + metricName3 + " previous value of meter readout\n# TYPE " + metricName3 + " gauge\n" +
metricName3 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnPreValue + "\n" +
metricName3 + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnPreValue + "\n";
expected2 += "# HELP " + metricName4 + " Error message text != 'no error'\n# TYPE " + metricName4 + " gauge\n" +
metricName4 + "{sequence=\"" + number_1->name + "\"} " + "1" + "\n" +
metricName4 + "{sequence=\"" + number_2->name + "\"} " + "0" + "\n";
std::string expected2 = "# HELP " + metricName + " current value of meter readout\n# TYPE " + metricName + " gauge\n" +
metricName + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n" +
metricName + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnValue + "\n";
TEST_ASSERT_EQUAL_STRING(expected2.c_str(), createSequenceMetrics(metricNamePrefix, NUMBERS).c_str());
}

View File

@@ -79,18 +79,6 @@
transform: translate(-50%,-50%);
-ms-transform: translate(-50%,-50%);
}
#reboot_button {
float: none;
background-color: #f44336;
color: white;
padding: 5px;
border-radius:
5px; font-weight: bold;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
<link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
@@ -200,11 +188,13 @@
param;
function doReboot() {
var stringota = domainname + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
if (confirm("Are you sure you want to reboot? Did you save your changes?")) {
var stringota = domainname + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
function ChangeSelection(){
@@ -225,45 +215,50 @@
document.getElementById("overlay").style.display = "block";
document.getElementById("overlaytext").innerHTML = "Save Alignment Marker...";
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function task() {
while (true) {
WriteConfigININew();
if (neueref1 == 1 && neueref2 == 1) {
UpdateConfigReferences(domainname);
}
else if (neueref1 == 1) {
var anzneueref = 1;
UpdateConfigReference(anzneueref, domainname);
}
else if (neueref2 == 1) {
var anzneueref = 2;
UpdateConfigReference(anzneueref, domainname);
}
SaveConfigToServer(domainname);
document.getElementById("updatemarker").disabled = false;
// document.getElementById("savemarker").disabled = true;
// document.getElementById("enhancecontrast").disabled = true;
EnDisableItem(false, "savemarker", true);
EnDisableItem(false, "enhancecontrast", true);
document.getElementById("overlay").style.display = "none";
firework.launch('Alignment marker saved. They will get applied after the next reboot!<br><br>\n<a id="reboot_button" onclick="doReboot()">reboot now</a>', 'success', 5000);
return;
if (confirm("Are you sure you want to save the new alignment marker configuration?")) {
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
}
setTimeout(function () {
// Delay so the overlay gets shown
task();
}, 1);
async function task() {
while (true) {
WriteConfigININew();
if (neueref1 == 1 && neueref2 == 1) {
UpdateConfigReferences(domainname);
}
else if (neueref1 == 1) {
var anzneueref = 1;
UpdateConfigReference(anzneueref, domainname);
}
else if (neueref2 == 1) {
var anzneueref = 2;
UpdateConfigReference(anzneueref, domainname);
}
SaveConfigToServer(domainname);
document.getElementById("updatemarker").disabled = false;
// document.getElementById("savemarker").disabled = true;
// document.getElementById("enhancecontrast").disabled = true;
EnDisableItem(false, "savemarker", true);
EnDisableItem(false, "enhancecontrast", true);
document.getElementById("overlay").style.display = "none";
firework.launch('Alignment marker saved. They will get applied after next reboot', 'success', 5000);
return;
}
}
setTimeout(function () {
// Delay so the overlay gets shown
task();
}, 1);
}
else {
document.getElementById("overlay").style.display = "none";
}
}
function EnhanceContrast() {

View File

@@ -5,20 +5,6 @@
<meta charset="UTF-8" />
<title>Analog ROI</title>
<style>
#reboot_button {
float: none;
background-color: #f44336;
color: white;
padding: 5px;
border-radius:
5px; font-weight: bold;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
<link href="edit_style.css" rel="stylesheet">
<link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
@@ -199,11 +185,13 @@ The following settings are only used for easier setup, they are <b>not</b> persi
domainname = getDomainname();
function doReboot() {
var stringota = getDomainname() + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
if (confirm("Are you sure you want to reboot? Did you save your changes?")) {
var stringota = getDomainname() + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
function EnDisableAnalog() {
@@ -343,14 +331,16 @@ The following settings are only used for easier setup, they are <b>not</b> persi
}
function SaveToConfig() {
//_zwcat = getConfigCategory();
cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
WriteConfigININew();
SaveConfigToServer(domainname);
UpdateROIs();
document.getElementById("saveroi").disabled = true;
if (confirm("Are you sure you want to save the new analog ROI configuration?")) {
//_zwcat = getConfigCategory();
cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
WriteConfigININew();
SaveConfigToServer(domainname);
UpdateROIs();
document.getElementById("saveroi").disabled = true;
firework.launch('Configuration saved. It will get applied after the next reboot!<br><br>\n<a id="reboot_button" onclick="doReboot()">reboot now</a>', 'success', 5000);
firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000);
}
}
function ShowMultiplier() {

View File

@@ -20,18 +20,6 @@
textarea {
font-size: 15px;
}
#reboot_button {
float: none;
background-color: #f44336;
color: white;
padding: 5px;
border-radius:
5px; font-weight: bold;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
<link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
@@ -50,8 +38,15 @@
</td>
</table>
<hr>
<button class="button" onclick="saveTextAsFile()">Save Config</button>
<table>
<td>
<button class="button" onclick="saveTextAsFile()">Save Config</button>
</td>
<td>
<button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate changes</button>
</td>
</table>
<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
@@ -69,19 +64,23 @@
function saveTextAsFile()
{
FileDeleteOnServer("/config/config.ini", domainname);
var textToSave = document.getElementById("inputTextToSave").value;
FileSendContent(textToSave, "/config/config.ini", domainname);
if (confirm("Are you sure you want to save the configuration?")) {
FileDeleteOnServer("/config/config.ini", domainname);
var textToSave = document.getElementById("inputTextToSave").value;
FileSendContent(textToSave, "/config/config.ini", domainname);
firework.launch('Configuration saved. It will get applied after the next reboot!<br><br>\n<a id="reboot_button" onclick="doReboot()">reboot now</a>', 'success', 5000);
firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000);
}
}
function doReboot() {
var stringota = "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
if (confirm("Are you sure you want to reboot?")) {
var stringota = "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
LoadConfigNeu();

View File

@@ -183,19 +183,7 @@
color: white;
transform: translate(-50%,-50%);
-ms-transform: translate(-50%,-50%);
}
#reboot_button {
float: none;
background-color: #f44336;
color: white;
padding: 5px;
border-radius:
5px; font-weight: bold;
text-align: center;
text-decoration: none;
display: inline-block;
}
}
</style>
<link rel="stylesheet" href="mkdocs_theme.css?v=$COMMIT_HASH" />
@@ -2122,9 +2110,14 @@
</tr>
</table>
<hr>
<button class="button" onclick="saveTextAsFile()">Save Config</button>
<table style="padding-top:10px">
<td>
<button class="button" onclick="saveTextAsFile()">Save Config</button>
</td>
<td>
<button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate changes</button>
</td>
</table>
</div>
@@ -2680,16 +2673,18 @@ function saveTextAsFile() {
return;
}
ReadParameterAll();
WriteConfigININew();
SaveConfigToServer(domainname);
if (confirm("Are you sure you want to save the configuration?")) {
ReadParameterAll();
WriteConfigININew();
SaveConfigToServer(domainname);
firework.launch('Configuration saved. It will get applied after the next reboot!<br><br>\n<a id="reboot_button" onclick="doReboot()">reboot now</a>', 'success', 5000);
firework.launch('Configuration saved. It will get applied after the next reboot!', 'success', 5000);
if (changeCamValue == 1) {
camSettingsSet();
firework.launch('You have changed the camera settings, creating a new reference image and updating the alignment marks is mandatory!', 'success', 5000);
}
if (changeCamValue == 1) {
camSettingsSet();
firework.launch('You have changed the camera settings, so creating a new reference image and updating the alignment marks is mandatory!', 'success', 10000);
}
}
}
function camSettingsSet(){
@@ -2880,7 +2875,7 @@ function camSettingsSet(){
if (xhttp.responseText == "CamSettingsSet") {
document.getElementById("overlay").style.display = "none";
firework.launch('Cam Settings saved', 'success', 5000);
firework.launch('Cam Settings saved', 'success', 2000);
return;
}
else {
@@ -2908,11 +2903,13 @@ function camSettingsSet(){
}
function doReboot() {
var stringota = domainname + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
if (confirm("Are you sure you want to reboot?")) {
var stringota = domainname + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
function FormatDecimalValue(_param, _cat, _name) {

View File

@@ -4,19 +4,6 @@
<head>
<meta charset="UTF-8" />
<title>Digit ROI</title>
<style>
#reboot_button {
float: none;
background-color: #f44336;
color: white;
padding: 5px;
border-radius:
5px; font-weight: bold;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
<link href="edit_style.css" rel="stylesheet">
<link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
@@ -217,11 +204,13 @@
domainname = getDomainname();
function doReboot() {
var stringota = getDomainname() + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
if (confirm("Are you sure you want to reboot? Did you save your changes?")) {
var stringota = getDomainname() + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
function EnDisableDigits() {
@@ -370,14 +359,16 @@
}
function SaveToConfig() {
// _zwcat = getConfigCategory();
cofcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
WriteConfigININew();
SaveConfigToServer(domainname);
UpdateROIs();
document.getElementById("saveroi").disabled = true;
if (confirm("Are you sure you want to save the new digit ROI configuration?")) {
// _zwcat = getConfigCategory();
cofcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
WriteConfigININew();
SaveConfigToServer(domainname);
UpdateROIs();
document.getElementById("saveroi").disabled = true;
firework.launch('Configuration saved. It will get applied after the next reboot!<br><br>\n<a id="reboot_button" onclick="doReboot()">reboot now</a>', 'success', 5000);
firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000);
}
}
function ShowMultiplier() {

View File

@@ -395,12 +395,22 @@
<script type="text/javascript">
var canvas = document.getElementById('canvas'),
domainname = getDomainname(),
context = canvas.getContext('2d'),
imageObj = new Image(),
isActReference = false,
param,
category;
domainname = getDomainname(),
context = canvas.getContext('2d'),
imageObj = new Image(),
isActReference = false,
param,
category;
function doReboot() {
if (confirm("Are you sure you want to reboot? Did you save the config?")) {
var stringota = domainname + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
function cameraParameterChanged() {
document.getElementById("savereferenceimage").disabled = true;
@@ -728,7 +738,7 @@
if (xhttp.responseText == "CamSettingsSet") {
document.getElementById("overlay").style.display = "none";
firework.launch('Cam Settings saved', 'success', 5000);
firework.launch('Cam Settings saved', 'success', 2000);
return;
}
else {

View File

@@ -34,11 +34,13 @@ p {font-size: 1em;}
<script>
function doReboot() {
var stringota = getDomainname() + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
// if (confirm("Are you sure you want to reboot the ESP32?")) {
var stringota = getDomainname() + "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
// }
}
</script>

View File

@@ -29,7 +29,7 @@
// var xhttp = new XMLHttpRequest();
// xhttp.onreadystatechange = function() {if (xhttp.readyState == 4) {if (xhttp.status == 200) {document.reload();}}};
if (!file.name.includes("remote-setup")){
if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure you have downloaded the correct file?"))
if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure that you have downloaded the correct file?"))
return;
}
@@ -41,7 +41,7 @@ if (!file.name.includes("remote-setup")){
var file = document.getElementById("newfile").files[0];
if (!file.name.includes("remote-setup"))
{
if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure you have downloaded the correct file?"))
if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure that you have downloaded the correct file?"))
return;
}