From: kyz Date: Tue, 25 Feb 2025 08:13:18 +0000 (+0800) Subject: V5.2 修改故障码上报格式 X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=b28e266dbe00321068910ecaf6638f33a0687b49;p=yn%2Fweldingcontroller.git V5.2 修改故障码上报格式 --- diff --git a/user/user.h b/user/user.h index d968845..cd853d6 100644 --- a/user/user.h +++ b/user/user.h @@ -27,7 +27,7 @@ //#include "fmc.h" //-------------------- #define APP_VER_MAJOR 5 -#define APP_VER_MINOR 1 +#define APP_VER_MINOR 2 #define HW_V2 2 #define HW_V3 3 diff --git a/user/user_report.c b/user/user_report.c index c75246b..c522b86 100644 --- a/user/user_report.c +++ b/user/user_report.c @@ -52,7 +52,7 @@ static const char *fmt = "{\n\ \"syncFrequency\":%d,\n\ \"gasType\":%d,\n\ \"totalTime\":%d,\n\ -\"alarmType\":%d,\n\ +\"alarmType\":%s,\n\ \"onTime\":%d\n\ }"; @@ -135,7 +135,16 @@ int32_t get_new_rpt_info( rpt_info_t *rpt ) } rpt->weld_time = g_dev.welding_time_total/1000; - +#if 1 +/* +E1 :电流传感器故障 +E2:流量计故障 +E3:压力计故障 +E9:漏气故障 +E10:流量故障 +*/ + rpt->alarm = g_dev.state; +#else if(g_dev.alarm.leakage == 1) { rpt->alarm = 2; @@ -148,7 +157,7 @@ int32_t get_new_rpt_info( rpt_info_t *rpt ) { rpt->alarm = 0; } - +#endif rpt->on_time = 0; @@ -194,6 +203,31 @@ static void mac_str_init( void ) static const char * weld_method_str[3] = {"TIG", "MIG", "MAG" }; +char *rpt_fault_code( uint32_t alarm ) +{ + static char falt_code[128]; + char buf[16]; + int nr; + + if( alarm == 0 ){ + strcpy( falt_code, "[ 0 ]" ); + }else{ + sprintf( falt_code, "[ " ); + nr = 0; + for( int i=0; i<32; i++ ){ + if( alarm& (1<