plus modifications for SDS011
This commit is contained in:
parent
04850fd5c7
commit
c545136c06
@ -6,6 +6,12 @@
|
||||
static const char TAG[] = __FILE__;
|
||||
|
||||
#include "sdcard.h"
|
||||
#if (HAS_SDS011)
|
||||
#include <sds011read.h>
|
||||
// the results of the sensor:
|
||||
extern float pm25;
|
||||
extern float pm10;
|
||||
#endif
|
||||
|
||||
static bool useSDCard;
|
||||
|
||||
@ -35,7 +41,13 @@ void sdcardWriteData(uint16_t noWifi, uint16_t noBle) {
|
||||
sprintf(tempBuffer, "%02d:%02d:%02d,", hour(t), minute(t), second(t));
|
||||
fileSDCard.print(tempBuffer);
|
||||
sprintf(tempBuffer, "%d,%d", noWifi, noBle);
|
||||
fileSDCard.println(tempBuffer);
|
||||
fileSDCard.print( tempBuffer);
|
||||
#if (HAS_SDS011)
|
||||
ESP_LOGD(TAG, "fine-dust-values: %5.1f,%4.1f", pm10, pm25);
|
||||
sprintf(tempBuffer, ",%5.1f,%4.1f", pm10, pm25);
|
||||
fileSDCard.print( tempBuffer);
|
||||
#endif
|
||||
fileSDCard.println( );
|
||||
|
||||
if (++counterWrites > 2) {
|
||||
// force writing to SD-card
|
||||
@ -58,8 +70,12 @@ void createFile(void) {
|
||||
ESP_LOGD(TAG, "SD: file does not exist: opening");
|
||||
fileSDCard = SD.open(bufferFilename, FILE_WRITE);
|
||||
if (fileSDCard) {
|
||||
ESP_LOGD(TAG, "SD: name opended: <%s>", bufferFilename);
|
||||
fileSDCard.println(SDCARD_FILE_HEADER);
|
||||
ESP_LOGD(TAG, "SD: name opened: <%s>", bufferFilename);
|
||||
fileSDCard.print( SDCARD_FILE_HEADER );
|
||||
#if (HAS_SDS011)
|
||||
fileSDCard.print( SDCARD_FILE_HEADER_SDS011 );
|
||||
#endif
|
||||
fileSDCard.println();
|
||||
useSDCard = true;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user