67 lines
1.6 KiB
C
Executable File
67 lines
1.6 KiB
C
Executable File
#ifndef EVSE_LIMITS_H
|
|
#define EVSE_LIMITS_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "evse_state.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// ========================
|
|
// Limit state control
|
|
// ========================
|
|
|
|
/**
|
|
* @brief Sets the 'limit reached' flag. Used internally when a session exceeds defined thresholds.
|
|
*/
|
|
void evse_set_limit_reached(bool value);
|
|
|
|
/**
|
|
* @brief Returns whether any session limit has been reached (energy, time or power).
|
|
*/
|
|
bool evse_get_limit_reached(void);
|
|
|
|
// ========================
|
|
// Limit checking
|
|
// ========================
|
|
|
|
/**
|
|
* @brief Evaluates if the session has exceeded any configured limits.
|
|
* Should be called periodically while in charging state.
|
|
*/
|
|
void evse_limits_check(void);
|
|
|
|
// ========================
|
|
// Runtime limit configuration
|
|
// ========================
|
|
|
|
uint32_t evse_get_consumption_limit(void);
|
|
void evse_set_consumption_limit(uint32_t value); // in Wh
|
|
|
|
uint32_t evse_get_charging_time_limit(void);
|
|
void evse_set_charging_time_limit(uint32_t value); // in seconds
|
|
|
|
uint16_t evse_get_under_power_limit(void);
|
|
void evse_set_under_power_limit(uint16_t value); // in Watts
|
|
|
|
// ========================
|
|
// Default (persistent) limits
|
|
// ========================
|
|
|
|
uint32_t evse_get_default_consumption_limit(void);
|
|
void evse_set_default_consumption_limit(uint32_t value);
|
|
|
|
uint32_t evse_get_default_charging_time_limit(void);
|
|
void evse_set_default_charging_time_limit(uint32_t value);
|
|
|
|
uint16_t evse_get_default_under_power_limit(void);
|
|
void evse_set_default_under_power_limit(uint16_t value);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // EVSE_LIMITS_H
|