Final cleanup for hoerman esp-idf ready! Compiles agian, works again. esp-idf might need some trickyness to get running.

This commit is contained in:
2025-09-30 00:40:21 +02:00
parent b8581dcf31
commit 31861e7785
4 changed files with 59 additions and 61 deletions

View File

@@ -2,10 +2,9 @@
#define __hciemulator_h
#ifdef USE_ESP_IDF
#include <cstdint>
#include <functional>
#include <algorithm>
#include "esp_idf.h"
//#include <cstdint>
//#include <functional>
//#include <algorithm>
#endif
#include "esphome/components/uart/uart.h"
@@ -95,7 +94,7 @@ public:
const SHCIState &getState()
{
if (micros() - m_recvTime > 2000000)
if (esphome::micros() - m_recvTime > 2000000)
{
// 2 sec without statusmessage
m_state.valid = false;
@@ -105,7 +104,7 @@ public:
unsigned long getMessageAge()
{
return micros() - m_recvTime;
return esphome::micros() - m_recvTime;
}
int getLogLevel();
@@ -118,6 +117,9 @@ protected:
void processDeviceStatusFrame();
void processDeviceBusScanFrame();
void processBroadcastStatusFrame();
//#ifdef USE_ESP_IDF
uint16_t word(uint8_t high, uint8_t low);
//#endif
private:
callback_function_t m_statusCallback;
@@ -135,30 +137,14 @@ private:
size_t m_rxlen;
size_t m_txlen;
unsigned char m_rxbuffer[255] = {
uint8_t m_rxbuffer[255] = {
0,
};
unsigned char m_txbuffer[255] = {
uint8_t m_txbuffer[255] = {
0,
};
bool m_skipFrame;
};
// Now, let's just define micros and millis and delay and delayMicros just so we know
#ifdef USE_ESP_IDF
unsigned long micros(){
return (unsigned long) esp_timer_get_time();
}
unsigned long millis(){
return (unsigned long) esp_timer_get_time() / 1000;
}
void delay(uint32 duration){
}
void delayMicroseconds(uint32 duration){
}
#endif
#endif