mirror of
https://gitlab.com/Luci_/arduino-photometrics.git
synced 2026-04-03 11:35:37 +02:00
Implement EEPROM measure retrieval and add debug printing
This commit is contained in:
parent
acc92ccf6a
commit
9268d1ab11
29
lib/debug_config.h
Normal file
29
lib/debug_config.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef DEBUG_CONFIG_H
|
||||||
|
#define DEBUG_CONFIG_H
|
||||||
|
|
||||||
|
#define DEBUG
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define DLOG_INIT() Serial.begin(9600)
|
||||||
|
#define DLOG(msg) Serial.print(msg);
|
||||||
|
#define DLOGLN(msg) Serial.println(msg);
|
||||||
|
#define WARN_IF(cond, msg) if(cond) Serial.print(msg);
|
||||||
|
|
||||||
|
#define ASSERT(condition, msg) \
|
||||||
|
if (!(condition)) { \
|
||||||
|
Serial.print("!!! ASSERTION FAILED: "); \
|
||||||
|
Serial.print(msg); \
|
||||||
|
Serial.print(" [F:"); Serial.print(__FILE__); \
|
||||||
|
Serial.print(" L:"); Serial.print(__LINE__); \
|
||||||
|
Serial.println("]"); \
|
||||||
|
while (true); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define DLOG_INIT()
|
||||||
|
#define DLOG(msg)
|
||||||
|
#define DLOGLN(msg)
|
||||||
|
#define WARN_IF(cond, msg)
|
||||||
|
#define ASSERT(condition, msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DEBUG_CONFIG_H
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "photoresistance_ohm_retrieval.h"
|
#include "photoresistance_ohm_retrieval.h"
|
||||||
|
#include "debug_config.h"
|
||||||
|
|
||||||
|
|
||||||
SensorOhm::SensorOhm(uint8_t pin_analog_read, float vcc, int32_t rFixed, float current)
|
SensorOhm::SensorOhm(uint8_t pin_analog_read, float vcc, int32_t rFixed, float current)
|
||||||
: pin_analog_read(pin_analog_read), vcc(vcc), rFixed(rFixed), current(current) {
|
: pin_analog_read(pin_analog_read), vcc(vcc), rFixed(rFixed), current(current) {
|
||||||
if (vcc > mega2560_max_vcc){
|
if (vcc > mega2560_max_vcc){
|
||||||
Serial.println("FATAL: VCC too high !");
|
DLOGLN("FATAL: VCC too high !")
|
||||||
while (true); // bloque le programme
|
while (true);
|
||||||
}
|
}
|
||||||
if (current > mega2560_max_current){
|
if (current > mega2560_max_current){
|
||||||
Serial.println("FATAL: Intensity too high !");
|
DLOGLN("FATAL: Intensity too high !")
|
||||||
while (true);
|
while (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "sensormanager.h"
|
#include "sensormanager.h"
|
||||||
|
#include "debug_config.h"
|
||||||
|
|
||||||
|
|
||||||
SensorManager::SensorManager(){}
|
SensorManager::SensorManager(){}
|
||||||
|
|
@ -41,7 +42,7 @@ void SensorManager::setup(uint8_t nb_sensor, uint8_t *analog_in){
|
||||||
*/
|
*/
|
||||||
void SensorManager::get_resistances(int32_t* res_tab, uint8_t tab_lenght){
|
void SensorManager::get_resistances(int32_t* res_tab, uint8_t tab_lenght){
|
||||||
if (tab_lenght < nbPhotoSensor){
|
if (tab_lenght < nbPhotoSensor){
|
||||||
Serial.print("Error bad tab size");
|
DLOGLN("Error bad tab size")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +71,7 @@ void SensorManager::updateMinMax(uint8_t index, int32_t current_res) {
|
||||||
*/
|
*/
|
||||||
void SensorManager::get_min_max(int32_t* min_res_tab, int32_t* max_res_tab, uint8_t tab_lenght){
|
void SensorManager::get_min_max(int32_t* min_res_tab, int32_t* max_res_tab, uint8_t tab_lenght){
|
||||||
if (tab_lenght < nbPhotoSensor){
|
if (tab_lenght < nbPhotoSensor){
|
||||||
Serial.print("Error bad tab size");
|
DLOGLN("Error bad tab size")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "storage_interface.h"
|
#include "storage_interface.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
#include "debug_config.h"
|
||||||
|
|
||||||
|
|
||||||
// Manual implements of EEPROM.put() for few uint type
|
// Manual implements of EEPROM.put() for few uint type
|
||||||
|
|
@ -65,41 +66,6 @@ void Storage_interface::clear_eeprom_at(uint16_t idx){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacy function (don't finished and never tested)
|
|
||||||
/*
|
|
||||||
uint16_t get_nb_package_legacy(){
|
|
||||||
uint8_t flags, nb_photo_sensor, nb_temp_sensor, temp_size_t, photo_size_t, schedule, tmp, timestamp_size_t;
|
|
||||||
uint16_t nb_package = 0, nb_measure, start_package = 0, timestamp_sum_size, next_position;
|
|
||||||
bool timestamp;
|
|
||||||
flags = EEPROM.read(start_package);
|
|
||||||
|
|
||||||
while ((flags & 0b1) != 0){
|
|
||||||
nb_package++;
|
|
||||||
nb_photo_sensor = EEPROM.read(start_package + OFFSET_NB_PHOTO_SENSOR);
|
|
||||||
photo_size_t = EEPROM.read(start_package + OFFSET_PHOTO_MEASURES_SIZE);
|
|
||||||
|
|
||||||
nb_temp_sensor = EEPROM.read(start_package + OFFSET_NB_TEMP_SENSOR);
|
|
||||||
temp_size_t = EEPROM.read(start_package + OFFSET_TEMP_MEASURES_SIZE);
|
|
||||||
|
|
||||||
tmp = EEPROM.read(start_package + OFFSET_NB_TEMP_SENSOR); // read high byte
|
|
||||||
nb_measure = EEPROM.read(start_package + OFFSET_NB_TEMP_SENSOR + 1) | (tmp << 8); // read low byte
|
|
||||||
|
|
||||||
timestamp = false;
|
|
||||||
timestamp_size_t = EEPROM.read(start_package + OFFSET_timestamp_SIZE);
|
|
||||||
if ((flags & 0b001) != 0 ){
|
|
||||||
timestamp = true;
|
|
||||||
schedule = EEPROM.read(start_package + OFFSET_MEASURES_SCH);
|
|
||||||
timestamp_sum_size = (nb_measure/schedule) * timestamp_size_t;
|
|
||||||
}else if ((flags & 0b01) != 0){
|
|
||||||
timestamp = true;
|
|
||||||
timestamp_sum_size = nb_measure * timestamp_size_t;
|
|
||||||
}else{
|
|
||||||
timestamp_sum_size = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nb_package;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get_last_header_nbpackage
|
* @brief get_last_header_nbpackage
|
||||||
* *
|
* *
|
||||||
|
|
@ -136,8 +102,8 @@ void Storage_interface::get_store_struct(uint16_t offset, bool* timestamp, bool*
|
||||||
|
|
||||||
// Checking there if a struct is possibly at the index
|
// Checking there if a struct is possibly at the index
|
||||||
if ((flags & 0b1) == 0){
|
if ((flags & 0b1) == 0){
|
||||||
Serial.println("Missing struct index or bad index");
|
DLOGLN("Missing struct index or bad index")
|
||||||
return;
|
while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// timestamps reads
|
// timestamps reads
|
||||||
|
|
@ -149,8 +115,7 @@ void Storage_interface::get_store_struct(uint16_t offset, bool* timestamp, bool*
|
||||||
*timestamp_schedule = 0;
|
*timestamp_schedule = 0;
|
||||||
if (flags & 0b01){
|
if (flags & 0b01){
|
||||||
*timestamp = true;
|
*timestamp = true;
|
||||||
if (EEPROM.read(offset + OFFSET_MEASURES_SCH) != 0)
|
WARN_IF(EEPROM.read(offset + OFFSET_MEASURES_SCH) != 0, "Incoherent timestamp parameter in the header.")
|
||||||
Serial.println("Incoherent timestamp parameter in the header.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// photo res reads
|
// photo res reads
|
||||||
|
|
@ -184,8 +149,7 @@ void Storage_interface::set_store_struct(uint16_t offset, bool timestamp, bool i
|
||||||
if(timestamp_schedule != 0){
|
if(timestamp_schedule != 0){
|
||||||
flags = flags | 0b00100000;
|
flags = flags | 0b00100000;
|
||||||
EEPROM.write(offset + OFFSET_MEASURES_SCH, timestamp_schedule);
|
EEPROM.write(offset + OFFSET_MEASURES_SCH, timestamp_schedule);
|
||||||
if(!timestamp)
|
WARN_IF(!timestamp, "Bad timestamp parameter for header writer.")
|
||||||
Serial.println("Bad timestamp parameter for header writer.");
|
|
||||||
}else{
|
}else{
|
||||||
EEPROM.write(offset + OFFSET_MEASURES_SCH, 0);
|
EEPROM.write(offset + OFFSET_MEASURES_SCH, 0);
|
||||||
if (timestamp)
|
if (timestamp)
|
||||||
|
|
@ -198,8 +162,7 @@ void Storage_interface::set_store_struct(uint16_t offset, bool timestamp, bool i
|
||||||
EEPROM.write(offset + OFFSET_NB_PHOTO_SENSOR, nb_photo_sensor);
|
EEPROM.write(offset + OFFSET_NB_PHOTO_SENSOR, nb_photo_sensor);
|
||||||
}else{
|
}else{
|
||||||
EEPROM.write(offset + OFFSET_NB_PHOTO_SENSOR, 0);
|
EEPROM.write(offset + OFFSET_NB_PHOTO_SENSOR, 0);
|
||||||
if (nb_photo_sensor != 0)
|
WARN_IF(nb_photo_sensor != 0, "Bad photo sensor parameter for header writer.")
|
||||||
Serial.println("Bad photo sensor parameter for header writer.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (temp_sensor){
|
if (temp_sensor){
|
||||||
|
|
@ -207,8 +170,7 @@ void Storage_interface::set_store_struct(uint16_t offset, bool timestamp, bool i
|
||||||
EEPROM.write(offset + OFFSET_NB_TEMP_SENSOR, nb_temp_sensor);
|
EEPROM.write(offset + OFFSET_NB_TEMP_SENSOR, nb_temp_sensor);
|
||||||
}else{
|
}else{
|
||||||
EEPROM.write(offset + OFFSET_NB_TEMP_SENSOR, 0);
|
EEPROM.write(offset + OFFSET_NB_TEMP_SENSOR, 0);
|
||||||
if (nb_temp_sensor != 0)
|
WARN_IF(nb_temp_sensor != 0, "Bad temperature sensor parameter for header writer.")
|
||||||
Serial.println("Bad temperature sensor parameter for header writer.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Analyse if is_final_set just be remove from parameter
|
// TODO Analyse if is_final_set just be remove from parameter
|
||||||
|
|
@ -244,7 +206,7 @@ void Storage_interface::add_last_package(bool timestamp, bool is_final_set, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dont check if the stored measure structure match with the header
|
// Dont check if the stored measure structure match with the header
|
||||||
void Storage_interface::add_measure(uint8_t* photo_values, uint8_t* temp_values, uint32_t timestamp, uint8_t nb_photo, uint8_t nb_temp){
|
void Storage_interface::add_measure(uint8_t* array_photo_val, uint8_t* array_temp_val, uint32_t timestamp, uint8_t nb_photo, uint8_t nb_temp){
|
||||||
uint16_t p_last_header, free_space, idx;
|
uint16_t p_last_header, free_space, idx;
|
||||||
|
|
||||||
get_last_header_nbpackage(&p_last_header);
|
get_last_header_nbpackage(&p_last_header);
|
||||||
|
|
@ -253,11 +215,45 @@ void Storage_interface::add_measure(uint8_t* photo_values, uint8_t* temp_values,
|
||||||
EEPROM.write(p_last_header + OFFSET_NB_MEASURES, EEPROM.read(p_last_header + OFFSET_NB_MEASURES) + 1);
|
EEPROM.write(p_last_header + OFFSET_NB_MEASURES, EEPROM.read(p_last_header + OFFSET_NB_MEASURES) + 1);
|
||||||
|
|
||||||
EEPROM.put(free_space, timestamp);
|
EEPROM.put(free_space, timestamp);
|
||||||
idx = p_last_header + int32_size;
|
idx = p_last_header + sizeof(uint32_t);
|
||||||
for(int i = 0; i < nb_photo; i++, idx += int8_size){
|
for(int i = 0; i < nb_photo; i++, idx += sizeof(uint8_t)){
|
||||||
EEPROM.put(idx, photo_values[i]);
|
EEPROM.put(idx, array_photo_val[i]);
|
||||||
}
|
}
|
||||||
for(int i = 0; i < nb_temp; i++, idx += int8_size){
|
for(int i = 0; i < nb_temp; i++, idx += sizeof(uint8_t)){
|
||||||
EEPROM.put(idx, temp_values[i]);
|
EEPROM.put(idx, array_temp_val[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Storage_interface::get_measure(uint8_t* array_photo_val, uint8_t* array_temp_val, uint32_t* timestamp, uint8_t* nb_photo, uint8_t* nb_temp, uint16_t idx_measure){
|
||||||
|
uint16_t p_last_header, idx;
|
||||||
|
uint8_t flags;
|
||||||
|
|
||||||
|
get_last_header_nbpackage(&p_last_header);
|
||||||
|
idx = p_last_header + OFFSET_START_DATA_MEASURES;
|
||||||
|
|
||||||
|
*nb_photo = EEPROM.read(p_last_header + OFFSET_NB_PHOTO_SENSOR);
|
||||||
|
*nb_temp = EEPROM.read(p_last_header + OFFSET_NB_TEMP_SENSOR);
|
||||||
|
|
||||||
|
flags = EEPROM.read(p_last_header);
|
||||||
|
if((flags & 0b010) != 0){
|
||||||
|
EEPROM.get(p_last_header + OFFSET_START_DATA_MEASURES, timestamp);
|
||||||
|
idx += sizeof(uint32_t) * idx_measure;
|
||||||
|
}else if ((flags & 0b001) != 0){
|
||||||
|
uint8_t schedule;
|
||||||
|
schedule = EEPROM.read(p_last_header + OFFSET_MEASURES_SCH);
|
||||||
|
WARN_IF(schedule == 0, "Struct error for timestamp scheduling.")
|
||||||
|
|
||||||
|
if(idx_measure % schedule != 0)
|
||||||
|
idx += sizeof(uint32_t);
|
||||||
|
idx += sizeof(uint32_t) * (idx_measure / schedule);
|
||||||
|
}
|
||||||
|
|
||||||
|
idx += ((*nb_photo) + (*nb_temp)) * idx_measure * sizeof(uint8_t);
|
||||||
|
|
||||||
|
for(int i = 0; i < *nb_photo; i++, idx += sizeof(uint8_t)){
|
||||||
|
array_photo_val[i] = EEPROM.read(idx);
|
||||||
|
}
|
||||||
|
for(int i = 0; i < *nb_temp; i++, idx += sizeof(uint8_t)){
|
||||||
|
array_temp_val[i] = EEPROM.read(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,6 @@ class Storage_interface
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static constexpr uint8_t OFFSET_MEASURES_SCH = 1, OFFSET_NB_PHOTO_SENSOR = 2, OFFSET_NB_TEMP_SENSOR = 3, OFFSET_PHOTO_MEASURES_SIZE = 4, OFFSET_TEMP_MEASURES_SIZE = 5, OFFSET_NB_MEASURES = 6, OFFSET_NEXT_PACKAGE = 8, OFFSET_START_DATA_MEASURES = 10; // unit in byte
|
static constexpr uint8_t OFFSET_MEASURES_SCH = 1, OFFSET_NB_PHOTO_SENSOR = 2, OFFSET_NB_TEMP_SENSOR = 3, OFFSET_PHOTO_MEASURES_SIZE = 4, OFFSET_TEMP_MEASURES_SIZE = 5, OFFSET_NB_MEASURES = 6, OFFSET_NEXT_PACKAGE = 8, OFFSET_START_DATA_MEASURES = 10; // unit in byte
|
||||||
static constexpr uint8_t int32_size = sizeof(int32_t), int16_size = sizeof(int16_t), int8_size = sizeof(int8_t);
|
|
||||||
static constexpr uint16_t MEGA_2560_EEPROM_SIZE = 4096;
|
static constexpr uint16_t MEGA_2560_EEPROM_SIZE = 4096;
|
||||||
|
|
||||||
void clear_eeprom();
|
void clear_eeprom();
|
||||||
|
|
@ -23,11 +22,14 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Storage_interface();
|
||||||
|
~Storage_interface();
|
||||||
|
|
||||||
uint16_t get_nb_package();
|
uint16_t get_nb_package();
|
||||||
void add_last_package(bool timestamp, bool is_final_set, bool photo_sensor, bool temp_sensor, uint8_t timestamp_schedule, uint8_t nb_photo_sensor, uint8_t nb_temp_sensor, uint8_t photo_size, uint8_t temp_size, uint16_t nb_measures);
|
void add_last_package(bool timestamp, bool is_final_set, bool photo_sensor, bool temp_sensor, uint8_t timestamp_schedule, uint8_t nb_photo_sensor, uint8_t nb_temp_sensor, uint8_t photo_size, uint8_t temp_size, uint16_t nb_measures);
|
||||||
void add_measure(uint8_t* photo_values, uint8_t* temp_values, uint32_t timestamp, uint8_t nb_photo, uint8_t nb_temp);
|
void add_measure(uint8_t* photo_values, uint8_t* temp_values, uint32_t timestamp, uint8_t nb_photo, uint8_t nb_temp);
|
||||||
Storage_interface();
|
void get_measure(uint8_t* photo_values, uint8_t* temp_values, uint32_t* timestamp, uint8_t* nb_photo, uint8_t* nb_temp, uint16_t idx_measure);
|
||||||
~Storage_interface();
|
|
||||||
|
|
||||||
// Dont check if the stored measure structure match with the header
|
// Dont check if the stored measure structure match with the header
|
||||||
template< typename T, typename TT>
|
template< typename T, typename TT>
|
||||||
|
|
@ -40,7 +42,7 @@ public:
|
||||||
EEPROM.write(p_last_header + OFFSET_NB_MEASURES, EEPROM.read(p_last_header + OFFSET_NB_MEASURES) + 1);
|
EEPROM.write(p_last_header + OFFSET_NB_MEASURES, EEPROM.read(p_last_header + OFFSET_NB_MEASURES) + 1);
|
||||||
|
|
||||||
EEPROM.put(free_space, timestamp);
|
EEPROM.put(free_space, timestamp);
|
||||||
idx = p_last_header + int32_size;
|
idx = p_last_header + sizeof(uint32_t);
|
||||||
for(int i = 0; i < nb_photo; i++, idx += sizeof(T)){
|
for(int i = 0; i < nb_photo; i++, idx += sizeof(T)){
|
||||||
EEPROM.put(idx, photo_values[i]);
|
EEPROM.put(idx, photo_values[i]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ platform = atmelavr
|
||||||
board = megaADK
|
board = megaADK
|
||||||
framework = arduino
|
framework = arduino
|
||||||
test_framework = unity
|
test_framework = unity
|
||||||
build_flags = -std=gnu++17
|
build_flags =
|
||||||
|
-std=gnu++17
|
||||||
|
-I lib/
|
||||||
lib_deps =
|
lib_deps =
|
||||||
northernwidget/DS3231@^1.1.2
|
northernwidget/DS3231@^1.1.2
|
||||||
arduino-libraries/Ethernet
|
arduino-libraries/Ethernet
|
||||||
|
|
|
||||||
32
src/main.cpp
32
src/main.cpp
|
|
@ -22,31 +22,9 @@ Traitement tr;
|
||||||
RTClib myRTC;
|
RTClib myRTC;
|
||||||
DS3231 Clock;
|
DS3231 Clock;
|
||||||
|
|
||||||
// void setup() {
|
|
||||||
// Wire.begin();
|
|
||||||
// Serial.begin(9600);
|
|
||||||
// Serial.println("\nScanning I2C bus...");
|
|
||||||
|
|
||||||
// for (byte addr = 1; addr < 127; addr++) {
|
|
||||||
// Wire.beginTransmission(addr);
|
|
||||||
// if (Wire.endTransmission() == 0) {
|
|
||||||
// Serial.print("I2C device found at address 0x");
|
|
||||||
// Serial.println(addr, HEX);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Serial.println("Scan complete.");
|
|
||||||
// constexpr time_t tstmp {1660644000UL};
|
|
||||||
|
|
||||||
// Clock.setEpoch(tstmp, false);
|
|
||||||
// // set to 24h
|
|
||||||
// Clock.setClockMode(false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
//pinMode(ledPin, OUTPUT);
|
|
||||||
|
|
||||||
s_manager.setup(nbPhotoSensor, analogPin);
|
s_manager.setup(nbPhotoSensor, analogPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,11 +39,14 @@ void loop() {
|
||||||
epoch += 3600;
|
epoch += 3600;
|
||||||
}
|
}
|
||||||
Clock.setEpoch(epoch);
|
Clock.setEpoch(epoch);
|
||||||
|
#ifdef DEBUG
|
||||||
Serial.print("RTC mis à jour avec epoch: ");
|
Serial.print("RTC mis à jour avec epoch: ");
|
||||||
Serial.println(epoch);
|
Serial.println(epoch);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
while (Serial.available()) Serial.read(); // clean buffer
|
while (Serial.available()) Serial.read(); // clean buffer
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
@ -89,20 +70,23 @@ void loop() {
|
||||||
Serial.print(" - weekday ");
|
Serial.print(" - weekday ");
|
||||||
Serial.print(Clock.getDoW(), DEC);
|
Serial.print(Clock.getDoW(), DEC);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printDate(Clock, decTemp);
|
printDate(Clock, decTemp);
|
||||||
|
|
||||||
s_manager.print_current_res();
|
s_manager.print_current_res();
|
||||||
s_manager.print_min_max_res();
|
s_manager.print_min_max_res();
|
||||||
|
#endif
|
||||||
|
|
||||||
int32_t res_array[nbPhotoSensor]/*, min_array[nbPhotoSensor], max_array[nbPhotoSensor]*/;
|
int32_t res_array[nbPhotoSensor]/*, min_array[nbPhotoSensor], max_array[nbPhotoSensor]*/;
|
||||||
int16_t result[nbPhotoSensor];
|
int16_t result[nbPhotoSensor];
|
||||||
s_manager.get_resistances(res_array, nbPhotoSensor);
|
s_manager.get_resistances(res_array, nbPhotoSensor);
|
||||||
|
|
||||||
tr.map_r(min_res, max_res, res_array, result, nbPhotoSensor);
|
tr.map_r(min_res, max_res, res_array, result, nbPhotoSensor);
|
||||||
|
#ifdef DEBUG
|
||||||
print_named_tab(result, nbPhotoSensor, "int32_t normalised",(uint8_t) 18);
|
print_named_tab(result, nbPhotoSensor, "int32_t normalised",(uint8_t) 18);
|
||||||
|
#endif
|
||||||
|
|
||||||
delay(2000);
|
delay(2000);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue