Skip to content
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

Devel #275

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open

Devel #275

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
d06ebc2
v0.6.2rev980 testing CanAirIO Sensors Library 0.7.4
hpsaturn Feb 13, 2024
723520d
changed sensorlib target to platformio registry
hpsaturn Feb 16, 2024
37c9ad6
Fixing bug in the lib_deps, hpsaturn/ESP32 Wifi CLI @ ^0.2.1
sebaxtian Mar 21, 2024
0d0ebef
Merge pull request #277 from sebaxtian/fix/lib-deps
hpsaturn Mar 21, 2024
a8b8be4
migrated config manifest to partial EasyPreferences impl
hpsaturn May 26, 2024
b710e26
complete preferences refactor. First try using EasyPreferences lib
hpsaturn May 26, 2024
e06c08f
fixed issue on cfg init
hpsaturn May 27, 2024
e6f22b7
migrated more variables to easy-preferences schema
hpsaturn May 29, 2024
4ad1b5f
restored BLE and reduced output of config charecteristic
hpsaturn May 29, 2024
c043861
added disable flag to disable BTLE. Tested in C3 and S3
hpsaturn May 30, 2024
92f5266
added new flavor for AirGradient OpenAir esp32c3 version
hpsaturn Jun 3, 2024
a2968ba
added external watchdog feed for Airgradient model
hpsaturn Jun 4, 2024
7ff00c0
fixed issue on ADC pin for air_gradient
hpsaturn Jun 4, 2024
1399672
fixed wifi loop issue for mqtt sevices.
hpsaturn Jun 4, 2024
991fbc6
improved MQTT clouds flows
hpsaturn Jun 5, 2024
ba68359
added station name when Geohash is configured on boot
hpsaturn Jun 7, 2024
d5823c5
migrated to the new version of esp32-wifi-cli
hpsaturn Jun 9, 2024
c01c07d
seperated CLI init methods and added yellow logo
hpsaturn Jun 9, 2024
4de68d6
refactored cli init and commands. Added clear command
hpsaturn Jun 9, 2024
031cf3b
wcli persistence and some storage improvements
hpsaturn Jun 13, 2024
1b897eb
Merge pull request #278 from kike-canaries/cli_migration
hpsaturn Jun 13, 2024
7241416
added general flag for enable/disable battery feature
hpsaturn Jun 13, 2024
4326283
refactored flavors and flags for Airgradient
hpsaturn Jun 14, 2024
3c8ba21
Merge pull request #279 from kike-canaries/batt_disable_flag
hpsaturn Jun 14, 2024
f6f18cf
some minor refactors and fixed telnet issue
hpsaturn Jun 20, 2024
df62d34
fixed dependency issues. Fixed to provisional devel branches
hpsaturn Jun 20, 2024
41ff24c
rev982 enable BLE on all dev flavors. Updates CLI WiFi on boot setting
hpsaturn Jul 20, 2024
0c30577
added openair to build process for deployment
hpsaturn Jul 20, 2024
33e58cb
testing airgradient sgp41 sensor implementation
hpsaturn Sep 14, 2024
6bd7616
added new dependencies target for CLI and Sensors
hpsaturn Sep 14, 2024
f57b14e
improved top list of PM sensors via CLI
hpsaturn Sep 20, 2024
76fd5b2
Merge pull request #280 from kike-canaries/air_gradient_drivers
hpsaturn Sep 20, 2024
20c42b8
reduced tests on PR and devel branch
hpsaturn Sep 20, 2024
19471ff
Merge branch 'air_gradient_drivers' into devel
hpsaturn Sep 20, 2024
97c14d0
updated CLI target version and added fix on Sensorlib
hpsaturn Oct 4, 2024
0055c1f
fixed call enum, unified with the others calls
hpsaturn Oct 29, 2024
4aa6d5d
fixed possible issue with wifi retry and init
hpsaturn Nov 3, 2024
4a6fbeb
improved compatibility with old firmware and new nmcli wifi manager
hpsaturn Nov 3, 2024
d45360a
migrated old wifi flow to new nmcli schema
hpsaturn Nov 4, 2024
f857023
restored some BT preferences and improve nmcli usage
hpsaturn Nov 5, 2024
984c887
Merge pull request #282 from kike-canaries/wcli_wifi_migrate
hpsaturn Nov 7, 2024
5b3d702
rev983 RC released on dev channel
hpsaturn Nov 7, 2024
d0f8e8a
Merge branch 'master' of github.com:kike-canaries/esp32-hpma115s0 int…
hpsaturn Dec 14, 2024
b2fcee7
testing espressif 6.9.0 for C3 cores
hpsaturn Jan 4, 2025
f6ed27b
unified build flags for C3. Disabled BLE and battery. platform v6.9.0
hpsaturn Jan 8, 2025
b0c9f58
rev984 RC2 v0.7.0 ESP32C3 WiFi CLI improvement
hpsaturn Jan 12, 2025
e9f3883
migrated old code to new ArduinoJson schema. Tested on T-Display
hpsaturn Jan 12, 2025
c484dca
Merge pull request #287 from kike-canaries/update_json_library_to_7_3_0
hpsaturn Jan 12, 2025
01644ec
fixed issues around the Python action
hpsaturn Jan 12, 2025
8c7ebc3
Merge pull request #288 from kike-canaries/fix_ci_python_issue
hpsaturn Jan 12, 2025
4541e16
updated outdated library and some minor comments refactor
hpsaturn Jan 14, 2025
d89ec14
Merge pull request #289 from kike-canaries/fix_uart_init_on_c3
hpsaturn Jan 14, 2025
c57111e
migrated to M5Stack Unified Library. (fail in execution)
hpsaturn Jan 15, 2025
2dddb07
Merge branch 'devel' of github.com:kike-canaries/esp32-hpma115s0 into…
hpsaturn Jan 15, 2025
05b47a4
fix compiling issue #281 but is working but have font issues
hpsaturn Jan 15, 2025
a15ccc8
restored primitive call for TFTeSPI old API
hpsaturn Jan 15, 2025
0e7795c
Merge pull request #290 from kike-canaries/fix-m5stickc-lib-issues
hpsaturn Jan 15, 2025
7f3370a
fixed issue when you disabled the BATT flag for build
hpsaturn Jan 17, 2025
8bec247
rev985 v0.7.0 RC3 released on OTA test channel
hpsaturn Jan 18, 2025
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
27 changes: 16 additions & 11 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
name: PlatformIO

