You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
/**
|
|
* TODO file description
|
|
*/
|
|
|
|
#ifndef ZAVLAHA_APP_CONFIG_H
|
|
#define ZAVLAHA_APP_CONFIG_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#define CIRCUIT_COUNT 4
|
|
#define SCHEDULE_COUNT 4
|
|
#define MENU_AUTOEXIT_TIME_S 120
|
|
|
|
struct __attribute__((packed)) ScheduleTime {
|
|
bool enable; /// True if the schedule time is enabled
|
|
uint8_t h; /// Hour
|
|
uint8_t m; /// Minute
|
|
};
|
|
|
|
struct __attribute__((packed)) AppConfig {
|
|
uint8_t magic_version; /// Magic (byte reserved)
|
|
uint16_t circuit_base_time_s; /// Base time for each branch (scaled by percent)
|
|
uint16_t circuit_time_percent[CIRCUIT_COUNT]; /// Relative time of each branch 0% can be used to disable a branch
|
|
bool scheduler_enable; /// Enable automatic watering
|
|
struct ScheduleTime schedules[SCHEDULE_COUNT]; /// Scheduled times in a day
|
|
bool moisture_enable; /// Enable blocking watering by high soil humidity
|
|
uint16_t moisture_dry; /// Saved humidity value as 0%
|
|
uint16_t moisture_wet; /// Saved humidity value as 100%
|
|
uint8_t moisture_threshold_percent; /// % of soil humidity that deactivates watering
|
|
uint8_t magic2;
|
|
uint8_t scheduler_dry_days; /// Days to skip between watering
|
|
};
|
|
|
|
#define APPCONFIG_SIZE sizeof(struct AppConfig)
|
|
|
|
#define APPCONFIG_MAGIC1 0b11100001
|
|
#define APPCONFIG_MAGIC2 0b00111001
|
|
|
|
extern struct AppConfig app_config;
|
|
|
|
void appconfig_load();
|
|
|
|
void appconfig_save();
|
|
|
|
#endif //ZAVLAHA_APP_CONFIG_H
|
|
|