fix: remove cJSON on FillBuf
This commit is contained in:
parent
2f2a508788
commit
2d2bfa28f3
42
.idea/workspace.xml
generated
42
.idea/workspace.xml
generated
@ -29,22 +29,10 @@
|
|||||||
</configurations>
|
</configurations>
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="56631632-52f0-4e39-b905-89e46eb6e768" name="Changes" comment="dev: 暂时禁用指令下发处理">
|
<list default="true" id="56631632-52f0-4e39-b905-89e46eb6e768" name="Changes" comment="feat: add DMA support">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.mxproject" beforeDir="false" afterPath="$PROJECT_DIR$/.mxproject" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Inc/main.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/main.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Inc/oledfont.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/oledfont.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Inc/rc522.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/rc522.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Inc/stm32f1xx_hal_conf.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/stm32f1xx_hal_conf.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Inc/stm32f1xx_it.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/stm32f1xx_it.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Src/OneNet.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/OneNet.c" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Core/Src/OneNet.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/OneNet.c" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Src/esp8266.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/esp8266.c" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Src/freertos.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/freertos.c" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Core/Src/freertos.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/freertos.c" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Src/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/main.c" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Src/rc522.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/rc522.c" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Src/spi.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/spi.c" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Core/Src/stm32f1xx_it.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/stm32f1xx_it.c" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/IntelliChargingPile.ioc" beforeDir="false" afterPath="$PROJECT_DIR$/IntelliChargingPile.ioc" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -977,7 +965,7 @@
|
|||||||
<workItem from="1743488783461" duration="3691000" />
|
<workItem from="1743488783461" duration="3691000" />
|
||||||
<workItem from="1743492489952" duration="8816000" />
|
<workItem from="1743492489952" duration="8816000" />
|
||||||
<workItem from="1743525779889" duration="15870000" />
|
<workItem from="1743525779889" duration="15870000" />
|
||||||
<workItem from="1746680992201" duration="37397000" />
|
<workItem from="1746680992201" duration="39002000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="initial commit: oled, rc522, exti">
|
<task id="LOCAL-00001" summary="initial commit: oled, rc522, exti">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@ -1075,7 +1063,23 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1746710418606</updated>
|
<updated>1746710418606</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="13" />
|
<task id="LOCAL-00013" summary="feat: 完成状态机,完成刷卡、数据上报、命令处理">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1746724022145</created>
|
||||||
|
<option name="number" value="00013" />
|
||||||
|
<option name="presentableId" value="LOCAL-00013" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1746724022145</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00014" summary="feat: add DMA support">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1746724037639</created>
|
||||||
|
<option name="number" value="00014" />
|
||||||
|
<option name="presentableId" value="LOCAL-00014" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1746724037639</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="15" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@ -1098,19 +1102,21 @@
|
|||||||
<MESSAGE value="feat: before tring to fix cmdHandler" />
|
<MESSAGE value="feat: before tring to fix cmdHandler" />
|
||||||
<MESSAGE value="chore: update .gitignore" />
|
<MESSAGE value="chore: update .gitignore" />
|
||||||
<MESSAGE value="dev: 暂时禁用指令下发处理" />
|
<MESSAGE value="dev: 暂时禁用指令下发处理" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="dev: 暂时禁用指令下发处理" />
|
<MESSAGE value="feat: 完成状态机,完成刷卡、数据上报、命令处理" />
|
||||||
|
<MESSAGE value="feat: add DMA support" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="feat: add DMA support" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||||
<url>file://$PROJECT_DIR$/Core/Src/OneNet.c</url>
|
<url>file://$PROJECT_DIR$/Core/Src/OneNet.c</url>
|
||||||
<line>66</line>
|
<line>97</line>
|
||||||
<option name="timeStamp" value="16" />
|
<option name="timeStamp" value="16" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||||
<url>file://$PROJECT_DIR$/Core/Src/OneNet.c</url>
|
<url>file://$PROJECT_DIR$/Core/Src/OneNet.c</url>
|
||||||
<line>163</line>
|
<line>194</line>
|
||||||
<option name="timeStamp" value="17" />
|
<option name="timeStamp" value="17" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
|
@ -61,44 +61,75 @@ _Bool OneNet_DevLink(void)
|
|||||||
|
|
||||||
unsigned char OneNet_FillBuf(char* buf)
|
unsigned char OneNet_FillBuf(char* buf)
|
||||||
{
|
{
|
||||||
cJSON* packet = cJSON_CreateObject();
|
char text[48];
|
||||||
|
|
||||||
char packet_id[16];
|
strcpy(buf, "{\"id\":\"1743082944\",\"params\":{");
|
||||||
sprintf(packet_id, "%d", uwTick);
|
|
||||||
cJSON_AddItemToObject(packet, "id", cJSON_CreateString(packet_id));
|
|
||||||
|
|
||||||
cJSON* params = cJSON_CreateObject();
|
memset(text, 0, sizeof(text));
|
||||||
cJSON* valueObj = cJSON_CreateObject();
|
sprintf(text, "\"volt\":{\"value\":%.2f},", IM_Volt * 0.0001);
|
||||||
|
strcat(buf, text);
|
||||||
|
|
||||||
cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Volt * 0.0001));
|
memset(text, 0, sizeof(text));
|
||||||
cJSON_AddItemToObject(params, "volt", valueObj);
|
sprintf(text, "\"current\":{\"value\":%.2f},", IM_Curr * 0.0001);
|
||||||
|
strcat(buf, text);
|
||||||
|
|
||||||
valueObj = cJSON_CreateObject();
|
memset(text, 0, sizeof(text));
|
||||||
cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Curr * 0.0001));
|
sprintf(text, "\"watt_P\":{\"value\":%.2f},", IM_Power * 0.0001);
|
||||||
cJSON_AddItemToObject(params, "current", valueObj);
|
strcat(buf, text);
|
||||||
|
|
||||||
valueObj = cJSON_CreateObject();
|
memset(text, 0, sizeof(text));
|
||||||
cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Power * 0.0001));
|
sprintf(text, "\"energy\":{\"value\":%.3f},", IM_Energy * 0.0001);
|
||||||
cJSON_AddItemToObject(params, "watt_P", valueObj);
|
strcat(buf, text);
|
||||||
|
|
||||||
valueObj = cJSON_CreateObject();
|
memset(text, 0, sizeof(text));
|
||||||
cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Energy * 0.0001));
|
sprintf(text, "\"ic_id\":{\"value\":\"%s\"},", IC_CARD_ID);
|
||||||
cJSON_AddItemToObject(params, "energy", valueObj);
|
strcat(buf, text);
|
||||||
|
|
||||||
valueObj = cJSON_CreateObject();
|
memset(text, 0, sizeof(text));
|
||||||
cJSON_AddItemToObject(valueObj, "value", cJSON_CreateString(IC_CARD_ID));
|
sprintf(text, "\"output\":{\"value\":%s}",
|
||||||
cJSON_AddItemToObject(params, "ic_id", valueObj);
|
HAL_GPIO_ReadPin(RELAY1_GPIO_Port, RELAY1_Pin) == GPIO_PIN_RESET ? "true" : "false");
|
||||||
|
strcat(buf, text);
|
||||||
|
|
||||||
valueObj = cJSON_CreateObject();
|
strcat(buf, "}}");
|
||||||
cJSON_AddItemToObject(valueObj, "value", cJSON_CreateBool(HAL_GPIO_ReadPin(RELAY1_GPIO_Port, RELAY1_Pin) == GPIO_PIN_RESET));
|
|
||||||
cJSON_AddItemToObject(params, "output", valueObj);
|
|
||||||
|
|
||||||
cJSON_AddItemToObject(packet, "params", params);
|
// cJSON* packet = cJSON_CreateObject();
|
||||||
|
//
|
||||||
const char* json_str = cJSON_Print(packet);
|
// char packet_id[16];
|
||||||
strcpy(buf, json_str);
|
// sprintf(packet_id, "%d", uwTick);
|
||||||
|
// cJSON_AddItemToObject(packet, "id", cJSON_CreateString(packet_id));
|
||||||
cJSON_Delete(packet);
|
//
|
||||||
|
// cJSON* params = cJSON_CreateObject();
|
||||||
|
// cJSON* valueObj = cJSON_CreateObject();
|
||||||
|
//
|
||||||
|
// cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Volt * 0.0001));
|
||||||
|
// cJSON_AddItemToObject(params, "volt", valueObj);
|
||||||
|
//
|
||||||
|
// valueObj = cJSON_CreateObject();
|
||||||
|
// cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Curr * 0.0001));
|
||||||
|
// cJSON_AddItemToObject(params, "current", valueObj);
|
||||||
|
//
|
||||||
|
// valueObj = cJSON_CreateObject();
|
||||||
|
// cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Power * 0.0001));
|
||||||
|
// cJSON_AddItemToObject(params, "watt_P", valueObj);
|
||||||
|
//
|
||||||
|
// valueObj = cJSON_CreateObject();
|
||||||
|
// cJSON_AddItemToObject(valueObj, "value", cJSON_CreateNumber(IM_Energy * 0.0001));
|
||||||
|
// cJSON_AddItemToObject(params, "energy", valueObj);
|
||||||
|
//
|
||||||
|
// valueObj = cJSON_CreateObject();
|
||||||
|
// cJSON_AddItemToObject(valueObj, "value", cJSON_CreateString(IC_CARD_ID));
|
||||||
|
// cJSON_AddItemToObject(params, "ic_id", valueObj);
|
||||||
|
//
|
||||||
|
// valueObj = cJSON_CreateObject();
|
||||||
|
// cJSON_AddItemToObject(valueObj, "value", cJSON_CreateBool(HAL_GPIO_ReadPin(RELAY1_GPIO_Port, RELAY1_Pin) == GPIO_PIN_RESET));
|
||||||
|
// cJSON_AddItemToObject(params, "output", valueObj);
|
||||||
|
//
|
||||||
|
// cJSON_AddItemToObject(packet, "params", params);
|
||||||
|
//
|
||||||
|
// const char* json_str = cJSON_Print(packet);
|
||||||
|
// strcpy(buf, json_str);
|
||||||
|
//
|
||||||
|
// cJSON_Delete(packet);
|
||||||
|
|
||||||
return strlen(buf);
|
return strlen(buf);
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ void Display_IM1281B(void)
|
|||||||
|
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%.2fV ", IM_Volt * 0.0001);
|
snprintf(buffer, sizeof(buffer), "%.1f ", IM_Volt * 0.0001);
|
||||||
OLED_ShowString(16, 5, buffer, 12);
|
OLED_ShowString(16, 5, buffer, 12);
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%.2fA ", IM_Curr * 0.0001);
|
snprintf(buffer, sizeof(buffer), "%.2fA ", IM_Curr * 0.0001);
|
||||||
|
Loading…
Reference in New Issue
Block a user