on:
push:
pull_request:
branches:
- master
paths-ignore:
- '**/README.md'

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
python-version: [3.7]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
python-version: ${{ matrix.python-version }}
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio
platformio update
- name: Build test
pio pkg update
- name: PlatformIO Build Test
run: |
pio run -e TTGO_T7 -e ESP32DEVKIT -e TTGO_TDISPLAY -e M5STICKCPLUS -e ESP32C3LOLIN

pio run -e TTGO_T7 -e TTGO_TDISPLAY -e ESP32C3LOLIN
28 changes: 17 additions & 11 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
name: PlatformIO

on:
push:
pull_request:
branches:
- devel
paths-ignore:
- '**/README.md'

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
python-version: [3.7]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
python-version: ${{ matrix.python-version }}
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio
platformio update
- name: Build test
pio pkg update
- name: Devel Build Test
run: |
pio run -e TTGO_T7 -e TTGO_TDISPLAY -e M5STICKCPLUS -e ESP32C3LOLIN
pio run -e TTGO_T7 -e TTGO_TDISPLAY -e ESP32C3LOLIN

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ esptool.py
md5output.txt
releases/manifest
releases/installer/rev*

lib/easy-preferences
# IDE
.travis.yml
extensions.json
Expand Down
3 changes: 2 additions & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ OWNER="kike-canaries"
REPO="canairio_firmware"
INSDIR=$RELDIR/installer/${NAME}_installer

