49 lines
825 B
C++
49 lines
825 B
C++
//
|
|
// Created by kirillius on 09.04.2022.
|
|
//
|
|
|
|
#ifndef COOLER_CONTROLLER_SERVICEAPP_H
|
|
#define COOLER_CONTROLLER_SERVICEAPP_H
|
|
|
|
|
|
#include <usart/usart.h>
|
|
#include "FanController.h"
|
|
#include "Configuration.h"
|
|
#include "ComMessage.h"
|
|
|
|
class ServiceApp {
|
|
private:
|
|
static USART Serial;
|
|
static FanController Fan;
|
|
Configuration Config;
|
|
int8_t temp;
|
|
uint8_t level;
|
|
uint8_t comCounter;
|
|
|
|
|
|
void readConfig();
|
|
|
|
void writeConfig();
|
|
|
|
bool readMessage(Message *dest);
|
|
|
|
void sendMessage(Message *src);
|
|
|
|
void communicate();
|
|
|
|
void setFanPWM();
|
|
|
|
public:
|
|
ServiceApp();
|
|
|
|
void update();
|
|
|
|
static uint8_t lerp(uint8_t a, uint8_t b, uint8_t t);
|
|
static float clamp(float a, float min, float max);
|
|
static uint8_t min(uint8_t a, uint8_t b);
|
|
|
|
};
|
|
|
|
|
|
#endif //COOLER_CONTROLLER_SERVICEAPP_H
|