#pragma once #include #include #include #define SD_CS 4 extern uint16_t SDCard_Size; bool SD_Init(); /** * True only after the last SD_Init() completed successfully (SD.begin + valid cardType). * Use this to gate capture — do NOT rely on SD.cardType() alone after WiFi on ESP32-C6: * with LCD+SD sharing SPI, cardType() can spuriously read CARD_NONE and falsely show "insert SD". */ bool SD_IsReady(); bool SD_WriteFileAtomic(const char* path, const uint8_t* data, size_t len);