flavors="TTGO_T7 WEMOSOLED HELTEC TTGO_TQ ESP32DEVKIT TTGO_TDISPLAY ESP32PICOD4 M5STICKCPLUS M5ATOM M5PICOD4 ESP32C3 ESP32C3OIPLUS ESP32C3LOLIN ESP32C3SEEDX ESP32S3 TTGO_T7S3 LORADEVKIT"
flavors="TTGO_T7 WEMOSOLED HELTEC TTGO_TQ ESP32DEVKIT TTGO_TDISPLAY ESP32PICOD4 M5ATOM M5PICOD4 ESP32C3 ESP32C3OIPLUS ESP32C3LOLIN ESP32C3SEEDX ESP32S3 TTGO_T7S3 LORADEVKIT AG_OPENAIR"
#flavors="TTGO_T7 WEMOSOLED HELTEC TTGO_TQ ESP32DEVKIT TTGO_TDISPLAY ESP32PICOD4 M5STICKCPLUS M5ATOM M5PICOD4 ESP32C3 ESP32C3OIPLUS ESP32C3LOLIN ESP32C3SEEDX ESP32S3 TTGO_T7S3 LORADEVKIT AG_OPENAIR"
#flavors="TTGO_T7 WEMOSOLED ESP32DEVKIT TTGO_TDISPLAY M5STICKCPLUS M5ATOM ESP32C3 ESP32C3OIPLUS ESP32C3LOLIN ESP32C3SEEDX"
#flavors="TTGO_T7 ESP32C3 ESP32C3OIPLUS ESP32C3LOLIN ESP32C3SEEDX"

Expand Down
36 changes: 0 additions & 36 deletions include/wifi.hpp

This file was deleted.

2 changes: 2 additions & 0 deletions lib/batterylib/Batterylib.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef DISABLE_BATT
#ifndef Batterylib_hpp
#define Batterylib_hpp

Expand All @@ -16,3 +17,4 @@
#endif

#endif
#endif
2 changes: 1 addition & 1 deletion lib/batterylib/battery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ class Battery {
}
return (int)percentage;
}
};
};
21 changes: 11 additions & 10 deletions lib/batterylib/battery_m5stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

void Battery_M5STACK::init(bool debug) {
this->debug = debug;
M5.Axp.EnableCoulombcounter(); // Enable Coulomb counter.
// M5.Axp.EnableCoulombcounter(); // Enable Coulomb counter.
setLimits(BATTERY_MIN_V, BATTERY_MAX_V, BATTCHARG_MIN_V, BATTCHARG_MAX_V);
}

Expand All @@ -13,12 +13,12 @@ float Battery_M5STACK::getVoltage() {
}

void Battery_M5STACK::update() {
curv = M5.Axp.GetBatVoltage();
vusb = M5.Axp.GetVBusVoltage();
curv = M5.Power.getBatteryVoltage();
// vusb = M5.Power.getUsbOutput();
}

bool Battery_M5STACK::isCharging() {
return M5.axp.GetVBusVoltage() > btCharVMax;
return M5.Power.getUsbOutput();
}

