2024-05-31

This commit is contained in:
2584532475@qq.com committed 2024-05-31 16:57:54 +08:00
1 parent f8591b8b99
commit 4a963bd78c
27 files changed
+2956 -229

No files matched your search

+9
View File
@@ -21,6 +21,15 @@ uint32_t Bytes2Int (char * data)
return I.data;
}
int16_t Bytes2Int16 (char * data)
{
Int16Tobyte int16_byte;
int16_byte.byte[0] = data[1];
int16_byte.byte[1] = data[0];
return int16_byte.value;
}
// -----------------------------------------------------------------
// 函数功能: hex字符串转byte数组
+7
View File
@@ -15,6 +15,11 @@ typedef union
} Float;
typedef union{
int16_t value;
char byte[2];
}Int16Tobyte;
float Bytes2Float (char * data);
uint32_t Bytes2Int (char * data);
int hexstr_to_hexbyte (char *src, char *obj, uint16_t length);
@@ -23,6 +28,8 @@ uint32_t byte_to_Inverse(char * data);
// 754 תfloat
float float_to_iee754 (float ff1,char * data);
int16_t Bytes2Int16 (char * data);
#endif
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,88 @@
/*
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef cJSON_Utils__h
#define cJSON_Utils__h
#ifdef __cplusplus
extern "C"
{
#endif
#include "cJSON.h"
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *pointer);
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointerCaseSensitive(cJSON * const object, const char *pointer);
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to);
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to);
/* Utility for generating patch array entries. */
CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value);
/* Returns 0 for success. */
CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches);
CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches);
/*
// Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use:
//int cJSONUtils_AtomicApplyPatches(cJSON **object, cJSON *patches)
//{
// cJSON *modme = cJSON_Duplicate(*object, 1);
// int error = cJSONUtils_ApplyPatches(modme, patches);
// if (!error)
// {
// cJSON_Delete(*object);
// *object = modme;
// }
// else
// {
// cJSON_Delete(modme);
// }
//
// return error;
//}
// Code not added to library since this strategy is a LOT slower.
*/
/* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */
/* target will be modified by patch. return value is new ptr for target. */
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatch(cJSON *target, const cJSON * const patch);
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON * const patch);
/* generates a patch to move from -> to */
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatch(cJSON * const from, cJSON * const to);
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON * const from, cJSON * const to);
/* Given a root object and a target object, construct a pointer from one to the other. */
CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target);
/* Sorts the members of the object into alphabetical order. */
CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -34,12 +34,12 @@
#ifdef EF_USING_ENV
/* Auto update ENV to latest default when current ENV version number is changed. */
/* #define EF_ENV_AUTO_UPDATE */
#define EF_ENV_AUTO_UPDATE
/**
* ENV version number defined by user.
* Please change it when your firmware add a new ENV to default_env_set.
*/
#define EF_ENV_VER_NUM 0 /* @note you must define it for a value, such as 0 */
#define EF_ENV_VER_NUM 3 /* @note you must define it for a value, such as 0 */
/* MCU Endian Configuration, default is Little Endian Order. */
/* #define EF_BIG_ENDIAN */
+10 -6
View File
@@ -43,7 +43,7 @@ static const ef_env default_env_set[] = {
{"boot_times", "0"},
{"jump_boot_time", "10"}, // BOOT 等待时间 10s
// 基础参数设置
{"device_id", "0000000003"},
{"device_id", "7322070012"},
{"app_id", "220000"}, // 业务ID
{"user_pass", "123456"},
{"sys_pass", "898909"},
@@ -51,7 +51,7 @@ static const ef_env default_env_set[] = {
{"mqtt_pass", "admin"},
{"mqtt_addr", "mqtt.zyjzjs.cn"},
{"mqtt_port", "1883"},
{"mqtt_topic", "sluice"}, //订阅topic
{"mqtt_topic", "syksk"}, //订阅topic
{"net_drv", "dtu"}, // mqtt dtu ec200 eth
{"eth2_chann", "0"}, //以太网通道2 支持modbus
@@ -82,9 +82,9 @@ static const ef_env default_env_set[] = {
{"pwm4", "0"}, // PWM4功能
// 闸门参数设置
{"max_open", "1400"}, // 最大开度
{"max_ecode", "31241"}, // 编码器最大编码
{"min_ecode", "32828"}, // 编码器最小编码
{"max_open", "1600"}, // 最大开度
{"max_ecode", "25712"}, // 编码器最大编码
{"min_ecode", "31770"}, // 编码器最小编码
{"exec_time", "50"}, // 异常检测时间 单位100ms 50 就是 5s
// 闸门参数设置
@@ -98,7 +98,11 @@ static const ef_env default_env_set[] = {
{"site_type", "sluice"}, // 0,闸门站,1,流量站,2,渗流渗压站,3,自动化采集站,4,串口服务器
{"level","[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]"},
{"flow", "[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]"},
{"wsid","[128,2,3,4,5,6]"},
{"wsid","[1,2,3,4,5,6]"},
{"sl427ip","116.176.77.72"},
{"sl427port","6200"},
{"sl427code","0000000002"},
// 水位流量关系表 配置10 个点