|
|
@@ -53,7 +53,8 @@ const int power_Temp_sensor = 34, power_Windfahne = 36, LED_Fail = 24, R_Temp_fi |
|
|
|
LED_Write = 5, LED_Normal = 6, LED_Batterie = 7, Grenz_U_Batterie = 13, |
|
|
|
taster_manuell_speichern = 28, Windfahne = 20, T_sensor_input = 17, Batterie_input = 38; |
|
|
|
|
|
|
|
int last_second, last_minute, last_hour, seconds_for_blink; |
|
|
|
int last_second, last_minute, last_hour; |
|
|
|
|
|
|
|
|
|
|
|
time_t getTeensy3Time() { |
|
|
|
return Teensy3Clock.get(); |
|
|
@@ -85,6 +86,8 @@ public: |
|
|
|
summ = 0; |
|
|
|
square_summ = 0; |
|
|
|
cubic_summ = 0; |
|
|
|
speed_min = speed_per_second[0]; |
|
|
|
speed_max = speed_per_second[0]; |
|
|
|
|
|
|
|
for (int i = 0; i < amount_saved; i++) { |
|
|
|
summ = summ + pow((speed_per_second[i] - arithmetic_mean), 2); |
|
|
@@ -248,9 +251,9 @@ void dateTime(uint16_t* date, uint16_t* time, uint8_t* ms10) { |
|
|
|
*ms10 = second() & 1 ? 100 : 0; |
|
|
|
} |
|
|
|
|
|
|
|
void write_sd() { |
|
|
|
void write_sd(int new_file) { |
|
|
|
digitalWrite(LED_Write, HIGH); |
|
|
|
char file_name[50]; |
|
|
|
static char file_name[50]; |
|
|
|
|
|
|
|
short int jahr = year(); |
|
|
|
short int monat = month(); |
|
|
@@ -258,7 +261,9 @@ void write_sd() { |
|
|
|
short int stunde = hour(); |
|
|
|
short int minut = minute(); |
|
|
|
FsDateTime::setCallback(dateTime); |
|
|
|
sprintf(file_name, "Windmessmast-%d.%d.%d_%d-%d.txt", jahr, monat, tag, stunde, minut); |
|
|
|
if (new_file == 1) { |
|
|
|
sprintf(file_name, "Windmessmast-%d.%d.%d_%d-%d.txt", jahr, monat, tag, stunde, minut); |
|
|
|
} |
|
|
|
sd.begin(SD_CONFIG); |
|
|
|
if (!file.open(file_name, FILE_WRITE)) { |
|
|
|
digitalWrite(LED_Fail, HIGH); |
|
|
@@ -289,13 +294,15 @@ void write_sd() { |
|
|
|
|
|
|
|
void every_second() { |
|
|
|
|
|
|
|
static int seconds_for_blink; |
|
|
|
|
|
|
|
anemometer_1.save_wind_speed(); |
|
|
|
anemometer_2.save_wind_speed(); |
|
|
|
anemometer_3.save_wind_speed(); |
|
|
|
wind_vain_1.measure(); |
|
|
|
|
|
|
|
if (digitalRead(taster_manuell_speichern) == HIGH){ |
|
|
|
write_sd(); |
|
|
|
write_sd(1); |
|
|
|
} |
|
|
|
|
|
|
|
digitalWrite(LED_Normal, LOW); |
|
|
@@ -323,8 +330,16 @@ void every_minute() { |
|
|
|
} |
|
|
|
|
|
|
|
void every_hour() { |
|
|
|
|
|
|
|
static int first_time = 1; |
|
|
|
|
|
|
|
write_sd(); |
|
|
|
if (hour() == 0 || first_time == 1) { |
|
|
|
write_sd(1); |
|
|
|
first_time = 0; |
|
|
|
} |
|
|
|
else { |
|
|
|
write_sd(0); |
|
|
|
} |
|
|
|
last_hour = hour(); |
|
|
|
} |
|
|
|
|