int Battery_M5STACK::getCharge() {
Expand All @@ -31,15 +31,16 @@ int Battery_M5STACK::getCharge() {

void Battery_M5STACK::printValues() {
if (!debug) return;
Serial.printf("-->[BATT] AXP Temp \t: %.1fC \tC: %03d\r\n", M5.Axp.GetTempInAXP192(), getCharge()); //Get the temperature of AXP192
Serial.printf("-->[BATT] AXP Bat Volts \t: %.3fv \tI: %.3fma\r\n", curv, M5.Axp.GetBatCurrent()); //Output voltage and current of Bat
Serial.printf("-->[BATT] AXP USB Volts \t: %.3fv \tI: %.3fma\r\n", M5.Axp.GetVBusVoltage(), M5.Axp.GetVBusCurrent()); //Output current and voltage of USB
Serial.printf("-->[BATT] AXP 5V Volts \t: %.3fv \tI: %.3fma\r\n", M5.Axp.GetVinVoltage(), M5.Axp.GetVinCurrent());
Serial.printf("-->[BATT] AXP Bat power \t: %.3fmw\r\n", M5.Axp.GetBatPower());
// Serial.printf("-->[BATT] AXP Temp \t: %.1fC \tC: %03d\r\n", M5.Power.GetTempInAXP192(), getCharge()); //Get the temperature of AXP192
Serial.printf("-->[BATT] AXP Bat Volts \t: %.3fv \tI: %.3fma\r\n", curv, M5.Power.getBatteryVoltage()); //Output voltage and current of Bat
// Serial.printf("-->[BATT] AXP USB Volts \t: %.3fv \tI: %.3fma\r\n", M5.Axp.GetVBusVoltage(), M5.Axp.GetVBusCurrent()); //Output current and voltage of USB
Serial.printf("-->[BATT] AXP Bat Level \t: %.3fv \tI: %.3fma\r\n", M5.Power.getBatteryLevel(), M5.Power.getBatteryCurrent());
// Serial.printf("-->[BATT] AXP 5V Volts \t: %.3fv \tI: %.3fma\r\n", M5.Axp.GetVinVoltage(), M5.Axp.GetVinCurrent());
// Serial.printf("-->[BATT] AXP Bat power \t: %.3fmw\r\n", M5.Axp.GetBatPower());
}

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_M5STACKBATTERY)
Battery_M5STACK battery;
#endif

#endif
#endif
4 changes: 2 additions & 2 deletions lib/batterylib/battery_m5stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <battery.hpp>
#ifdef M5STICKCPLUS
#include <M5StickCPlus.h>
#include <M5Unified.h>
#endif

#define BATTERY_MIN_V 3.4
Expand All @@ -13,7 +13,7 @@

class Battery_M5STACK : public Battery {
public:
float vusb = 0.0;
// float vusb = 0.0;
void init(bool debug = false);
float getVoltage();
float getCurrent();
Expand Down
3 changes: 3 additions & 0 deletions lib/batterylib/battery_oled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#elif TTGO_T7S3
#define ADC_PIN 2
int channel_atten = ADC1_CHANNEL_1;
#elif ESP32C3_AIRGRADIENT
#define ADC_PIN 4
int channel_atten = ADC1_CHANNEL_1;
#else
#define ADC_PIN 34
int channel_atten = 0;
Expand Down
49 changes: 27 additions & 22 deletions src/bluetooth.cpp → lib/ble/bluetooth.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#ifndef DISABLE_BLE
#include <bluetooth.hpp>
#include "ConfigApp.hpp"

BLEServer* pServer = NULL;
BLECharacteristic* pCharactData = NULL;
Expand All @@ -12,7 +14,7 @@ bool oldDeviceConnected = false;
*************************************************************************/

String getNotificationData() {
StaticJsonDocument<40> doc; // notification capacity is reduced, only main value
JsonDocument doc; // notification capacity is reduced, only main value
int deviceType = sensors.getUARTDeviceTypeSelected();
if (deviceType <= 3) {
doc["P25"] = sensors.getPM25();
Expand All @@ -25,7 +27,7 @@ String getNotificationData() {
}

String getSensorData() {
StaticJsonDocument<512> doc;
JsonDocument doc;

doc["P1"] = sensors.getPM1();
doc["P25"] = sensors.getPM25();
Expand All @@ -40,8 +42,10 @@ String getSensorData() {
doc["pre"] = sensors.getPressure();
doc["nh3"] = sensors.getNH3();
doc["co"] = sensors.getCO();
#ifndef DISABLE_BATT
doc["bat"] = battery.getCharge();
doc["vol"] = battery.getVoltage();
#endif
doc["PAX"] = getPaxCount();
doc["dsl"] = sensors.getSensorName((SENSORS) sensors.getUARTDeviceTypeSelected());
String json;
Expand All @@ -58,52 +62,52 @@ void bleServerDataRefresh(){
}

void bleServerConfigRefresh(){
if (FAMILY == "ESP32-C3") return;
cfg.setWifiConnected(WiFi.isConnected()); // for notify on each write
pCharactConfig->setValue(cfg.getCurrentConfig().c_str());
// if (FAMILY == "ESP32-C3") return;
setWifiConnected(WiFi.isConnected()); // for notify on each write
pCharactConfig->setValue(getCurrentConfig().c_str());
}

// Config BLE callbacks
class MyConfigCallbacks : public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic* pCharacteristic) {
if (FAMILY == "ESP32-C3") return;
// if (FAMILY == "ESP32-C3") return;
std::string value = pCharacteristic->getValue();
if (value.length() > 0) {
if (cfg.save(value.c_str())) {
cfg.reload();
if (save(value.c_str())) {
reload();
gui.displayPreferenceSaveIcon();

gui.setWifiMode(cfg.isWifiEnable());
if (!cfg.isWifiEnable()) wifiStop();
gui.setWifiMode(isWifiEnable());
if (!isWifiEnable()) wifiStop();

if(sensors.sample_time != cfg.stime) {
sensors.setSampleTime(cfg.stime);
gui.setSampleTime(cfg.stime);
if(sensors.sample_time != stime) {
sensors.setSampleTime(stime);
gui.setSampleTime(stime);
}
if(sensors.toffset != cfg.toffset) sensors.setTempOffset(cfg.toffset);
if(sensors.devmode != cfg.devmode) sensors.setDebugMode(cfg.devmode);
if(sensors.toffset != toffset) sensors.setTempOffset(toffset);
if(sensors.devmode != devmode) sensors.setDebugMode(devmode);
}
else{
Serial.println("[E][BTLE][CONFIG] saving error!");
log_w("[W][BTLE][CONFIG] save return false with %s",value.c_str());
}
}
};

void onRead(BLECharacteristic* pCharacteristic) {
if (FAMILY == "ESP32-C3") return;
// if (FAMILY == "ESP32-C3") return;
bleServerConfigRefresh();
}
};

// Status BLE callbacks
class MyStatusCallbacks : public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic* pCharacteristic) {
if (FAMILY == "ESP32-C3") return;
// if (FAMILY == "ESP32-C3") return;
std::string value = pCharacteristic->getValue();
if (value.length() > 0 && cfg.getTrackStatusValues(value.c_str())) {
if (value.length() > 0 && getTrackStatusValues(value.c_str())) {
log_v("[E][BTLE][STATUS] "+String(value.c_str()));
gui.setTrackValues(cfg.track.spd,cfg.track.kms);
gui.setTrackTime(cfg.track.hrs,cfg.track.min,cfg.track.seg);
gui.setTrackValues(track.spd,track.kms);
gui.setTrackTime(track.hrs,track.min,track.seg);
}
else {
Serial.println("[E][BTLE][STATUS] write error!");
Expand Down Expand Up @@ -164,7 +168,7 @@ void bleServerInit() {
void bleLoop() {
static uint_fast64_t bleTimeStamp = 0;
// notify changed value
if (deviceConnected && (millis() - bleTimeStamp > cfg.stime * 1000)) { // each 5 secs
if (deviceConnected && (millis() - bleTimeStamp > stime * 1000)) { // each 5 secs
log_i("[BTLE] sending notification..");
log_d("[BTLE] %s",getNotificationData().c_str());
bleTimeStamp = millis();
Expand All @@ -189,3 +193,4 @@ void bleLoop() {
bool bleIsConnected(){
return deviceConnected;
}
#endif
Loading
Loading