Merge branch 'development' into main
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
#include <LightDependentResistor.h>
|
||||
#include <MenuManager.h>
|
||||
|
||||
#define SOUND_OFF false
|
||||
|
||||
#ifdef ULANZI
|
||||
// Pinouts für das ULANZI-Environment
|
||||
#define BATTERY_PIN 34
|
||||
@@ -53,6 +51,7 @@ unsigned long previousMillis_LDR = 0;
|
||||
const unsigned long interval_BatTempHum = 10000;
|
||||
const unsigned long interval_LDR = 100;
|
||||
int total = 0;
|
||||
unsigned long startTime;
|
||||
|
||||
const int LDRReadings = 10;
|
||||
int TotalLDRReadings[LDRReadings];
|
||||
@@ -108,13 +107,21 @@ void select_button_tripple()
|
||||
|
||||
void PeripheryManager_::playBootSound()
|
||||
{
|
||||
if (SOUND_OFF)
|
||||
if (!SOUND_ACTIVE)
|
||||
return;
|
||||
const int nNotes = 6;
|
||||
String notes[nNotes] = {"E5", "C5", "G4", "E4", "G4", "C5"};
|
||||
const int timeUnit = 150;
|
||||
Melody melody = MelodyFactory.load("Nice Melody", timeUnit, notes, nNotes);
|
||||
player.playAsync(melody);
|
||||
if (BOOT_SOUND == "")
|
||||
{
|
||||
const int nNotes = 6;
|
||||
String notes[nNotes] = {"E5", "C5", "G4", "E4", "G4", "C5"};
|
||||
const int timeUnit = 150;
|
||||
Melody melody = MelodyFactory.load("Bootsound", timeUnit, notes, nNotes);
|
||||
player.playAsync(melody);
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
playFromFile("/MELODIES/" + BOOT_SOUND + ".txt");
|
||||
}
|
||||
}
|
||||
|
||||
void PeripheryManager_::stopSound()
|
||||
@@ -124,7 +131,7 @@ void PeripheryManager_::stopSound()
|
||||
|
||||
void PeripheryManager_::playFromFile(String file)
|
||||
{
|
||||
if (SOUND_OFF)
|
||||
if (!SOUND_ACTIVE)
|
||||
return;
|
||||
Melody melody = MelodyFactory.loadRtttlFile(file);
|
||||
player.playAsync(melody);
|
||||
@@ -156,6 +163,7 @@ void fistStart()
|
||||
|
||||
void PeripheryManager_::setup()
|
||||
{
|
||||
startTime = millis();
|
||||
pinMode(LDR_PIN, INPUT);
|
||||
pinMode(BUZZER_PIN, OUTPUT);
|
||||
digitalWrite(BUZZER_PIN, LOW);
|
||||
@@ -291,3 +299,20 @@ void PeripheryManager_::checkAlarms()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *PeripheryManager_::readUptime()
|
||||
{
|
||||
static char uptime[25]; // Make the array static to keep it from being destroyed when the function returns
|
||||
unsigned long currentTime = millis();
|
||||
unsigned long elapsedTime = currentTime - startTime;
|
||||
unsigned long uptimeSeconds = elapsedTime / 1000;
|
||||
unsigned long uptimeMinutes = uptimeSeconds / 60;
|
||||
unsigned long uptimeHours = uptimeMinutes / 60;
|
||||
unsigned long uptimeDays = uptimeHours / 24;
|
||||
unsigned long hours = uptimeHours % 24;
|
||||
unsigned long minutes = uptimeMinutes % 60;
|
||||
unsigned long seconds = uptimeSeconds % 60;
|
||||
sprintf(uptime, "P%dDT%dH%dM%dS", uptimeDays, hours, minutes, seconds);
|
||||
return uptime;
|
||||
}
|
||||
Reference in New Issue
Block a user