[SITE] Renew the web board presentation and the ESP32 web upload + [SYS] Security checks (#2277)
* Refactor GitHub Actions workflows for build, documentation, and linting - Consolidated build logic into reusable workflows (`task-build.yml` and `task-docs.yml`) to reduce duplication across multiple workflows. - Introduced `environments.json` to centralize the list of PlatformIO build environments, improving maintainability and clarity. - Updated `build.yml` and `build_and_docs_to_dev.yml` to utilize the new reusable workflows and environment definitions. - Enhanced `release.yml` to streamline the release process and integrate documentation generation. - Created reusable linting workflow (`task-lint.yml`) to standardize code formatting checks across the repository. - Simplified manual documentation workflow by leveraging the new reusable documentation workflow. - Improved artifact management and retention policies across workflows. - Updated dependencies and versions in workflows to ensure compatibility and performance. CI/CD pipeline agnostic of Workflow Engine and integrated on github actions - Implemented ci.sh for orchestrating the complete build pipeline. - Created ci_00_config.sh for centralized configuration of build scripts. - Created ci_build_firmware.sh for building firmware for specified PlatformIO environments. - Created ci_prepare_artifacts.sh for preparing firmware artifacts for upload or deployment. - Created ci_set_version.sh for updating version tags in firmware configuration files. - Created ci_build.sh to orchestrate the complete build pipeline. - Created ci_qa.sh for code linting and formatting checks using clang-format. - Created ci_site.sh for building and deploying VuePress documentation with version management. - Implemented checks for required tools and dependencies in the new scripts. - Improved internal scripts for better error handling and logging. UPDATE the web installer manifest generation and update documentation structure - Enhanced ci_list-env.sh to list environments from a JSON file. - Replaced common_wu.py and gen_wu.py scripts with new npm scripts for site generation and previewing on docsgen/gen_wu.js - Replaced generate_board_docs.py with docsgen/generated_board_docs.js - Added new npm scripts for integration of site generation on build phase. - Created preview_site.js to serve locally generated site over HTTPS with improved error handling. - Added new CI environments for CI builds in environments.json. - Deleted lint.yml as part of workflow cleanup. - Enhanced task-build.yml to include linting as a job and added support for specifying PlatformIO version. - Improved task-docs.yml to handle versioning more effectively and added clean option. Enhance documentation - ADD CLEAR Mark of development version of site - Updated README.md to include detailed workflow dependencies and relationships using mermaid diagrams. - Improved development.md with a quick checklist for contributors and clarified the code style guide. - Enhanced quick_start.md with tips for contributors and streamlined the workflow explanation. LINT FIX - Refined User_config.h for better formatting consistency. - Adjusted blufi.cpp and gatewayBT.cpp for improved code readability and consistency in formatting. - Updated gatewaySERIAL.cpp and mqttDiscovery.cpp to enhance logging error messages. - Improved sensorDS1820.cpp for better logging of device information. Add security scan workflows for vulnerability detection Add SBOM generation and upload to release workflow; update security scan summary handling Add shellcheck suppor + FIX shellcheck warning Enhance documentation for CI/CD scripts and workflows, adding details for security scanning and SBOM generation processes Fix formatting and alignment in BLE connection handling Reviewed the full web board presentation and the ESP32 web upload. The project uses a modern pattern where data is divided from the presentation layer. - Removed the `generate_board_docs` script. - Updated the `gen_wu` script in order to generate `boards-info.json`: the fail that containe all information about the configuration - Created and isolate the file `boards-info.js` to streamline the parsing of PlatformIO dependencies, modules, environments and improve the handling of library information. - Introduced vuepress component `BoardEnvironmentTable.vue` that render `boards-info.json` as UI card component - Introduced vuepress component `FlashEnvironmentSelector.vue` that render a selectred environment from `boards-info.json` and provide esp-web-upload feature on it - Introduced a new board page `board-selector.md` for improved firmware selection. - Updated `web-install.md` to enhance the firmware upload process, including a new board environment table. - Enhanced custom descriptions in `environments.ini` to include HTML links for better user guidance and board image link Add CC1101 initialization improvements and logging enhancements Add installation step for PlatformIO dependencies in documentation workflow Remove ci_set_version.sh script and associated versioning functionality * Fix comment provisined Fix PlatformIO version input reference in documentation workflow Remove outdated Squeezelite-ESP32 installer documentation
This commit is contained in:
1 parent
5f0966c2c1
commit
98481c5145
73 files changed
+5985
-2447
No files matched your search
@@ -1,16 +1,16 @@
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <DHT.h>
|
||||
#include <DHT_U.h>
|
||||
#include <LoRa.h>
|
||||
#include <SPI.h>
|
||||
#include <WiFi.h>
|
||||
#include <Wire.h>
|
||||
#include <stdio.h>
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <DHT.h>
|
||||
#include <DHT_U.h>
|
||||
|
||||
#include "SSD1306.h"
|
||||
|
||||
//LoRa pins
|
||||
#define SCK 5 // GPIO5 -- SX1278's SCK
|
||||
#define SCK 5 // GPIO5 -- SX1278's SCK
|
||||
#define MISO 19 // GPIO19 -- SX1278's MISnO
|
||||
#define MOSI 27 // GPIO27 -- SX1278's MOSI
|
||||
#define SS 18 // GPIO18 -- SX1278's CS
|
||||
@@ -20,17 +20,17 @@
|
||||
|
||||
//OLED pins
|
||||
#define OLED_SDA 21
|
||||
#define OLED_SCL 22
|
||||
#define OLED_SCL 22
|
||||
//#define OLED_RST 16
|
||||
|
||||
#define LED 25
|
||||
#define LED 25
|
||||
|
||||
#define DHT_PIN 14
|
||||
#define DHT_TYPE DHT22
|
||||
|
||||
#define CNT_PIN 34
|
||||
#define CNT_PIN 34
|
||||
|
||||
#define BAT_PIN 35
|
||||
#define BAT_PIN 35
|
||||
|
||||
const int MAX_ANALOG_VAL = 4095;
|
||||
const float MAX_BATTERY_VOLTAGE = 4.2;
|
||||
@@ -38,7 +38,7 @@ const float MAX_BATTERY_VOLTAGE = 4.2;
|
||||
int cntpkt = 0;
|
||||
unsigned long counter = 0;
|
||||
unsigned long last_interrupt_time = 0;
|
||||
int pulse_seen = 0; // pulse detected by interrupt function
|
||||
int pulse_seen = 0; // pulse detected by interrupt function
|
||||
int bounce_delay_ms = 100;
|
||||
|
||||
SSD1306 display(0x3c, OLED_SDA, OLED_SCL);
|
||||
@@ -46,9 +46,9 @@ String rssi = "RSSI --";
|
||||
String packSize = "--";
|
||||
String packet;
|
||||
|
||||
DHT_Unified dht(DHT_PIN, DHT_TYPE); //Inizializza oggetto chiamato "dht", parametri: pin a cui è connesso il sensore, tipo di dht 11/22
|
||||
DHT_Unified dht(DHT_PIN, DHT_TYPE); // Initialize the "dht" object with sensor pin and DHT type (11/22)
|
||||
|
||||
void ICACHE_RAM_ATTR bounceCheck ();
|
||||
void ICACHE_RAM_ATTR bounceCheck();
|
||||
|
||||
void setup() {
|
||||
pinMode(LED, OUTPUT);
|
||||
@@ -75,32 +75,50 @@ void setup() {
|
||||
display.flipScreenVertically();
|
||||
display.setFont(ArialMT_Plain_10);
|
||||
|
||||
pinMode(BAT_PIN, INPUT);
|
||||
pinMode(BAT_PIN, INPUT);
|
||||
pinMode(CNT_PIN, INPUT_PULLUP);
|
||||
|
||||
attachInterrupt (CNT_PIN, bounceCheck, RISING);
|
||||
|
||||
attachInterrupt(CNT_PIN, bounceCheck, RISING);
|
||||
|
||||
dht.begin();
|
||||
sensor_t sensor;
|
||||
dht.temperature().getSensor(&sensor);
|
||||
Serial.println(F("------------------------------------"));
|
||||
Serial.println(F("Temperature Sensor"));
|
||||
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
|
||||
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
|
||||
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
|
||||
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("°C"));
|
||||
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("°C"));
|
||||
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("°C"));
|
||||
Serial.print(F("Sensor Type: "));
|
||||
Serial.println(sensor.name);
|
||||
Serial.print(F("Driver Ver: "));
|
||||
Serial.println(sensor.version);
|
||||
Serial.print(F("Unique ID: "));
|
||||
Serial.println(sensor.sensor_id);
|
||||
Serial.print(F("Max Value: "));
|
||||
Serial.print(sensor.max_value);
|
||||
Serial.println(F("°C"));
|
||||
Serial.print(F("Min Value: "));
|
||||
Serial.print(sensor.min_value);
|
||||
Serial.println(F("°C"));
|
||||
Serial.print(F("Resolution: "));
|
||||
Serial.print(sensor.resolution);
|
||||
Serial.println(F("°C"));
|
||||
Serial.println(F("------------------------------------"));
|
||||
// Print humidity sensor details.
|
||||
dht.humidity().getSensor(&sensor);
|
||||
Serial.println(F("Humidity Sensor"));
|
||||
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
|
||||
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
|
||||
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
|
||||
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("%"));
|
||||
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("%"));
|
||||
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("%"));
|
||||
Serial.print(F("Sensor Type: "));
|
||||
Serial.println(sensor.name);
|
||||
Serial.print(F("Driver Ver: "));
|
||||
Serial.println(sensor.version);
|
||||
Serial.print(F("Unique ID: "));
|
||||
Serial.println(sensor.sensor_id);
|
||||
Serial.print(F("Max Value: "));
|
||||
Serial.print(sensor.max_value);
|
||||
Serial.println(F("%"));
|
||||
Serial.print(F("Min Value: "));
|
||||
Serial.print(sensor.min_value);
|
||||
Serial.println(F("%"));
|
||||
Serial.print(F("Resolution: "));
|
||||
Serial.print(sensor.resolution);
|
||||
Serial.println(F("%"));
|
||||
Serial.println(F("------------------------------------"));
|
||||
|
||||
delay(1500);
|
||||
@@ -117,15 +135,14 @@ void loop() {
|
||||
display.drawString(90, 0, String(cntpkt));
|
||||
|
||||
String NodeId = WiFi.macAddress();
|
||||
// float temp = dht.readTemperature();
|
||||
// float hum = dht.readHumidity();
|
||||
// float temp = dht.readTemperature();
|
||||
// float hum = dht.readHumidity();
|
||||
float battery = getBattery();
|
||||
|
||||
dht.temperature().getEvent(&event1);
|
||||
if (isnan(event1.temperature)) {
|
||||
Serial.println(F("Error reading temperature!"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Serial.print(F("Temperature: "));
|
||||
Serial.print(event1.temperature);
|
||||
Serial.println(F("°C"));
|
||||
@@ -134,8 +151,7 @@ void loop() {
|
||||
dht.humidity().getEvent(&event2);
|
||||
if (isnan(event2.relative_humidity)) {
|
||||
Serial.println(F("Error reading humidity!"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Serial.print(F("Humidity: "));
|
||||
Serial.print(event2.relative_humidity);
|
||||
Serial.println(F("%"));
|
||||
@@ -150,10 +166,10 @@ void loop() {
|
||||
LoRa.endPacket();
|
||||
|
||||
Serial.println(msg);
|
||||
|
||||
|
||||
display.drawString(0, 15, String(NodeId));
|
||||
display.drawString(0, 30, "count: " + String(counter));
|
||||
display.drawString(0, 45, "battery: " + String(battery)+ " %");
|
||||
display.drawString(0, 45, "battery: " + String(battery) + " %");
|
||||
display.display();
|
||||
|
||||
delay(5000);
|
||||
@@ -167,10 +183,10 @@ void loop() {
|
||||
delay(6000);
|
||||
}
|
||||
|
||||
void ICACHE_RAM_ATTR bounceCheck (){
|
||||
unsigned long interrupt_time = millis();
|
||||
if (interrupt_time - last_interrupt_time > bounce_delay_ms) counter++; // void loop() then notes pulse == 1 and takes action
|
||||
last_interrupt_time = interrupt_time;
|
||||
void ICACHE_RAM_ATTR bounceCheck() {
|
||||
unsigned long interrupt_time = millis();
|
||||
if (interrupt_time - last_interrupt_time > bounce_delay_ms) counter++; // void loop() then notes pulse == 1 and takes action
|
||||
last_interrupt_time = interrupt_time;
|
||||
}
|
||||
|
||||
float getBattery(void) {
|
||||
@@ -179,6 +195,5 @@ float getBattery(void) {
|
||||
float voltageLevel = (rawValue / 4095.0) * 2 * 1.1 * 3.3; // calculate voltage level
|
||||
float perc = voltageLevel / MAX_BATTERY_VOLTAGE * 100;
|
||||
|
||||
return(perc);
|
||||
return (perc);
|
||||
}
|
||||
|
||||
@@ -19,17 +19,17 @@
|
||||
|
||||
//OLED pins
|
||||
#define OLED_SDA 21
|
||||
#define OLED_SCL 22
|
||||
#define OLED_SCL 22
|
||||
//#define OLED_RST 16
|
||||
|
||||
#define LED 25
|
||||
#define LED 25
|
||||
|
||||
#define DHT_PIN 12
|
||||
#define DHT_TYPE DHT22
|
||||
#define DHT_TYPE DHT22
|
||||
|
||||
#define CNT_PIN 34
|
||||
#define CNT_PIN 34
|
||||
|
||||
#define BAT_PIN 35
|
||||
#define BAT_PIN 35
|
||||
|
||||
const int MAX_ANALOG_VAL = 4095;
|
||||
const float MAX_BATTERY_VOLTAGE = 4.2;
|
||||
@@ -37,7 +37,7 @@ const float MAX_BATTERY_VOLTAGE = 4.2;
|
||||
int cntpkt = 0;
|
||||
unsigned long counter = 0;
|
||||
unsigned long last_interrupt_time = 0;
|
||||
int pulse_seen = 0; // pulse detected by interrupt function
|
||||
int pulse_seen = 0; // pulse detected by interrupt function
|
||||
int bounce_delay_ms = 100;
|
||||
|
||||
SSD1306 display(0x3c, OLED_SDA, OLED_SCL);
|
||||
@@ -45,9 +45,9 @@ String rssi = "RSSI --";
|
||||
String packSize = "--";
|
||||
String packet;
|
||||
|
||||
DHT dht(DHT_PIN, DHT_TYPE); //Inizializza oggetto chiamato "dht", parametri: pin a cui è connesso il sensore, tipo di dht 11/22
|
||||
DHT dht(DHT_PIN, DHT_TYPE); // Initialize the "dht" object with sensor pin and DHT type (11/22)
|
||||
|
||||
void ICACHE_RAM_ATTR bounceCheck ();
|
||||
void ICACHE_RAM_ATTR bounceCheck();
|
||||
|
||||
void setup() {
|
||||
pinMode(LED, OUTPUT);
|
||||
@@ -74,10 +74,10 @@ void setup() {
|
||||
display.flipScreenVertically();
|
||||
display.setFont(ArialMT_Plain_10);
|
||||
|
||||
pinMode(BAT_PIN, INPUT);
|
||||
pinMode(BAT_PIN, INPUT);
|
||||
pinMode(CNT_PIN, INPUT_PULLUP);
|
||||
|
||||
attachInterrupt (CNT_PIN, bounceCheck, RISING);
|
||||
|
||||
attachInterrupt(CNT_PIN, bounceCheck, RISING);
|
||||
|
||||
delay(1500);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ void loop() {
|
||||
// send packet
|
||||
LoRa.beginPacket();
|
||||
// Build json string to send
|
||||
//per test rimuovere
|
||||
// Remove this line for test
|
||||
|
||||
String msg = "{\"model\":\"ESP32CNT\",\"id\":\"" + NodeId + "\",\"count\":\"" + String(counter) + "\",\"tempc\":\"" + String(temp) + "\",\"hum\":\"" + String(hum) + "\",\"batt\":\"" + String(battery) + "\"}";
|
||||
// Send json string
|
||||
@@ -105,10 +105,10 @@ void loop() {
|
||||
LoRa.endPacket();
|
||||
|
||||
Serial.println(msg);
|
||||
|
||||
|
||||
display.drawString(0, 15, String(NodeId));
|
||||
display.drawString(0, 30, "count: " + String(counter));
|
||||
display.drawString(0, 45, "battery: " + String(battery)+ " %");
|
||||
display.drawString(0, 45, "battery: " + String(battery) + " %");
|
||||
display.display();
|
||||
|
||||
delay(5000);
|
||||
@@ -121,10 +121,10 @@ void loop() {
|
||||
delay(60000); // wait for 60 seconds
|
||||
}
|
||||
|
||||
void ICACHE_RAM_ATTR bounceCheck (){
|
||||
unsigned long interrupt_time = millis();
|
||||
if (interrupt_time - last_interrupt_time > bounce_delay_ms) counter++; // void loop() then notes pulse == 1 and takes action
|
||||
last_interrupt_time = interrupt_time;
|
||||
void ICACHE_RAM_ATTR bounceCheck() {
|
||||
unsigned long interrupt_time = millis();
|
||||
if (interrupt_time - last_interrupt_time > bounce_delay_ms) counter++; // void loop() then notes pulse == 1 and takes action
|
||||
last_interrupt_time = interrupt_time;
|
||||
}
|
||||
|
||||
float getBattery(void) {
|
||||
@@ -133,6 +133,5 @@ float getBattery(void) {
|
||||
float voltageLevel = (rawValue / 4095.0) * 2 * 1.1 * 3.3; // calculate voltage level
|
||||
float perc = voltageLevel / MAX_BATTERY_VOLTAGE * 100;
|
||||
|
||||
return(perc);
|
||||
return (perc);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user