This commit is contained in:
Tomasz Duda 2024-10-01 15:55:39 +02:00
parent 532fc5fd32
commit 727846b216

View file

@ -3,6 +3,20 @@
#include "esphome/core/log.h"
#include "USB.h"
extern "C" {
bool configured;
void tud_mount_cb(void){
configured = true;
}
void tud_umount_cb(void){
configured = false;
}
}
namespace esphome {
namespace usb_device {
@ -11,14 +25,14 @@ static const char *const TAG = "usb_device";
void UsbDevice::update() {
#ifdef USE_BINARY_SENSOR
if (configured_ != nullptr) {
bool configured = USB;
// bool configured = USB;
configured_->publish_state(configured);
}
#endif
}
void UsbDevice::dump_config() {
bool configured = USB;
// bool configured = USB;
ESP_LOGCONFIG(TAG, "USB device - configured: %s", YESNO(configured));
}