remove file for clean repo, gitlab CI files removed; modify readme and main.cpp

This commit is contained in:
Aurélien Gauthier 2025-12-17 21:38:02 +01:00
parent e6cba1362f
commit e7ee13fda4
6 changed files with 44 additions and 67 deletions

View file

@ -1,34 +0,0 @@
# stages:
# - build
# - test
# variables:
# PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# PLATFORMIO_CACHE_DIR: "$CI_PROJECT_DIR/.cache/platformio"
# ARDUINO_ENV: "megaADK"
# cache:
# paths:
# - .cache/pip
# - .cache/platformio
# key: "$CI_COMMIT_REF_SLUG"
# pio_build:
# image: python:latest
# stage: build
# before_script:
# - pip install -U platformio
# script:
# - "pio run -e $ARDUINO_ENV"
# pio_test:
# image: python:latest
# stage: test
# before_script:
# - pip install -U platformio
# script:
# - pio test -e $ARDUINO_ENV --without-uploading

View file

@ -26,14 +26,27 @@ Verify that platformio has successfully opened the project.
Plug the arduino to your PC and check. Plug the arduino to your PC and check.
Run project tests graphically or with `pio test`. Run project tests graphically or with `pio test`.
Upload the project on the arduino. Upload the project on the arduino.
Check [RTC update](#rtc-update). Check [RTC update](#rtc-update).
Make a [Sensor calibration](#sensor-calibration).
Check that **serial_com** is well defined as false (boolean flag used to signal measurement or communication phases).
Connect your arduino near of a windows and let him take action. Connect your arduino near of a windows and let him take action.
After some time you can bring back the measure from the arduino to your PC. After some time you can bring back the measure from the arduino to your PC.
Collect data with [Gather](#gather-measures). Collect data with [Gather](#gather-measures).
### Sensor calibration
This part aim to optain the measurement range with the lower and the upper threashold of your sensor.
After the electrical mounting, place **print_min_max_res()** in the main loop function from the **SensorManager** object (compile and upload in the arduino).
Make a scale range by putting place photo sensors in the dark, for exemple with a box (darkest as possible).
Then illuminate photo sensors with the direct lightin sun or a lamp (prefere the brightess as possible).
Once the previous steps are done, write arduino min max serial printed data by print_min_max_res() into min_res and max_res for each sensor.
The soft will normalise your data for compresse them in uint_8 type (smaller information to store).
**TODO:** Improve this description parts
### RTC update ### RTC update
Before build the project, uncoment the `-D DEBUG` line in platform.ini. Before build the project, uncoment the `-D DEBUG` line in platform.ini.
Once build-upload done, check the output on the serial port. Set the [communcation phase](#set-communication-phase)
Once previous steps are done, check the output on the serial port.
If the date is wrong, execute the [update time](exec/time.py) file with `python3 time.py `. If the date is wrong, execute the [update time](exec/time.py) file with `python3 time.py `.
The code permit a schedule change (winter or summer padding). The code permit a schedule change (winter or summer padding).
@ -41,7 +54,26 @@ You can change the value in the [main file](main.cpp) or simply disable it.
### Gather measures ### Gather measures
After a measure time. After a measure time.
Connect the arduino to your PC, execute the [download](exec/download_csv.py) file with `python3 download_csv.py` to create a csv from collected data. Set the [communcation phase](#set-communication-phase)
Once the upload done, execute the [download](exec/download_csv.py) file with `python3 download_csv.py` to create a csv from collected data.
The download action remove whole arduino memory. The download action remove whole arduino memory.
### Set communication phase
Connect the arduino to your PC, set **serial_com** boolean to **True**, before uploading make you sure you don't upload when a writing datameasure phase to avoid corrupted data.
# Known limitations
## Data structure
- Issue: Storage structure work with **uint_8** measure type but not with other type (First template function doesn't compile and work properly).
## Nomadic system
- Improvement: Hardward and software are adapted to capture data with plugged into a standard electrical outlet, can be adapted for work with battery and power management.
## CI pipeline gitlab
- Issue: failed for now, need to find how the serial port of the vm communicate with the pipeline interface
## Calibration phase
- Improvement: Add an assisted phase to earn upper and lower threshold values to write in the code for the normalisation and storage.
[CI]: https://gitlab.com/Luci_/arduino-photometrics/badges/main/pipeline.svg [CI]: https://gitlab.com/Luci_/arduino-photometrics/badges/main/pipeline.svg

View file

@ -521,8 +521,7 @@ void Storage_interface::upload_csv(){
} }
Serial.println(close_transfert); Serial.println(close_transfert);
// TODO uncomment after upload csv done and must conform to the tests clear_eeprom();
// clear_eeprom();
} }

View file

@ -17,11 +17,8 @@ test_framework = unity
build_flags = build_flags =
-std=gnu++17 -std=gnu++17
-I lib/ -I lib/
-D DEBUG ; -D DEBUG
lib_deps = lib_deps =
northernwidget/DS3231@^1.1.2 northernwidget/DS3231@^1.1.2
rocketscream/Low-Power@^1.81 rocketscream/Low-Power@^1.81
; arduino-libraries/Ethernet lib_ldf_mode = deep+
; robtillaart/CRC
lib_ldf_mode = deep+
extra_scripts = pre:test_init.py

View file

@ -19,7 +19,7 @@ int32_t max_res [nbPhotoSensor] = {2062273, 5554006, 784809, 4755895, 1939035, 2
bool winter = true, timestamping = true, photo_sensor = true, temp_sensor = true, awake = true; bool winter = true, timestamping = true, photo_sensor = true, temp_sensor = true, awake = true;
// Communication flag, force the arduino to listen the serial port // Communication flag, force the arduino to listen the serial port
bool serial_com = true; bool serial_com = false;
// Deep sleep time based on northernwidget/DS3231 lib // Deep sleep time based on northernwidget/DS3231 lib
@ -47,9 +47,7 @@ void setup() {
#endif #endif
s_manager.setup(nbPhotoSensor, analogPin); s_manager.setup(nbPhotoSensor, analogPin);
// sto_intrf.clear_eeprom();
sto_intrf.add_last_package(timestamping, true, photo_sensor, temp_sensor, schedule, nbPhotoSensor, nbTempSensor, photo_sensor_size, temp_sensor_size); sto_intrf.add_last_package(timestamping, true, photo_sensor, temp_sensor, schedule, nbPhotoSensor, nbTempSensor, photo_sensor_size, temp_sensor_size);
// sto_intrf.clear_eeprom();
alarm_timer(); alarm_timer();
@ -71,9 +69,7 @@ void setup() {
pinMode(alarm_pin, INPUT_PULLUP); pinMode(alarm_pin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(alarm_pin), elapsed_time, FALLING); attachInterrupt(digitalPinToInterrupt(alarm_pin), elapsed_time, FALLING);
} }
#ifdef DEBUG
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
#endif
} }
void loop() { void loop() {
@ -87,8 +83,7 @@ void loop() {
state = ~state; state = ~state;
digitalWrite(LED_BUILTIN, state); digitalWrite(LED_BUILTIN, state);
while(Serial.available() || serial_com){ while(serial_com){
// sto_intrf.upload_csv();
if (Serial.available()) { if (Serial.available()) {
char commande = Serial.read(); char commande = Serial.read();
if (commande == 'T') { if (commande == 'T') {
@ -100,14 +95,14 @@ void loop() {
epoch += 3600; epoch += 3600;
} }
Clock.setEpoch(epoch); Clock.setEpoch(epoch);
#ifdef DEBUG #ifdef DEBUG
Serial.print("RTC mis à jour avec epoch: "); Serial.print("RTC mis à jour avec epoch: ");
Serial.println(epoch); Serial.println(epoch);
#endif #endif
} }
while (Serial.available()) Serial.read(); // clean buffer while (Serial.available()) Serial.read(); // clean buffer
#ifdef DEBUG #ifdef DEBUG
// Just for verification of DS3231 Data // Just for verification of DS3231 Data
// check now the data from ESP8266 and DS3231 // check now the data from ESP8266 and DS3231
// get year // get year
@ -131,7 +126,7 @@ void loop() {
Serial.print(" - weekday "); Serial.print(" - weekday ");
Serial.print(Clock.getDoW(), DEC); Serial.print(Clock.getDoW(), DEC);
Serial.println(); Serial.println();
#endif #endif
}else if (commande == 'D'){ }else if (commande == 'D'){
sto_intrf.upload_csv(); sto_intrf.upload_csv();
} }

View file

@ -1,12 +0,0 @@
# test_init.py
Import("env")
test_env_name = env["PIOENV"]
# Injecte manuellement les chemins d'inclusion nécessaires (Unity et votre config)
env.Append(
CPPPATH=[
"test",
".pio/libdeps/" + test_env_name + "/Unity/src"
]
)