This commit is contained in:
Qiea
2024-12-19 14:06:05 +08:00
parent 1c0f3b676f
commit dcd484c1bd
58 changed files with 14859 additions and 863 deletions

View File

@@ -5,7 +5,7 @@ char* uuid(){
static char uuid_str[9];
u32 time_stamp = HAL_GetTick();
u32 random_part = rand();
snprintf(uuid_str, 9, // 16 λ UUID<EFBFBD><EFBFBD>8 <20><><EFBFBD>ַ<EFBFBD> + <20><><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
snprintf(uuid_str, 9, // 16 UUID8 个字符 + 空终止符)
"%04lX%04lX",
(unsigned long)(time_stamp & 0xFFFF),
(unsigned long)(random_part & 0xFFFF));
@@ -15,7 +15,7 @@ char* uuid(){
void send_blocks(float* arr, char* uuid_str){
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢1000<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
// 按块处理 每个块的最大字符数最多存储1000个浮点数的字符串
char* block = (char*) mymalloc(SRAMEX,sizeof(char)*100*100);
memset(block, 0 ,sizeof(char)*100*100);
int block_index = 0;
@@ -26,8 +26,8 @@ void send_blocks(float* arr, char* uuid_str){
for (int j = 0; j < 100; ++j) {
int n = snprintf(block + block_index, 100 * 100 - block_index, "%.6f|", arr[i * 100 + j]);
block_index += n;
if (block_index >= 7000) {
block_index = 0; // <EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>
if (block_index >= 5000) {
block_index = 0; // 重置块
_total_len++;
}
}
@@ -39,10 +39,10 @@ void send_blocks(float* arr, char* uuid_str){
for (int j = 0; j < 100; ++j) {
int n = snprintf(block + block_index, 100*100 - block_index, "%.6f|", arr[i*100+j]);
block_index += n;
if (block_index >= 7000) {
if (block_index >= 5000) {
char* _block = (char*) mymalloc(SRAMEX,sizeof(char)*100*100);
memset(_block, 0 ,sizeof(char)*100*100);
block_index = 0; // <EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>
block_index = 0; // 重置块
sprintf(_block, "{\\\"uuid\\\":\\\"%s\\\",\\\"Bid\\\":\\\"%d\\\",\\\"Eid\\\":\\\"%d\\\",\\\"Block\\\":\\\"%s\\\"}\n", uuid_str, total_len++, _total_len, block);
//DEBUG_PRINTF("%s", _block);
@@ -53,7 +53,7 @@ void send_blocks(float* arr, char* uuid_str){
}
}
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 输出最后一个块
if (block_index > 0) {
char* _block = (char*) mymalloc(SRAMEX,sizeof(char)*100*100);
memset(_block, 0 ,sizeof(char)*100*100);