feat: integrate MCP and ES3C28P audio support with upstream compatibility updates
This commit is contained in:
@@ -27,6 +27,14 @@ struct McpSystemState {
|
||||
Device* i2sDevice = nullptr;
|
||||
volatile bool audioBusy = false;
|
||||
volatile bool audioRunning = false; // Used to abort play/record loop
|
||||
|
||||
// Video streaming state
|
||||
volatile bool streamRunning = false;
|
||||
void* streamTaskHandle = nullptr; // use void* to avoid freertos header inclusion dependency
|
||||
uint32_t framesDrawn = 0;
|
||||
uint32_t tcpBytesReceived = 0;
|
||||
uint32_t lastDrawMs = 0;
|
||||
double lastFps = 0.0;
|
||||
};
|
||||
|
||||
McpSystemState& getState();
|
||||
@@ -45,6 +53,22 @@ bool playWavMemory(const uint8_t* data, size_t size, int volume, std::string& er
|
||||
bool playMp3File(const std::string& filename, int volume, std::string& error);
|
||||
bool playMp3Memory(const uint8_t* data, size_t size, int volume, std::string& error);
|
||||
|
||||
bool getBatteryStatus(double& voltage_v, int& percentage_pct, std::string& error);
|
||||
bool setLedColor(int r, int g, int b, const std::string& mode, std::string& error);
|
||||
bool getSensors(double& temp_c, double& hum_pct, std::string& imu_json, std::string& error);
|
||||
bool scanBleDevices(int duration_ms, std::string& devices_json, std::string& error);
|
||||
bool writeSdFile(const std::string& filename, const std::string& content, std::string& error);
|
||||
bool readSdFile(const std::string& filename, std::string& content, std::string& error);
|
||||
bool downloadSdFile(const std::string& url, const std::string& filename, std::string& error);
|
||||
|
||||
bool startVideoStreamServer();
|
||||
void stopVideoStreamServer();
|
||||
bool getVideoStreamStats(std::string& stats_json);
|
||||
|
||||
bool listApps(std::string& apps_json, std::string& error);
|
||||
bool runApp(const std::string& appId, std::string& error);
|
||||
bool listSdFiles(const std::string& directory, std::string& files_json, std::string& error);
|
||||
|
||||
} // namespace tt::mcp
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@ typedef struct
|
||||
float mdct_overlap[2][9*32], qmf_state[15*2*32];
|
||||
int reserv, free_format_bytes;
|
||||
unsigned char header[4], reserv_buf[511];
|
||||
float scratch_padding[4100];
|
||||
} mp3dec_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -1715,7 +1716,8 @@ int mp3dec_decode_frame(mp3dec_t *dec, const uint8_t *mp3, int mp3_bytes, mp3d_s
|
||||
int i = 0, igr, frame_size = 0, success = 1;
|
||||
const uint8_t *hdr;
|
||||
bs_t bs_frame[1];
|
||||
mp3dec_scratch_t scratch;
|
||||
_Static_assert(sizeof(mp3dec_scratch_t) <= sizeof(dec->scratch_padding), "scratch_padding is too small");
|
||||
#define scratch (*(mp3dec_scratch_t*)dec->scratch_padding)
|
||||
|
||||
if (mp3_bytes > 4 && dec->header[0] == 0xff && hdr_compare(dec->header, mp3))
|
||||
{
|
||||
@@ -1802,7 +1804,9 @@ int mp3dec_decode_frame(mp3dec_t *dec, const uint8_t *mp3, int mp3_bytes, mp3d_s
|
||||
}
|
||||
#endif /* MINIMP3_ONLY_MP3 */
|
||||
}
|
||||
return success*hdr_frame_samples(dec->header);
|
||||
int result = success*hdr_frame_samples(dec->header);
|
||||
#undef scratch
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef MINIMP3_FLOAT_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user