Skip to content

Commit

Permalink
minor updates and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigorii Merkushev committed Sep 26, 2021
1 parent 457f6f9 commit 14bdd10
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 11 deletions.
3 changes: 2 additions & 1 deletion esp32/src/climate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ time in UTC
{
ClimateData data;

// Get temperature event and print its value.
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature))
Expand Down Expand Up @@ -196,6 +195,8 @@ time in UTC
telemetryData.climateConfig.nightTempToleranceWarm = NIGHT_TEMP_TOLERANCE_WARM;
telemetryData.climateConfig.nightTempToleranceCold = NIGHT_TEMP_TOLERANCE_COLD;

telemetryData.fullfilled = true;

return telemetryData;
}
}
4 changes: 3 additions & 1 deletion esp32/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define CONFIG

#define SENSORS_COUNT 2
#define TERRARIUM_ID 3
#define TERRARIUM_ID 1

#define VERSION "v2.0.1"

#endif
23 changes: 15 additions & 8 deletions esp32/src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ namespace Display
void render(DisplayData displayData)
{
// just do clear?
// clearRow(0);
// clearRow(1);
// clearRow(2);
// clearRow(3);
// clearRow(0);
// clearRow(1);
// clearRow(2);
// clearRow(3);

renderHarvestInfo(displayData.nextHarvestInSec);
renderClimate(displayData);
Expand All @@ -23,16 +23,23 @@ namespace Display
renderSubmissionInfo(displayData.submission);
}

void renderSubmissionInfo(bool submission)
{
void bootScreen(){
lcd.setCursor(0, 0);
lcd.print("version: ");
lcd.print(VERSION);
}

void renderSubmissionInfo(bool submission)
{
lcd.setCursor(9, 2);
lcd.print(" ");
lcd.print(" ");
if (submission){
if (submission)
{
lcd.setCursor(9, 2);
lcd.print("S");
}
}
}

void renderHarvestInfo(int secondsToNextHarvest)
{
Expand Down
2 changes: 1 addition & 1 deletion esp32/src/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ namespace Display
void clearRow(int row);
void render(DisplayData displayData);
void renderSubmissionInfo(bool submission);

void bootScreen();
}
#endif
4 changes: 4 additions & 0 deletions esp32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ void setup()
Serial.begin(115200);
Display::displaySetup();

Display::bootScreen();

//connect();
RealTime::setupRtcModule();

Expand All @@ -56,6 +58,8 @@ void setup()
NULL // Task handle
);

delay(1000);

}

void loop()
Expand Down
15 changes: 15 additions & 0 deletions esp32/src/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ namespace Telemetry
void send(TelemteryData telemteryData)
{

if (!telemteryData.fullfilled){
Serial.println("sample is not fullfilled yet.");
return;
}

if (telemteryData.hotSide.t == 0 || telemteryData.coldSide.t == 0){
Serial.println("sample is not fullfilled yet.");
return;
}

if (telemteryData.hotSide.h > 100 || telemteryData.hotCenter.h > 100 || telemteryData.coldCenter.h > 100 || telemteryData.coldSide.h > 100){
Serial.println("sample data has been corrupted (humidity > 100%).");
return;
}

Net::connect(false);

char telemetryEndpoint [200];
Expand Down
1 change: 1 addition & 0 deletions esp32/src/telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace Telemetry
ClimateConfig climateConfig;
bool heater;
HeaterPhase heaterPhase;
bool fullfilled;
};

void send(TelemteryData telemteryData);
Expand Down

0 comments on commit 14bdd10

Please sign in to comment.