diff --git a/arduinoIDE_esp32_boards/boards.local.txt b/arduinoIDE_esp32_boards/boards.local.txt index 8b9fa28b45f16c094cf6fc89a471a8bc137fe0c2..58e812026b598b8056fb7e25e0cd94a868fb8c35 100644 --- a/arduinoIDE_esp32_boards/boards.local.txt +++ b/arduinoIDE_esp32_boards/boards.local.txt @@ -36,7 +36,9 @@ neOSensor.build.flash_mode=dio neOSensor.build.flash_size=4MB neOSensor.build.flash_freq=80m neOSensor.build.boot=dio -neOSensor.build.partitions=default +# [feb.24] disabling default to enable choices +#neOSensor.build.partitions=default + # onboard LED2 (except on ESP32 38pins we don't use) # DISABLE_SSL: flag to disable SSL comms. # DISABLE_ADC_CAL: flag to disable esp32 ADC advanced calibration @@ -56,6 +58,12 @@ neOSensor.menu.UploadSpeed.115200.upload.speed=115200 # FLASH partitioning neOSensor.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) neOSensor.menu.PartitionScheme.default.build.partitions=default +# [feb.24] additional FLASH partitioning options +neOSensor.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +neOSensor.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +neOSensor.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +neOSensor.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +neOSensor.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) # Core debug neOSensor.menu.DebugLevel.none=None diff --git a/neosensor/libraries/neocampus/neocampus_utils.cpp b/neosensor/libraries/neocampus/neocampus_utils.cpp index dec5753326df1aff2808a3345665265b3637c42f..92529efb0725d75faa56f9d3f043056e7b45c813 100644 --- a/neosensor/libraries/neocampus/neocampus_utils.cpp +++ b/neosensor/libraries/neocampus/neocampus_utils.cpp @@ -115,7 +115,7 @@ bool checkCLEARswitch( uint8_t sw_pin ) { //Manon // --- CALIBRATION switch management ------------------------------------------------ -/* check incr switch and decr switch for CALIBRATION procedure + /* check incr switch and decr switch for CALIBRATION procedure * if decr_sw_pin == -1 OR incr_sw_pin-->== -1 check disabled */ bool checkCALIBRATIONswitch(uint8_t decr_sw_pin, uint8_t incr_sw_pin) { @@ -147,10 +147,10 @@ bool checkCALIBRATIONswitch(uint8_t decr_sw_pin, uint8_t incr_sw_pin) { delay(500); // sleep for 500ms (allowing ESP to manage internals) } - /* okay, delay for + and - switch acquisition is now over. + /* okay, delay for + and - switch acquisition is now over. * If we need to calibrate things, we want to wait for sw_pin * LOW (i.e user stopped to press switch) - */ + */ if( _res==true ) { log_info(F("\n[CALIBRATION] activate CALIBRATION procedure ...")); log_debug(F("\n[CALIBRATION] release SWITCH for calibration to start ...")); @@ -162,7 +162,7 @@ bool checkCALIBRATIONswitch(uint8_t decr_sw_pin, uint8_t incr_sw_pin) { return _res; } -//Fin Manon + // ---------------------------------------------------------------------------- // --- WiFi setup ------------------------------------------------------------- diff --git a/neosensor/libraries/neocampus_drivers/SHT3x.cpp b/neosensor/libraries/neocampus_drivers/SHT3x.cpp index c0a16aeafbee624c02c9599fd0cbe7027efdf014..2f2fe6adaf59e73d5644f682259f99e71826b0ab 100644 --- a/neosensor/libraries/neocampus_drivers/SHT3x.cpp +++ b/neosensor/libraries/neocampus_drivers/SHT3x.cpp @@ -216,7 +216,6 @@ boolean SHT3x::acquire( float *pval ) log_debug(F("\n[SHT3x] corrected temperature for i2c=0x"));log_debug(_i2caddr,HEX);log_flush(); } #endif - return true; } @@ -284,7 +283,8 @@ boolean SHT3x::getTemp( float *pval ) // temp = (stemp * 175.0f) / 65535.0f - 45.0f; // 100.0 x _tmp = (17500 x _tmp) / (16384 x 4) - 4500 _tmp = ((4375 * _tmp) >> 14) - 4500; - *pval = (float)_tmp / 100.0f; + *pval = ((float)_tmp / 100.0f)-2.0; //Manon + log_debug(F("JE SUIS DANS SHT3x!"));log_flush(); return true; } @@ -310,7 +310,8 @@ void SHT3x::sw_reset( uint8_t adr ) { * multiple (useless) access for same things. */ bool SHT3x::_readSensor( uint16_t *pval ) { - + log_debug(F(millis()));log_flush(); + log_debug(F(_lastMsRead));log_flush(); // do we need to acquire fresh sensors values ? if( (millis() - _lastMsRead ) >= (unsigned long)(SHT3X_SENSOR_CACHE_MS) ) { @@ -374,7 +375,7 @@ bool SHT3x::_readSensor( uint16_t *pval ) { _lastMsRead = millis(); } else { - log_debug(F("\n[SHT3x] using cached value for ")); + log_debug(F("\n[SHT3x] using cache value for ")); if( _measureType == sht3xMeasureType_t::temperature ) { log_debug(F("TEMP sensor!")); } @@ -385,8 +386,14 @@ bool SHT3x::_readSensor( uint16_t *pval ) { } // send back pointer to proper value - if( _measureType == sht3xMeasureType_t::temperature ) *pval = _t_sensor; - else *pval = _rh_sensor; + if( _measureType == sht3xMeasureType_t::temperature ) { + *pval = ((float)(int32_t)_t_sensor / 100.0f)-2.0; + //manon + log_debug(F("COUCOU"));log_flush(); + + }else{ + *pval = _rh_sensor; + } return true; } diff --git a/neosensor/libraries/neocampus_drivers/generic_driver.cpp b/neosensor/libraries/neocampus_drivers/generic_driver.cpp index 3355926645edc36c4897866be0856c3331997e7a..39d2c9dc23611fb3ada24a221148010d15e59929 100644 --- a/neosensor/libraries/neocampus_drivers/generic_driver.cpp +++ b/neosensor/libraries/neocampus_drivers/generic_driver.cpp @@ -73,7 +73,7 @@ void generic_driver::powerOFF( void ) { * used for continuous integration for example * */ -void generic_driver::process( uint16_t coolDown, uint8_t decimals ) { +void generic_driver::process( uint16_t coolDown, uint8_t decimals ) { // same time ref for all unsigned long _curTime = millis(); @@ -85,7 +85,7 @@ void generic_driver::process( uint16_t coolDown, uint8_t decimals ) { float val; if( acquire(&val)==false ) return; // data was not ready _lastMsRead = _curTime; - + // round acquired value decimals = ( decimals > _MAX_DATA_DECIMALS ? _MAX_DATA_DECIMALS : decimals ); if( decimals==0 ) { @@ -152,7 +152,6 @@ bool generic_driver::getTrigger( void ) { * get official value that has gone through the whole integration process */ float generic_driver::getValue( uint8_t *idx ) { - // regular case or first value required if( !idx or *idx==0 ) return value; diff --git a/neosensor/libraries/neocampus_drivers/generic_driver.h b/neosensor/libraries/neocampus_drivers/generic_driver.h index 61d9d5df7aa6f25158539deb2b619b0ce76bc7b1..7cc3e62f64896c46c4b9401731b89db8a6f7f033 100644 --- a/neosensor/libraries/neocampus_drivers/generic_driver.h +++ b/neosensor/libraries/neocampus_drivers/generic_driver.h @@ -112,15 +112,12 @@ class generic_driver { float valueSent; // official value that has been sent unsigned long _lastMsSent; // (ms) time the official value has been sent - - //Manon - float a; // Calibration ax+b - //Manon - float b; // Calibration ax+b - //Manon - //float setA(enum_t typeModule); //je ne sais pas du tout si c'est juste ou pas //Manon + //float setA(enum_t typeModule); //float setB(enum_t typeModule); + //Manon + float _a = 1.0; // Calibration ax+b + float _b = -2.0; // Calibration ax+b }; #endif /* _GENERIC_DRIVER_H_ */ diff --git a/neosensor/libraries/neocampus_modules/airquality.cpp b/neosensor/libraries/neocampus_modules/airquality.cpp index ab2c2671ee708017340d5a1da2448cf367f2abc5..a2b505c0fa5e3eae9c2ebdec6f4071538a0c587f 100644 --- a/neosensor/libraries/neocampus_modules/airquality.cpp +++ b/neosensor/libraries/neocampus_modules/airquality.cpp @@ -30,6 +30,9 @@ #include "airquality.h" +//Manon +//#include "neocampus_utils.h" + /* * Definitons @@ -448,15 +451,17 @@ void airquality::_process_sensors( void ) { * Check for +/- switch status: * if both active then calibrate the current sensor */ + #if 0 #ifdef DECR_SW #ifdef INCR_SW - if( checkCALIBRATIONswitch(DECR_SW, INCR_SW) == true ) { + //if( checkCALIBRATIONswitch(DECR_SW, INCR_SW) == true ) { // CALIBRATION of the sensor - log_debug(F("[Calibration] Deviation value ="));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); - } + //log_debug(F("[airquality][Calibration] Deviation value = "));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); + //} #endif #endif - //Fin Manon + #endif + /* * update shared JSON with ALL sensors that may have changed ! @@ -634,13 +639,13 @@ boolean airquality::_loadConfig( JsonObject root ) { //Manon /* ------------------------------------------------------------------------------ * Protected methods - */ -/* + * + * * Update the value of a and b of the sensor */ float airquality::calibrate(uint8_t _sensor) { - /* not implemented yet */ - std::cout << "[Calibration] AirQuality sensor detected" << std::endl; + // not implemented yet + log_debug(F("[airquality][Calibration] method calibrate : AirQuality sensor detected")); return 0; } diff --git a/neosensor/libraries/neocampus_modules/airquality.h b/neosensor/libraries/neocampus_modules/airquality.h index ae061dabc86602f9cc692496442cfd848822b30d..5077b9d6ed0febe17d984b5f0e9ee7d069befe58 100644 --- a/neosensor/libraries/neocampus_modules/airquality.h +++ b/neosensor/libraries/neocampus_modules/airquality.h @@ -27,8 +27,6 @@ #include "pm_serial.h" // particule meters with serial link: includes PMSx003, SDS011, sensirion SPS30 ... #include "SCD4x.h" // Sensirion SCD4X CO2 sensor including temp + hygro - - /* * Definitions */ @@ -85,18 +83,13 @@ class airquality : public base { void _process_sensors( void ); // sensors internal processing (optional) void _constructor( void ); // low-level constructor - //Manon - /* - * private attributes - */ - typeModule typeM = AIRQUALITY ; - + //Manon protected: - //Manon /* * protected methods */ float calibrate(uint8_t _sensor); + }; diff --git a/neosensor/libraries/neocampus_modules/base.h b/neosensor/libraries/neocampus_modules/base.h index 611bcee77d5de94b8ca8c215e665e7c90734b210..27417fb4a3a5697f1dbcb86e6d77778f4866180c 100644 --- a/neosensor/libraries/neocampus_modules/base.h +++ b/neosensor/libraries/neocampus_modules/base.h @@ -34,9 +34,6 @@ #include "PubSubClient.h" // MQTT client with some definitions from neocampus.h #include "sensocampus.h" -//Manon -#include "typeModule.cpp" -#include "generic_driver.h" /* * Global, shared stuffs @@ -119,13 +116,7 @@ class base { senso *_sensoClient; WiFiClient _wifiClient; PubSubClient mqttClient; - - //Manon - protected: - /* - * protected attributes - */ - typeModule typeM; + }; diff --git a/neosensor/libraries/neocampus_modules/humidity.cpp b/neosensor/libraries/neocampus_modules/humidity.cpp index 870b4702beb17a32d41bd88e1a4994e9d60ddbc5..618a5e9765e9c42e341a05c1b3547bbfbbf0dfc1 100644 --- a/neosensor/libraries/neocampus_modules/humidity.cpp +++ b/neosensor/libraries/neocampus_modules/humidity.cpp @@ -29,6 +29,8 @@ #include "humidity.h" +//Manon +//#include "neocampus_utils.h" /* * Definitions @@ -313,15 +315,18 @@ void humidity::_process_sensors( void ) { * Check for +/- switch status: * if both active then calibrate the current sensor */ - //#ifdef DECR_SW - // #ifdef INCR_SW - // if( checkCALIBRATIONswitch(DECR_SW, INCR_SW) == true ) { - // // CALIBRATION of the sensor - // log_debug(F("[Calibration] Deviation value ="));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); - // } - // #endif - //#endif - //Fin Manon + #if 0 + #ifdef DECR_SW + #ifdef INCR_SW + log_debug(F("\n[humidity][calibration] TEST :)")); log_flush(); + //if( checkCALIBRATIONswitch(DECR_SW, INCR_SW) == true ) { + // CALIBRATION of the sensor + //log_debug(F("[airquality][Calibration] Deviation value = "));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); + //} + #endif + #endif + #endif + // new data ready to get sent ==> activate module's trigger log_debug(F("\n[humidity][")); log_debug(_sensor[cur_sensor]->subID()); @@ -516,12 +521,12 @@ bool humidity::saveConfig( void ) { //Manon /* ------------------------------------------------------------------------------ * Protected methods - */ -/* + * + * * Update the value of a and b of the sensor */ float humidity::calibrate(uint8_t _sensor) { - /* not implemented yet */ - std::cout << "[Calibration] Humidity sensor detected" << std::endl; + // not implemented yet + log_debug(F("[humidity][Calibration] method calibrate : Humidity sensor detected")); return 0; -} \ No newline at end of file +} diff --git a/neosensor/libraries/neocampus_modules/humidity.h b/neosensor/libraries/neocampus_modules/humidity.h index e75d516c0f21525f44b9126de01e05c6a5a1f27c..4ff750f5d1add4b87f636397201a791eac4f139e 100644 --- a/neosensor/libraries/neocampus_modules/humidity.h +++ b/neosensor/libraries/neocampus_modules/humidity.h @@ -87,17 +87,13 @@ class humidity : public base { void _process_sensors( void ); // sensors internal processing (optional) void _constructor( void ); // low-level constructor - //Manon - /* - * private attributes - */ - typeModule typeM = HUMIDITY; + //Manon protected: - //Manon /* * protected methods */ float calibrate(uint8_t _sensor); + }; diff --git a/neosensor/libraries/neocampus_modules/luminosity.cpp b/neosensor/libraries/neocampus_modules/luminosity.cpp index 5f1158f52e421f1f3cf61ed7a444e47abd0de04a..202d247d727e76909dc5588bd98360760a801b44 100644 --- a/neosensor/libraries/neocampus_modules/luminosity.cpp +++ b/neosensor/libraries/neocampus_modules/luminosity.cpp @@ -30,6 +30,8 @@ #include "luminosity.h" +//Manon +//#include "neocampus_utils.h" /* * Definitons @@ -292,20 +294,23 @@ void luminosity::_process_sensors( void ) { _sensor[cur_sensor]->process( _freq ); if( _sensor[cur_sensor]->getTrigger()!=true ) continue; -//Manon + //Manon /* * Check for +/- switch status: * if both active then calibrate the current sensor */ + #if 0 #ifdef DECR_SW #ifdef INCR_SW - if( checkCALIBRATIONswitch(DECR_SW, INCR_SW) == true ) { + log_debug(F("\n[luminosity][calibration] TEST :)")); log_flush(); + //if( checkCALIBRATIONswitch(DECR_SW, INCR_SW) == true ) { // CALIBRATION of the sensor - log_debug(F("[Calibration] Deviation value luminosity="));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); - } + //log_debug(F("[airquality][Calibration] Deviation value luminosity= "));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); + //} #endif #endif - //Fin Manon + #endif + // new data ready to get sent ==> activate module's trigger log_debug(F("\n[luminosity][")); log_debug(_sensor[cur_sensor]->subID()); @@ -501,12 +506,12 @@ bool luminosity::saveConfig( void ) { //Manon /* ------------------------------------------------------------------------------ * Protected methods - */ -/* + * + * * Update the value of a and b of the sensor */ float luminosity::calibrate(uint8_t _sensor) { - /* not implemented yet */ - std::cout << "[Calibration] Luminosity sensor detected" << std::endl; + // not implemented yet + log_debug(F("[luminosity][Calibration] method calibrate : Luminosity sensor detected")); return 0; } \ No newline at end of file diff --git a/neosensor/libraries/neocampus_modules/luminosity.h b/neosensor/libraries/neocampus_modules/luminosity.h index b72be91f09f3dc347fe4f89257ed47311f15eb77..b75f0f2b730e89eddac8175b14553be1ff3a2a71 100644 --- a/neosensor/libraries/neocampus_modules/luminosity.h +++ b/neosensor/libraries/neocampus_modules/luminosity.h @@ -90,18 +90,12 @@ class luminosity : public base { void _process_sensors( void ); // sensors internal processing (optional) void _constructor( void ); // low-level constructor - //Manon - /* - * private attributes - */ - typeModule typeM = LUMINOSITY; + //Manon protected: - //Manon /* * protected methods */ float calibrate(uint8_t _sensor); - }; diff --git a/neosensor/libraries/neocampus_modules/temperature.cpp b/neosensor/libraries/neocampus_modules/temperature.cpp index 2e1743fb29d9a217d6b629779bd0deccbd9a3b86..08d586572eafabf618015a4c4f2db52ddc3a9510 100644 --- a/neosensor/libraries/neocampus_modules/temperature.cpp +++ b/neosensor/libraries/neocampus_modules/temperature.cpp @@ -34,6 +34,8 @@ #include "temperature.h" +//Manon +//#include "neocampus_utils.h" /* * Definitions @@ -334,16 +336,19 @@ void temperature::_process_sensors( void ) { * Check for +/- switch status: * if both active then calibrate the current sensor */ + #if 0 #ifdef DECR_SW #ifdef INCR_SW - log_debug(F("\n[temperature][calibration] L'appui simultanné sur les deux boutons +/- fonctionne :)")); log_flush(); + log_debug(F("\n[temperature][calibration] TEST :)")); log_flush(); //if( checkCALIBRATIONswitch(DECR_SW, INCR_SW) == true ) { + //log_debug(F("\n[temperature][calibration] L'appui simultanné sur les deux boutons +/- fonctionne :)")); log_flush(); // CALIBRATION of the sensor - // log_debug(F("\n[Calibration] Deviation value ="));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); + //log_debug(F("\n[Calibration] Deviation value ="));log_debug(calibrate(cur_sensor),FLOAT_RESOLUTION); log_flush(); //} #endif #endif - //Fin Manon + #endif + // new data ready to get sent ==> activate module's trigger log_debug(F("\n[temperature][")); log_debug(_sensor[cur_sensor]->subID()); @@ -540,12 +545,12 @@ bool temperature::saveConfig( void ) { //Manon /* ------------------------------------------------------------------------------ * Protected methods - */ -/* + * + * * Update the value of a and b of the sensor */ float temperature::calibrate(uint8_t _sensor) { - /* not implemented yet */ - std::cout << "[Calibration] Temperature sensor detected" << std::endl; + // not implemented yet + log_debug(F("[temperature][Calibration] method calibrate : Temperature sensor detected")); return 0; -} \ No newline at end of file +} diff --git a/neosensor/libraries/neocampus_modules/temperature.h b/neosensor/libraries/neocampus_modules/temperature.h index d26d59f4329079cb179ad983434492353eeaf66e..52e1b0c4eef9208fafb2b7ae6f9e77110c5c1626 100644 --- a/neosensor/libraries/neocampus_modules/temperature.h +++ b/neosensor/libraries/neocampus_modules/temperature.h @@ -91,13 +91,8 @@ class temperature : public base { void _process_sensors( void ); // sensors internal processing (optional) void _constructor( void ); // low-level constructor - //Manon - /* - * private attributes - */ - typeModule typeM = TEMPERATURE; + //Manon protected: - //Manon /* * protected methods */ diff --git a/neosensor/libraries/neocampus_modules/typeModule.cpp b/neosensor/libraries/neocampus_modules/typeModule.cpp index 28ea1dc3c9ada6b74c0623dec44436c36ef59513..088e997aa00ef95687f9a83ef82c71ecd4ca6f95 100644 --- a/neosensor/libraries/neocampus_modules/typeModule.cpp +++ b/neosensor/libraries/neocampus_modules/typeModule.cpp @@ -1,8 +1,7 @@ -#include <iostream> //Manon enum typeModule { TEMPERATURE, HUMIDITY, AIRQUALITY, LUMINOSITY -}; \ No newline at end of file +}; diff --git a/tests/CalibrationSensor/CalibrationSensor.ino b/tests/CalibrationSensor/CalibrationSensor.ino index 02f36b52218019279e73c5d7624c48e069f845b8..f0eedce86f1487aec77a4314d8d0288c2641f04e 100644 --- a/tests/CalibrationSensor/CalibrationSensor.ino +++ b/tests/CalibrationSensor/CalibrationSensor.ino @@ -1,4 +1,4 @@ - +#if 0 /* * CalibrationSensor * @@ -125,3 +125,4 @@ void loop() {} +#end \ No newline at end of file