This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
machines-backup/extrusion/lydia-print-head-v1/firmware/firmware/addons/EnclosureSensor.h

44 lines
1.0 KiB
C++

#ifndef ENCLOSURE_SENSOR_H
#define ENCLOSURE_SENSOR_H
#include "../config.h"
#include "../Addon.h"
#include <Streaming.h>
#include "../macros.h"
#include "../components/Proximity_Sensor.h"
class EnclosureSensor : public Addon
{
public:
ProximitySensor sensor1;
ProximitySensor sensor2;
EnclosureSensor() : sensor1(ENCLOSURE_SENSOR_PIN_1),
sensor2(ENCLOSURE_SENSOR_PIN_2),
Addon(ENCLOSURE_SENSOR_STR, ENCLOSURE_SENSOR) {}
void debug(Stream *stream)
{
//*stream << this->name << ":"
// << SPACE(sensor1.value) << ":" << SPACE(sensor2.value) << " | ok : " << ok();
}
void info(Stream *stream)
{
//*stream << this->name << SPACE("\n\t : " << ENCLOSURE_SENSOR_PIN_1) << SPACE(" : " << ENCLOSURE_SENSOR_PIN_2);
}
short setup()
{
sensor1.setup();
sensor2.setup();
sensor1.loop();
sensor2.loop();
}
short loop()
{
sensor1.loop();
sensor2.loop();
}
short ok() { return sensor1.value == 1 && sensor2.value == 1; }
};
#endif