From ff86c38a5c23d942544a931fa51df3d85870c115 Mon Sep 17 00:00:00 2001 From: kyz Date: Fri, 12 Apr 2024 13:47:59 +0800 Subject: [PATCH] =?utf8?q?=E5=B9=B3=E5=8F=B0=E9=80=9A=E4=BF=A1=E5=8D=8F?= =?utf8?q?=E8=AE=AE=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=B8=8A=E6=8A=A5=E5=B9=B3?= =?utf8?q?=E5=8F=B0=E6=95=B0=E6=8D=AE=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84?= =?utf8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- user/user_report.c | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/user/user_report.c b/user/user_report.c index e3d54f6..dca31ee 100644 --- a/user/user_report.c +++ b/user/user_report.c @@ -2,7 +2,7 @@ static char mac_str_buf[20]; //"00:00:00:00:00:00"; static char *g_mac_str; - +#if 0 static const char *fmt = "{\n\ \"cmd\":\"rt\",\n\ \"cid\":%d,\n\ @@ -17,6 +17,29 @@ static const char *fmt = "{\n\ }\n\ }"; +#else +static const char *fmt = "{\n\ + \"cmd\":\"rt\",\n\ + \"cid\":%d,\n\ + \"mac\":\"%s\",\n\ + \"val\":{\n\ + \"c\":\"%0.1f\",\n\ + \"s\":\"%d\",\n\ + \"g\":\"%0.1f\"\n\ + },\n\ + \"weldCurrent\":\"%0.1f\",\n\ + \"gasFlow\":\"%0.1f\",\n\ + \"weldTech\":\"%s\",\n\ + \"solarTermFactor\":\"%d\",\n\ + \"gasPressure\":\"%d\",\n\ + \"totalFlow\":\"%d\",\n\ + \"onlineStatus\":\"%d\",\n\ + \"softVersion\":\"V%d.%d\",\n\ + \"lock\":\"%d\"\n\ + }"; + +#endif + static void mac_str_init( void ) { uint8_t mac[6]; @@ -26,11 +49,11 @@ static void mac_str_init( void ) g_mac_str = mac_str_buf; } +static const char * weld_method_str[3] = {"TIG", "MIG", "MAG" }; char * devinfo_report_str( void ) { static uint32_t cid = 0; - static char tx_buf[200]; - + static char tx_buf[500]; float c,g; uint32_t s; @@ -42,10 +65,19 @@ char * devinfo_report_str( void ) g = g_dev.flowmeter.flow_speed; s = g_dev.welding_start; - //+10A 到 -10A 上报0,与屏上显示一致 - if( c<10.0f && c>-10.0f ) - c = 0.0f; - sprintf( (char*)tx_buf, fmt, cid++, APP_VER_MAJOR, APP_VER_MINOR, g_dev.remote_locked, g_mac_str, c, s, g ); + //+10A 到 -10A 上报0,与屏上显示一致 + if( c<10.0f && c>-10.0f ) + c = 0.0f; + + sprintf( (char*)tx_buf, fmt, cid++, g_mac_str, c, s, g, + c,g, + weld_method_str[g_dev.cfg.welding_method], + g_dev.cfg.save_gas_factor, + (int)g_dev.pressure, + (int)g_dev.flowmeter.flow_total, + 1, + APP_VER_MAJOR, APP_VER_MINOR, + g_dev.remote_locked ); return tx_buf; } -- 2.34.1