coffee/barista/overheat.h
2025-10-15 21:14:19 +02:00

33 lines
667 B
C

/* Copyright (c) 2025 Rodrigo Arias Mallo <rodarima@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef BARISTA_OVERHEAT_H
#define BARISTA_OVERHEAT_H
#ifdef __cplusplus
extern "C" {
#endif
#define OVH_NSAMPLES 20
#define OVH_INTERVAL 200 /* ms */
#define OVH_THRESHOLD 2.0 /* °C */
struct overheat {
unsigned long last_time;
float temp[OVH_NSAMPLES];
int next;
int n;
float delta;
};
void overheat_init(struct overheat *o);
void overheat_input(struct overheat *o, unsigned long t_ms, float temp);
float overheat_delta(struct overheat *o);
int overheat_panic(struct overheat *o);
#ifdef __cplusplus
}
#endif
#endif /* BARISTA_OVERHEAT_H */