Increase the timeout time of LLM setup. Update arduino lib version.

This commit is contained in:
LittleMouse
2025-01-09 15:46:46 +08:00
parent 6679384e76
commit 31cdca83ea
3 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name=M5ModuleLLM
version=1.0.0
version=1.4.0
author=M5Stack
maintainer=M5Stack
sentence=M5ModuleLLM is a library for M5ModuleLLM
+1 -1
View File
@@ -47,7 +47,7 @@ String ApiLlm::setup(ApiLlmSetupConfig_t config, String request_id)
// Copy work id
llm_work_id = msg.work_id;
},
20000);
30000);
return llm_work_id;
}
+11 -2
View File
@@ -7,6 +7,8 @@
#include <ArduinoJson.h>
using namespace m5_module_llm;
const size_t JSON_BUFFER_SIZE = 2048;
char jsonBuffer[JSON_BUFFER_SIZE];
bool ModuleComm::init(Stream* serialPort)
{
@@ -34,6 +36,7 @@ void ModuleComm::sendRaw(const uint8_t* data, size_t& raw_len)
ModuleComm::Respond_t ModuleComm::getResponse(uint32_t timeout)
{
Respond_t ret;
String buffer;
uint32_t time_out_count = millis();
bool get_msg = false;
@@ -43,7 +46,13 @@ ModuleComm::Respond_t ModuleComm::getResponse(uint32_t timeout)
if (_serial->available()) {
get_msg = true;
while (_serial->available()) {
ret.msg += (char)_serial->read();
char c = (char)_serial->read();
buffer += c;
if (c == '\n') {
ret.msg = buffer;
return ret;;
}
}
get_msg_count = millis();
time_out_count = millis();
@@ -62,7 +71,7 @@ ModuleComm::Respond_t ModuleComm::getResponse(uint32_t timeout)
break;
}
delay(5);
// delay(5);
}
return ret;