Compare commits
12 Commits
7103c8ddfb
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| c8986a8074 | |||
| 74a0193e3d | |||
| a87bc24b01 | |||
| 1f255cb3ef | |||
| 2a7c8e4b3b | |||
| dd8018e9bb | |||
| 626a486945 | |||
| 8052721c21 | |||
| 44e679182d | |||
| 21cb23d0b9 | |||
| 030c22472d | |||
| d05345afb7 |
@@ -0,0 +1,88 @@
|
|||||||
|
---
|
||||||
|
name: add-debug-command
|
||||||
|
description: 在 GateWay_Debug 模块中添加新的 Debug 调试命令(函数指针表 + 字符串匹配模式)
|
||||||
|
source: auto-skill
|
||||||
|
extracted_at: '2026-06-15T08:10:31.194Z'
|
||||||
|
---
|
||||||
|
|
||||||
|
# 添加 Debug 调试命令
|
||||||
|
|
||||||
|
本项目的 Debug 命令系统位于 `Project/GateWay/source/Module/GateWay_Debug/DebugCmd.c`,采用**函数指针表 + 字符串匹配**模式。
|
||||||
|
|
||||||
|
## 修改步骤
|
||||||
|
|
||||||
|
### 1. 编写 handler 函数
|
||||||
|
|
||||||
|
在 `DebugCmd.c` 中添加函数,签名固定为 `void FuncName(int argc, char *argv[])`:
|
||||||
|
|
||||||
|
```c
|
||||||
|
static void DebugCmdXxx(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
DBG_LOG("\r\n");
|
||||||
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
|
DBG_LOG("Debug Cmd: xxx\r\n");
|
||||||
|
DBG_LOG(" brief --> 功能描述.\r\n\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 实际逻辑...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**必须遵循的模式:**
|
||||||
|
- 函数体第一行:`DBG_LOG("\r\n");`
|
||||||
|
- `"?"` 帮助分支:打印命令名和 brief 说明
|
||||||
|
- 若修改了 `ConfigPara`,调用 `WritePara()` 保存
|
||||||
|
- 需要被外部引用时声明为 `void`,仅内部使用时声明为 `static void`
|
||||||
|
|
||||||
|
### 2. 注册到命令表
|
||||||
|
|
||||||
|
在文件末尾的 `DebugFun[]` 常量数组中添加一行:
|
||||||
|
|
||||||
|
```c
|
||||||
|
const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
||||||
|
// ... 已有命令 ...
|
||||||
|
"xxx", DebugCmdXxx,
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
**容量限制:** `DEBUG_CMD_CNT = 30`,添加前检查剩余空位(当前使用 28/30)。若超出需增大该宏。
|
||||||
|
|
||||||
|
### 3. 添加到 help 输出
|
||||||
|
|
||||||
|
在 `DebugCmdHelp` 函数末尾添加:
|
||||||
|
|
||||||
|
```c
|
||||||
|
len = strlen("xxx ?\r\n");
|
||||||
|
memcpy(Data, "xxx ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
```
|
||||||
|
|
||||||
|
## 可用的关键 API
|
||||||
|
|
||||||
|
| 函数 | 头文件 | 用途 |
|
||||||
|
|---|---|---|
|
||||||
|
| `CatOneEthSendQueue(data, len)` | CatOneTask.h | 将载荷放入网络发送队列(需 `SvrRegFlag == true`) |
|
||||||
|
| `CommUintOrgData(GateWay, CUPara, CUData, buf)` | Public.h | 组装通讯单元传感器数据包 |
|
||||||
|
| `GateWayRegister(TxBuff)` | CatOneTask.h | 组装网关注册包,返回长度 |
|
||||||
|
| `NetCommOrgData(GateWay, payload, outBuf)` | Public.h | 为载荷添加网络帧头(0x7A)+MAC+CRC |
|
||||||
|
| `WritePara(data, len)` | (bsp) | 保存配置参数到 Flash |
|
||||||
|
| `CatOneTriggerRegister()` | CatOneTask.h | 将 Cat1 状态机立即切换到注册状态 |
|
||||||
|
| `ETHTriggerRegister()` | CatOneTask.h | 将以太网状态机立即切换到注册状态 |
|
||||||
|
|
||||||
|
## 可用的全局/extern 变量
|
||||||
|
|
||||||
|
| 变量 | 类型 | 来源 |
|
||||||
|
|---|---|---|
|
||||||
|
| `GateWay` | `static GateWayPara` | DebugCmd.c 内静态指针,指向网关参数 |
|
||||||
|
| `SComm1Para` / `SComm2Para` | `SensorCommPara_t` | RS485Task.c 中定义,DebugCmd.c 已 extern |
|
||||||
|
| `GateWay->SvrRegFlag` | `bool` | 服务器注册状态 |
|
||||||
|
| `GateWay->ConfigPara` | `GWConfigPara_t` | 网关配置参数 |
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
- `CatOne_t CatOne` 和 `CatOneEthTxBuff[]` 均为 CatOneTask.c 中的 **static** 变量,不能直接在 DebugCmd.c 中访问;应使用封装好的接口函数(如 `CatOneTriggerRegister()`、`ETHTriggerRegister()`)来操作状态机
|
||||||
|
- 重新注册应:清 `GateWay->SvrRegFlag = false`,然后根据通信模式调用 `CatOneTriggerRegister()` 或 `ETHTriggerRegister()` 立即切换状态机到注册状态,而不是仅清标志位等待状态机自动检测
|
||||||
|
- `CatOneEthSendQueue` 内部检查 `SvrRegFlag`,未注册时返回 `false`
|
||||||
|
- 命令解析函数 `DebugAnalyze` 按 `" "` 分割参数,去除 `\r`,最多 10 个参数
|
||||||
|
- `DEBUG_CMD_CNT = 30` 为命令容量上限,添加新命令前需检查当前使用量,若超出需将此宏增大(如改为31)
|
||||||
|
- 若模块需要保存独立的配置参数(如YOXO1007网络参数),可在DebugCmd.c中定义static变量,并通过Flash读写函数持久化(参考`EthNetPara_t`和`WriteEthNetPara`的实现)
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
name: fix-yoxo1007-receive-data
|
||||||
|
description: 修复YOXO1007以太网模块接收数据解析错误问题
|
||||||
|
source: auto-skill
|
||||||
|
extracted_at: '2026-06-17T04:30:00.000Z'
|
||||||
|
---
|
||||||
|
|
||||||
|
# 修复 YOXO1007 以太网模块接收数据解析错误
|
||||||
|
|
||||||
|
## 问题现象
|
||||||
|
|
||||||
|
服务器已收到网关注册请求并响应,但网关端无法接收/解析服务器返回的数据。
|
||||||
|
|
||||||
|
## 根本原因
|
||||||
|
|
||||||
|
YOXO1007 模块在**透传模式**下发送的是**原始二进制数据**,不是 ASCII 格式的 hex 字符串。
|
||||||
|
|
||||||
|
原代码错误地使用了 `AsciiToHex` 函数进行格式转换:
|
||||||
|
|
||||||
|
```c
|
||||||
|
// 错误代码 - CATONE 模式使用的 ASCII 转换不适用于 ETH 透传模式
|
||||||
|
memset(HexData, 0x00, CatOneEthRxLen / 2);
|
||||||
|
uint8_t ret = AsciiToHex(RxBuffTemp, HexData, CatOneEthRxLen);
|
||||||
|
if(ret > 0)
|
||||||
|
GateWay->SvrRevCallBack(GateWay, HexData, ret);
|
||||||
|
```
|
||||||
|
|
||||||
|
这导致服务器返回的二进制数据被错误解析,回调函数无法正确处理。
|
||||||
|
|
||||||
|
## 修复方案
|
||||||
|
|
||||||
|
修改 `CatOneTask.c` 中 ETH 接收线程的数据处理逻辑,直接传递原始二进制数据:
|
||||||
|
|
||||||
|
```c
|
||||||
|
// 修改后的正确代码
|
||||||
|
CAT1_DBG_LOG("Eth Rev: len=%d\r\n", CatOneEthRxLen);
|
||||||
|
/* YOXO1007模块在透传模式下发送原始二进制数据,直接传递 */
|
||||||
|
if(CatOneEthRxLen > 0)
|
||||||
|
GateWay->SvrRevCallBack(GateWay, (uint8_t *)CatOneEthRxBuff, CatOneEthRxLen);
|
||||||
|
```
|
||||||
|
|
||||||
|
## 修改位置
|
||||||
|
|
||||||
|
`Project/GateWay/source/User/Src/CatOneTask.c` 中的 `CatOneRev_Thread_Entry` 函数内的 ETH 分支。
|
||||||
|
|
||||||
|
## 关键区别
|
||||||
|
|
||||||
|
| 模式 | 数据格式 | 解析方式 |
|
||||||
|
|------|----------|----------|
|
||||||
|
| CAT1 (4G) | ASCII 字符串 (AT 命令/响应) | 需要 AsciiToHex 转换 |
|
||||||
|
| ETH (YOXO1007) | 原始二进制 (透传模式) | 直接传递,不转换 |
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
- 此修改仅影响 ETH 通信模式,CAT1 模式的 ASCII 解析逻辑保持不变
|
||||||
|
- YOXO1007 模块配置参数使用二进制命令协议(识别流 ED F2 A3 56...),与数据透传是不同层面
|
||||||
|
- 模块配置保存后重启会自动进入之前保存的工作模式,无需额外进入透传模式的命令
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
---
|
||||||
|
name: git-branch-cleanup
|
||||||
|
description: 批量删除/重命名本地和远端 Git 分支,并同步远端仓库结构(含中文分支名、upstream 修复)
|
||||||
|
source: auto-skill
|
||||||
|
extracted_at: '2026-06-17T10:06:37.947Z'
|
||||||
|
---
|
||||||
|
|
||||||
|
# Git 分支批量清理与重命名
|
||||||
|
|
||||||
|
## 适用场景
|
||||||
|
需要删除多余的本地/远端分支、将分支重命名、并让远端结构与本地保持一致。
|
||||||
|
|
||||||
|
## 操作流程
|
||||||
|
|
||||||
|
### 1. 切换到安全分支
|
||||||
|
```bash
|
||||||
|
# 先 stash 未提交的更改
|
||||||
|
git stash --include-untracked
|
||||||
|
|
||||||
|
# 如果有 untracked 文件冲突,使用 -f 强制切换
|
||||||
|
git checkout -f master
|
||||||
|
```
|
||||||
|
|
||||||
|
> **坑点**:中文分支名之间的文件差异可能产生大量 untracked 冲突(如 FatFS 文档等),
|
||||||
|
> `git checkout` 会拒绝切换,需要 `-f` 强制切换,之后 `git stash pop` 恢复。
|
||||||
|
|
||||||
|
### 2. 删除本地分支
|
||||||
|
```bash
|
||||||
|
git branch -D "LAN口通讯"
|
||||||
|
git branch -D "新版4G模块1"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 重命名本地分支
|
||||||
|
```bash
|
||||||
|
git branch -m "旧版4G模块" develop
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 删除远端分支(每个远端都要操作)
|
||||||
|
```bash
|
||||||
|
# 一次性删除多个远端分支
|
||||||
|
git push home --delete "LAN口通讯" "新版4G模块" "旧版4G模块"
|
||||||
|
git push origin --delete "LAN口通讯" "新版4G模块" "旧版4G模块"
|
||||||
|
```
|
||||||
|
|
||||||
|
> **注意**:远端可能认证失败(如内网地址不可达),先确认网络可达再操作。
|
||||||
|
> 远端分支名可能与本地不完全一致(本地有 `新版4G模块1`,远端只有 `新版4G模块`)。
|
||||||
|
|
||||||
|
### 5. 强制推送重命名后的分支到远端
|
||||||
|
```bash
|
||||||
|
git push home develop --force
|
||||||
|
git push origin develop --force
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. 修复上游跟踪分支
|
||||||
|
重命名后,分支仍跟踪旧的远端名(如 `origin/旧版4G模块`,已不存在):
|
||||||
|
```bash
|
||||||
|
git branch --set-upstream-to=origin/develop develop
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. 恢复工作内容并切回开发分支
|
||||||
|
```bash
|
||||||
|
git checkout develop
|
||||||
|
git stash pop
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. 验证最终结构
|
||||||
|
```bash
|
||||||
|
git fetch --all --prune
|
||||||
|
git branch -a
|
||||||
|
```
|
||||||
|
|
||||||
|
## 常见问题
|
||||||
|
|
||||||
|
| 问题 | 解决方案 |
|
||||||
|
|------|----------|
|
||||||
|
| checkout 报 untracked files 冲突 | `git checkout -f <branch>` |
|
||||||
|
| 远端认证失败 | 检查网络/VPN,确认远端地址可达 |
|
||||||
|
| 重命名后 upstream 指向已删除的远端分支 | `git branch --set-upstream-to=origin/<new-name> <branch>` |
|
||||||
|
| 中文分支名在命令行中需加引号 | `git branch -D "旧版4G模块"` |
|
||||||
@@ -0,0 +1,314 @@
|
|||||||
|
$PACKAGES
|
||||||
|
bq25306rter ! bq25306rter ! '{Value}' ; U2
|
||||||
|
c0402m ! c0402m ! 100nF ; C9 C28 C41
|
||||||
|
c0402m ! c0402m ! 100pF ; C11 C42 C43
|
||||||
|
c0402m ! c0402m ! 10nF ; C10
|
||||||
|
c0402m ! c0402m ! 33pF ; C29 C30 C31 C32
|
||||||
|
C0603 ! C0603 ! '2.2uF' ; C59 C60 C68
|
||||||
|
C0603 ! C0603 ! '4.7uF' ; C65
|
||||||
|
C0603 ! C0603 ! 100nF ; C1 C3 C5 C15 C16 C19 C21 C23 C25 C26 C34 C36 C38 C40 ,
|
||||||
|
C44 C46 C48 C50 C52 C53 C54 C56 C61 C63 C64 C66 C70 C71 C76 C78 C79 ,
|
||||||
|
C80 C83 C84 C85 C86
|
||||||
|
C0603 ! C0603 ! 10uF ; C27 C55 C57 C62
|
||||||
|
C0603 ! C0603 ! 15pF ; C73 C77
|
||||||
|
C0603 ! C0603 ! 1uF ; C69 C72 C75
|
||||||
|
C0603 ! C0603 ! 22pF ; C67 C74 C81 C82
|
||||||
|
C0603 ! C0603 ! 22uF ; C58
|
||||||
|
C0603 ! C0603 ! 470pF ; C17
|
||||||
|
C0603 ! C0603 ! 47nF ; C4
|
||||||
|
C0805 ! C0805 ! '2.2uF' ; C13
|
||||||
|
C0805 ! C0805 ! 10nF ; C24
|
||||||
|
C0805 ! C0805 ! 22uF ; C2 C8 C12 C18 C20 C33 C35 C39 C45 C47 C49 C51
|
||||||
|
C1206 ! C1206 ! 22uF ; C14 C37
|
||||||
|
CAP-SMD_BD6.3-L6.6-W6.6-FD ! CAP-SMD_BD6.3-L6.6-W6.6-FD ! 470uF ; C6 C7
|
||||||
|
CAP-SMD_BD6.3-L6.6-W6.6-LS7.3-FD ! CAP-SMD_BD6.3-L6.6-W6.6-LS7.3-FD ! 220uF ; ,
|
||||||
|
C22
|
||||||
|
CONN-TH_2P-P2.50_HX25003-2A ! CONN-TH_2P-P2.50_HX25003-2A ! '{Value}' ; CN1
|
||||||
|
CONN-TH_2P-P3.81_L7.4-W7.6 ! CONN-TH_2P-P3.81_L7.4-W7.6 ! '{Value}' ; U1 U9 ,
|
||||||
|
U11 U13 U15
|
||||||
|
,
|
||||||
|
CONN-TH_3P-P2.00_HCTL_PH-3A_C2908624 ! CONN-TH_3P-P2.00_HCTL_PH-3A_C2908624 ! '{Value}' ,
|
||||||
|
; CN3
|
||||||
|
CONN-TH_4P-P2.00_PH-4A_C2908625 ! CONN-TH_4P-P2.00_PH-4A_C2908625 ! '{Value}' ,
|
||||||
|
; H4
|
||||||
|
,
|
||||||
|
CONN-TH_7P-P1.25_HCTL_HC-1.25-7A ! CONN-TH_7P-P1.25_HCTL_HC-1.25-7A ! '{Value}' ,
|
||||||
|
; CN2
|
||||||
|
CONN-TH_PH-2A_C2908623 ! CONN-TH_PH-2A_C2908623 ! '{Value}' ; H1
|
||||||
|
CRYSTAL-SMD_4P-L3.2-W2.5-BL-2 ! CRYSTAL-SMD_4P-L3.2-W2.5-BL-2 ! '{Value}' ; ,
|
||||||
|
U21
|
||||||
|
DO-214AC_L4.3-W2.4-LS4.7-RD ! DO-214AC_L4.3-W2.4-LS4.7-RD ! '{Value}' ; D1
|
||||||
|
E32-400M30S ! E32-400M30S ! '{Value}' ; U12
|
||||||
|
,
|
||||||
|
ESOP-8_L4.9-W3.9-P1.27-LS6.0-TL-EP ! ESOP-8_L4.9-W3.9-P1.27-LS6.0-TL-EP ! '{Value}' ,
|
||||||
|
; U4
|
||||||
|
FC-135R_L3.2-W1.5 ! FC-135R_L3.2-W1.5 ! '32.768kHz' ; X1
|
||||||
|
HDR-TH_2P-P2.54-V-M ! HDR-TH_2P-P2.54-V-M ! '{Value}' ; H5
|
||||||
|
HDR-TH_3P-P2.54-V-M ! HDR-TH_3P-P2.54-V-M ! '{Value}' ; H2 H3
|
||||||
|
IND-SMD_L2.5-W2.0_AHP252010TF ! IND-SMD_L2.5-W2.0_AHP252010TF ! 10uH ; L2 L4
|
||||||
|
IND-SMD_L4.8-W4.5 ! IND-SMD_L4.8-W4.5 ! '2.2uH' ; L1
|
||||||
|
IND-SMD_L7.0-W6.6_FXL0630 ! IND-SMD_L7.0-W6.6_FXL0630 ! 15uH ; L3 L5
|
||||||
|
IPEX-SMD_BWIPX-1-001E ! IPEX-SMD_BWIPX-1-001E ! '{Value}' ; RF1
|
||||||
|
L0603 ! L0603 ! '{Value}' ; L6
|
||||||
|
LED0603-FD_BLUE ! LED0603-FD_BLUE ! '{Value}' ; LORA
|
||||||
|
LED0603-RD ! LED0603-RD ! '{Value}' ; LAN LED1
|
||||||
|
,
|
||||||
|
LQFP-64_L10.0-W10.0-P0.50-LS12.0-BL ! LQFP-64_L10.0-W10.0-P0.50-LS12.0-BL ! '{Value}' ,
|
||||||
|
; U20
|
||||||
|
NANO-SIM-SMD_SMN-305-ARP7 ! NANO-SIM-SMD_SMN-305-ARP7 ! '{Value}' ; CARD1
|
||||||
|
NT26E ! NT26E ! '{Value}' ; U19
|
||||||
|
OSC-SMD_4P-L3.2-W2.5-BL ! OSC-SMD_4P-L3.2-W2.5-BL ! 16MHz ; X2
|
||||||
|
,
|
||||||
|
QFN-48_L5.0-W5.0-P0.35-EP3.7_UC8288 ! QFN-48_L5.0-W5.0-P0.35-EP3.7_UC8288 ! '{Value}' ,
|
||||||
|
; U17
|
||||||
|
R0402 ! R0402 ! '100kΩ' ; R5 R34 R41 R42 R44
|
||||||
|
R0402 ! R0402 ! '10kΩ' ; R2 R15 R23 R35 R37 R38 R39 R40 R43 R45 R55 R75
|
||||||
|
R0402 ! R0402 ! '1kΩ' ; R18
|
||||||
|
R0402 ! R0402 ! '22Ω' ; R25 R26 R30
|
||||||
|
R0603 ! R0603 ! '100kΩ' ; R13 R19 R57 R72
|
||||||
|
R0603 ! R0603 ! '100Ω' ; R56
|
||||||
|
R0603 ! R0603 ! '10kΩ' ; R10 R11 R14 R47 R50 R51 R54 R59 R63 R64 R65 R66 R67 ,
|
||||||
|
R68
|
||||||
|
R0603 ! R0603 ! '120kΩ' ; R73
|
||||||
|
R0603 ! R0603 ! '120Ω' ; R49 R52
|
||||||
|
R0603 ! R0603 ! '12kΩ' ; R22 R36
|
||||||
|
R0603 ! R0603 ! '169kΩ' ; R7 R28
|
||||||
|
R0603 ! R0603 ! '1kΩ' ; R1 R4 R8 R12 R29 R58 R69 R70 R74
|
||||||
|
R0603 ! R0603 ! '1MΩ' ; R17
|
||||||
|
R0603 ! R0603 ! '2.7kΩ' ; R61
|
||||||
|
R0603 ! R0603 ! '200kΩ' ; R16 R71
|
||||||
|
R0603 ! R0603 ! '24kΩ' ; R46
|
||||||
|
R0603 ! R0603 ! '3.24kΩ' ; R31
|
||||||
|
R0603 ! R0603 ! '3.3kΩ' ; R6 R21
|
||||||
|
R0603 ! R0603 ! '30kΩ' ; R3
|
||||||
|
R0603 ! R0603 ! '330kΩ' ; R20
|
||||||
|
R0603 ! R0603 ! '4.7kΩ' ; R60 R62
|
||||||
|
R0603 ! R0603 ! '64kΩ' ; R9 R27
|
||||||
|
R0805 ! R0805 ! '100kΩ' ; R53
|
||||||
|
R0805 ! R0805 ! '10kΩ' ; R24 R33
|
||||||
|
R0805 ! R0805 ! '1kΩ' ; R48
|
||||||
|
R0805 ! R0805 ! '20kΩ' ; R32
|
||||||
|
RJ45-TH_HR915310A ! RJ45-TH_HR915310A ! '{Value}' ; D7
|
||||||
|
,
|
||||||
|
SC-70-6_L2.2-W1.3-P0.65-LS2.1-BL ! SC-70-6_L2.2-W1.3-P0.65-LS2.1-BL ! '{Value}' ,
|
||||||
|
; U22 U23
|
||||||
|
SMA_L4.3-W2.6-LS5.1-RD ! SMA_L4.3-W2.6-LS5.1-RD ! '{Value}' ; D3 D4
|
||||||
|
SOIC-8_L5.0-W4.0-P1.27-LS6.0-BL ! SOIC-8_L5.0-W4.0-P1.27-LS6.0-BL ! '{Value}' ,
|
||||||
|
; U10 U14
|
||||||
|
SOIC-8_L5.3-W5.3-P1.27-LS8.0-BL ! SOIC-8_L5.3-W5.3-P1.27-LS8.0-BL ! '{Value}' ,
|
||||||
|
; U18
|
||||||
|
,
|
||||||
|
SOT-223-3_L6.5-W3.4-P2.30-LS7.0-BR ! SOT-223-3_L6.5-W3.4-P2.30-LS7.0-BR ! '{Value}' ,
|
||||||
|
; U8
|
||||||
|
SOT-23 ! SOT-23 ! '{Value}' ; D5 D6
|
||||||
|
SOT-23_L2.9-W1.3-P1.90-LS2.4-BR ! SOT-23_L2.9-W1.3-P1.90-LS2.4-BR ! '{Value}' ,
|
||||||
|
; Q1 Q2 Q3 Q4 Q7 Q15 Q17
|
||||||
|
,
|
||||||
|
SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR ! SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR ! '{Value}' ,
|
||||||
|
; Q5 Q11 Q19
|
||||||
|
,
|
||||||
|
SOT-23-3_L2.9-W1.6-P1.90-LS2.8-BR ! SOT-23-3_L2.9-W1.6-P1.90-LS2.8-BR ! '{Value}' ,
|
||||||
|
; Q6
|
||||||
|
,
|
||||||
|
SOT-23-3_L3.0-W1.7-P0.95-LS2.9-BR ! SOT-23-3_L3.0-W1.7-P0.95-LS2.9-BR ! '{Value}' ,
|
||||||
|
; Q18
|
||||||
|
sot-23-3p ! sot-23-3p ! '{Value}' ; Q8 Q9 Q10 Q12 Q13 Q14
|
||||||
|
,
|
||||||
|
SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BL ! SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BL ! '{Value}' ,
|
||||||
|
; U3 U6
|
||||||
|
,
|
||||||
|
SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BR ! SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BR ! '{Value}' ,
|
||||||
|
; U7
|
||||||
|
,
|
||||||
|
SOT-363_L2.0-W1.3-P0.65-LS2.1-BR ! SOT-363_L2.0-W1.3-P0.65-LS2.1-BR ! '{Value}' ,
|
||||||
|
; D2
|
||||||
|
SOT323-6L_L2.0-W1.3-LS2.1-BL ! SOT323-6L_L2.0-W1.3-LS2.1-BL ! '{Value}' ; U16
|
||||||
|
TF-SMD_XKTF-1307-18 ! TF-SMD_XKTF-1307-18 ! '{Value}' ; CARD2
|
||||||
|
,
|
||||||
|
TO-263-5_L10.2-W9.9-P1.70-LS14.4-TL ! TO-263-5_L10.2-W9.9-P1.70-LS14.4-TL ! '{Value}' ,
|
||||||
|
; U5
|
||||||
|
$A_PROPERTIES
|
||||||
|
$NETS
|
||||||
|
'$1N14156' ; R32.1 R33.1 U5.5
|
||||||
|
'$1N15120' ; C16.2 L2.1 U3.6
|
||||||
|
'$1N15124' ; C16.1 U3.1
|
||||||
|
'$1N156972' ; R61.2 U20.55
|
||||||
|
'$1N157217' ; LORA.2 R61.1
|
||||||
|
'$1N219298' ; Q3.1 R6.2
|
||||||
|
'$1N219301' ; Q7.1 R21.2
|
||||||
|
'$1N219303' ; Q6.3 R8.1 R19.2
|
||||||
|
'$1N219304' ; D1.1 R1.1 R10.1
|
||||||
|
'$1N219315' ; Q4.1 R8.2
|
||||||
|
'$1N219322' ; R11.2 R14.2 U2.7
|
||||||
|
'$1N219324' ; R16.2 U2.8
|
||||||
|
'$1N219325' ; C17.1 R16.1 R20.2 U2.9
|
||||||
|
'$1N219326' ; R17.1 R20.1
|
||||||
|
'$1N219329' ; C4.1 L1.1 U2.13 U2.14
|
||||||
|
'$1N219330' ; C5.2 C14.2 C17.2 CN1.1 L1.2 Q7.3 R17.2 U2.10
|
||||||
|
'$1N219388' ; Q3.3 U1.2
|
||||||
|
'$1N219660' ; Q6.1 R10.2
|
||||||
|
'$1N219673' ; C15.2 Q3.2 Q4.2 Q6.2 R1.2
|
||||||
|
'$1N219967' ; H5.2 R72.2 R74.2 U22.6 U23.6
|
||||||
|
'$1N220337' ; Q2.1 R12.2 R13.2
|
||||||
|
'$1N220644' ; H2.2 R22.2 U3.3
|
||||||
|
'$1N220659' ; H2.1 R9.1
|
||||||
|
'$1N220661' ; H2.3 R7.2
|
||||||
|
'$1N220812' ; H3.1 R27.2
|
||||||
|
'$1N220814' ; H3.3 R28.2
|
||||||
|
'$1N220820' ; H3.2 R36.2 U6.3
|
||||||
|
'$1N232426' ; C4.2 U2.15
|
||||||
|
'$1N232428' ; R3.2 U2.4
|
||||||
|
'$1N25321' ; C24.1 U4.1
|
||||||
|
'$1N25347' ; C24.2 D3.1 L3.1 U4.8
|
||||||
|
'$1N25981' ; R24.1 R31.2 U4.4
|
||||||
|
'$1N27457' ; C25.1 U6.1
|
||||||
|
'$1N27465' ; C25.2 L4.1 U6.6
|
||||||
|
'$1N27856' ; D4.2 L5.2 U7.1
|
||||||
|
'$1N27899' ; R46.1 R48.2 U7.3
|
||||||
|
'$1N284612' ; H4.2 R29.1
|
||||||
|
'$1N284617' ; H4.1 Q11.3
|
||||||
|
'$1N284675' ; Q11.1 R44.2 R45.2
|
||||||
|
'$1N284885' ; C3.2 C12.2 Q4.3 R12.1 U2.1
|
||||||
|
'$1N284896' ; R4.2 U2.3
|
||||||
|
'$1N284900' ; H1.2 R4.1
|
||||||
|
'$1N284903' ; C13.2 H1.1 R11.1 U2.2
|
||||||
|
'$1N285302' ; C54.2 C55.2 C56.2 C57.2 Q15.3 U12.9 U12.10
|
||||||
|
'$1N292841' ; Q15.1 Q19.3 R53.2
|
||||||
|
'$1N292934' ; Q19.1 R55.2
|
||||||
|
'$1N299251' ; H4.4 U4.7
|
||||||
|
'$1N330138' ; Q1.1 Q5.3 R5.2
|
||||||
|
'$1N330143' ; Q5.1 R2.1
|
||||||
|
'$1N330213' ; C58.2 C62.2 Q17.3 Q18.2 U16.5
|
||||||
|
'$1N330234' ; Q17.1 R57.1 R58.2
|
||||||
|
'$1N35056' ; Q9.1 R40.1 R41.2
|
||||||
|
'$1N35060' ; Q9.3 U19.20
|
||||||
|
'$1N35062' ; R26.2 U19.12
|
||||||
|
'$1N35065' ; R30.2 U19.13
|
||||||
|
'$1N35068' ; R25.2 U19.11
|
||||||
|
'$1N35087' ; LED1.1 Q8.3
|
||||||
|
'$1N35088' ; Q8.1 R15.1
|
||||||
|
'$1N35089' ; LED1.2 R18.2
|
||||||
|
'$1N35110' ; Q10.1 R34.2 R35.1
|
||||||
|
'$1N35118' ; Q14.1 R42.2 R43.1
|
||||||
|
'$1N35136' ; C43.2 Q13.1 R38.2
|
||||||
|
'$1N35141' ; C42.1 Q12.1 R37.1
|
||||||
|
'$1N35148' ; C6.1 C7.1 C8.1 C9.2 C10.2 C11.2 Q1.3 U19.45 U19.46
|
||||||
|
'$1N36133' ; LAN.2 U17.21
|
||||||
|
'$1N36222' ; C68.2 U17.33
|
||||||
|
'$1N36366' ; C59.1 L6.1 U17.1 U17.2
|
||||||
|
'$1N36373' ; C66.2 L6.2 U17.35
|
||||||
|
'$1N36810' ; C67.2 U17.32 U21.3
|
||||||
|
'$1N36815' ; C74.2 U17.31 U21.1
|
||||||
|
'$1N37705' ; Q18.1 U16.3
|
||||||
|
'$1N39412' ; C80.2 U20.30
|
||||||
|
'$1N45053' ; LAN.1 R62.2
|
||||||
|
'$1N46192' ; R60.1 U20.60
|
||||||
|
'$1N88506' ; D7.10 R69.1
|
||||||
|
'$1N88557' ; D7.11 R70.1
|
||||||
|
'$1N99689' ; RF1.1 U19.37
|
||||||
|
'4G/~LAN' ; R2.2 R58.1 R74.1 U20.61
|
||||||
|
'ADC_VBAT' ; C84.2 R71.1 R73.2 U20.15
|
||||||
|
'CAT1_NETSTATUS' ; R15.2 U19.17
|
||||||
|
'CAT1_PWRKEY' ; R35.2 U20.17
|
||||||
|
'CAT1_RESET' ; R43.2 U20.14
|
||||||
|
'CAT1_UART_RX' ; Q12.3 U19.18
|
||||||
|
'CAT1_UART_TX' ; Q13.2 U19.19
|
||||||
|
'CAT1_WAKEUP' ; R40.2 U20.16
|
||||||
|
'E32_INT' ; U12.20 U20.20
|
||||||
|
'E32_NRST' ; U12.21 U20.21
|
||||||
|
'E32_PXEN' ; U12.6 U20.26
|
||||||
|
'E32_TXEN' ; R75.2 U12.7 U20.27
|
||||||
|
'LORA_POWER' ; R55.1 U20.37
|
||||||
|
'MCU_SWCLK' ; CN2.3 U20.49
|
||||||
|
'MCU_SWDIO' ; CN2.4 U20.46
|
||||||
|
'NT26E_RX' ; Q13.3 R39.1 U22.1
|
||||||
|
'NT26E_TX' ; Q12.2 U23.1
|
||||||
|
'POWER_CONTROL' ; R45.1 U20.56
|
||||||
|
'RD-' ; D7.7 U17.12
|
||||||
|
'RD+' ; D7.6 U17.11
|
||||||
|
'RS485_1_A' ; D5.1 R49.1 R50.2 U9.1 U10.6
|
||||||
|
'RS485_1_B' ; D5.2 R47.2 R49.2 U9.2 U10.7
|
||||||
|
'RS485_1_CTRL' ; U10.2 U10.3 U20.38
|
||||||
|
'RS485_2_A' ; D6.1 R52.1 R54.2 U13.1 U14.6
|
||||||
|
'RS485_2_B' ; D6.2 R51.2 R52.2 U13.2 U14.7
|
||||||
|
'RS485_2_CTRL' ; U14.2 U14.3 U20.34
|
||||||
|
'SD1_CLK' ; CARD2.5 R65.1 U20.53
|
||||||
|
'SD1_CMD' ; CARD2.3 R66.1 U20.54
|
||||||
|
'SD1_DAT0' ; CARD2.7 R64.1 U20.39
|
||||||
|
'SD1_DAT1' ; CARD2.8 R63.1 U20.40
|
||||||
|
'SD1_DAT2' ; CARD2.1 R68.1 U20.42
|
||||||
|
'SD1_DAT3' ; CARD2.2 R67.1 U20.52
|
||||||
|
'SIM_CLK' ; C29.2 CARD1.3 D2.4 R30.1
|
||||||
|
'SIM_DATA' ; C31.2 CARD1.7 D2.6 R23.2 R25.1
|
||||||
|
'SIM_RST' ; C30.2 CARD1.2 D2.5 R26.1
|
||||||
|
'SIM_VDD' ; C32.1 C41.2 CARD1.1 CARD1.6 D2.3 R23.1 U19.15
|
||||||
|
'SPI1_MISO' ; U18.2 U20.9
|
||||||
|
'SPI1_MOSI' ; U18.5 U20.11
|
||||||
|
'SPI1_SCK' ; U18.6 U20.10
|
||||||
|
'SPI1_SS0' ; U18.1 U20.8
|
||||||
|
'SPI2_MISO' ; U12.22 U20.22
|
||||||
|
'SPI2_MOSI' ; U12.23 U20.23
|
||||||
|
'SPI2_SCK' ; U12.24 U20.24
|
||||||
|
'SPI2_SS0' ; U12.25 U20.25
|
||||||
|
'TD-' ; D7.2 U17.14
|
||||||
|
'TD+' ; D7.1 U17.13
|
||||||
|
'UART1_RX' ; CN2.6 CN3.3 U20.44
|
||||||
|
'UART1_TX' ; CN2.5 CN3.2 U20.45
|
||||||
|
'UART2_RX' ; U10.1 U20.43
|
||||||
|
'UART2_TX' ; U10.4 U20.41
|
||||||
|
'UART3_RX' ; U14.1 U20.35
|
||||||
|
'UART3_TX' ; U14.4 U20.33
|
||||||
|
'UART4_RX' ; U20.62 U22.4
|
||||||
|
'UART4_TX' ; U20.2 U23.4
|
||||||
|
'V_RS4851_5/12V' ; C20.2 C21.2 L2.2 R7.1 R9.2 U11.2
|
||||||
|
'V_RS4851_ON/~OFF' ; U3.4 U20.51
|
||||||
|
'V_RS4852_5/12V' ; C35.2 C36.2 L4.2 R27.1 R28.1 U15.2
|
||||||
|
'V_RS4852_ON/~OFF' ; U6.4 U20.28
|
||||||
|
'VCC_15V' ; C18.2 C19.2 C33.2 C34.2 C51.1 C52.2 D4.1 R46.2 U3.5 U6.5
|
||||||
|
'VCC_33' ; C60.1 C61.1 C69.2 D7.3 D7.5 D7.9 D7.12 Q18.3 R56.2 U17.3
|
||||||
|
'VCC_3V3' ; C42.2 C46.2 C47.2 C48.2 C53.2 C63.1 C64.1 C65.1 C71.1 C72.1 C75.1 ,
|
||||||
|
C76.1 C78.1 C79.2 C83.2 C85.2 C86.2 CARD2.4 CN2.7 Q17.2 R37.2 R39.2 ,
|
||||||
|
R50.1 R54.1 R57.2 R59.1 R60.2 R63.2 R64.2 R65.2 R66.2 R67.2 R68.2 ,
|
||||||
|
R72.1 U8.2 U8.4 U10.8 U14.8 U18.3 U18.7 U18.8 U20.13 U20.19 U20.32 ,
|
||||||
|
U20.48 U20.64 U22.5 U23.5
|
||||||
|
'VCC_3V8' ; C39.2 C40.2 Q1.2 Q15.2 R5.1 R18.1 R32.2 R53.1 U5.4
|
||||||
|
'VCC_5V' ; C22.1 C23.2 C37.2 C38.2 C44.2 C45.2 L3.2 R24.2 U5.1 U5.2 U8.3
|
||||||
|
'VCC_7V4' ; C1.2 C2.2 C26.2 C27.2 C49.1 C50.2 H4.3 L5.1 Q2.2 R29.2 U2.16 U7.4 ,
|
||||||
|
U7.5
|
||||||
|
'VDD_EXT' ; C28.2 C43.1 R38.1 U19.26
|
||||||
|
'XTAL_IN' ; C81.2 U20.5 X2.1
|
||||||
|
'XTAL_OUT' ; C82.2 U20.6 X2.3
|
||||||
|
'XTAL32_IN' ; C77.1 U20.4 X1.2
|
||||||
|
'XTAL32_OUT' ; C73.1 U20.3 X1.1
|
||||||
|
'YOXO_100MLINK' ; R69.2 U17.23
|
||||||
|
'YOXO_DEF' ; U17.22 U20.59
|
||||||
|
'YOXO_NRST' ; U17.25 U20.57
|
||||||
|
'YOXO_RX' ; U17.37 U22.3
|
||||||
|
'YOXO_TX' ; U17.36 U23.3
|
||||||
|
ACT ; R70.2 U17.27
|
||||||
|
CAT1PWRKEY ; Q10.3 U19.7
|
||||||
|
CAT1RESET ; Q14.3 U19.16
|
||||||
|
GND ; C1.1 C2.1 C3.1 C5.1 C6.2 C7.2 C8.2 C9.1 C10.1 C11.1 C12.1 C13.1 C14.1 ,
|
||||||
|
C15.1 C18.1 C19.1 C20.1 C21.1 C22.2 C23.1 C26.1 C27.1 C28.1 C29.1 ,
|
||||||
|
C30.1 C31.1 C32.2 C33.1 C34.1 C35.1 C36.1 C37.1 C38.1 C39.1 C40.1 ,
|
||||||
|
C41.1 C44.1 C45.1 C46.1 C47.1 C48.1 C49.2 C50.1 C51.2 C52.1 C53.1 ,
|
||||||
|
C54.1 C55.1 C56.1 C57.1 C58.1 C59.2 C60.2 C61.2 C62.1 C63.2 C64.2 ,
|
||||||
|
C65.2 C66.1 C67.1 C68.1 C69.1 C70.1 C71.2 C72.2 C73.2 C74.1 C75.2 ,
|
||||||
|
C76.2 C77.2 C78.2 C79.1 C80.1 C81.1 C82.1 C83.1 C84.1 C85.1 C86.1 ,
|
||||||
|
CARD1.5 CARD1.9 CARD1.10 CARD1.11 CARD2.6 CARD2.9 CARD2.10 CARD2.11 ,
|
||||||
|
CARD2.12 CN1.2 CN2.1 CN3.1 D1.2 D2.2 D3.2 D5.3 D6.3 H5.1 LORA.1 Q5.2 ,
|
||||||
|
Q8.2 Q9.2 Q10.2 Q11.2 Q14.2 Q19.2 R3.1 R6.1 R13.1 R14.1 R19.1 R21.1 ,
|
||||||
|
R22.1 R31.1 R33.2 R34.1 R36.1 R41.1 R42.1 R44.1 R47.1 R48.1 R51.1 ,
|
||||||
|
R56.1 R62.1 R73.1 R75.1 RF1.2 RF1.3 U1.1 U2.11 U2.12 U3.2 U4.6 U4.9 ,
|
||||||
|
U5.3 U5.6 U6.2 U7.2 U8.1 U10.5 U11.1 U12.1 U12.2 U12.3 U12.4 U12.5 ,
|
||||||
|
U12.11 U12.12 U12.17 U12.18 U12.26 U12.28 U14.5 U15.1 U16.2 U17.49 ,
|
||||||
|
U18.4 U19.1 U19.10 U19.29 U19.36 U19.39 U19.40 U19.43 U19.44 U19.50 ,
|
||||||
|
U19.51 U19.52 U19.53 U19.81 U19.82 U19.83 U19.85 U19.103 U19.107 ,
|
||||||
|
U19.108 U19.109 U19.110 U19.111 U19.112 U20.12 U20.18 U20.31 U20.47 ,
|
||||||
|
U20.63 U21.2 U21.4 U22.2 U23.2 X2.2 X2.4
|
||||||
|
LINK ; U17.28 U20.58
|
||||||
|
NRST ; C70.2 CN2.2 R59.2 U20.7
|
||||||
|
PGND ; D7.8 D7.13 D7.14
|
||||||
|
VBAT ; Q2.3 Q7.2 R71.2
|
||||||
|
$SCHEDULE
|
||||||
|
$END
|
||||||
Binary file not shown.
@@ -410,7 +410,7 @@
|
|||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>JL2CM3</Key>
|
<Key>JL2CM3</Key>
|
||||||
<Name>-U12345678 -O78 -S4 -ZTIFSpeedSel2000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8027 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD1FFF8000 -FC1000 -FN2 -FF0HC32F460_otp.FLM -FS03000C00 -FL03FC -FP0($$Device:HC32F460KETA$FlashARM\HC32F460_otp.FLM) -FF1HC32F460_512K.FLM -FS10 -FL180000 -FP1($$Device:HC32F460KETA$FlashARM\HC32F460_512K.FLM)</Name>
|
<Name>-U4294967295 -O78 -S4 -ZTIFSpeedSel2000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8027 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO14 -FD1FFF8000 -FC1000 -FN2 -FF0HC32F460_otp.FLM -FS03000C00 -FL03FC -FP0($$Device:HC32F460KETA$FlashARM\HC32F460_otp.FLM) -FF1HC32F460_512K.FLM -FS10 -FL180000 -FP1($$Device:HC32F460KETA$FlashARM\HC32F460_512K.FLM)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
@@ -428,12 +428,60 @@
|
|||||||
<Name></Name>
|
<Name></Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint>
|
||||||
|
<Bp>
|
||||||
|
<Number>0</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>1004</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>0</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>0</BreakIfRCount>
|
||||||
|
<Filename>..\source\User\Src\Public.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>1</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>1006</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>0</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>0</BreakIfRCount>
|
||||||
|
<Filename>..\source\User\Src\Public.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>GateWay,0x10</ItemText>
|
<ItemText>GateWay,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>1</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>EthStatus</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>2</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>EthRecvTimeoutCnt,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>3</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>(60 * 1000),0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<WatchWindow2>
|
<WatchWindow2>
|
||||||
@@ -465,7 +513,7 @@
|
|||||||
<DebugFlag>
|
<DebugFlag>
|
||||||
<trace>0</trace>
|
<trace>0</trace>
|
||||||
<periodic>1</periodic>
|
<periodic>1</periodic>
|
||||||
<aLwin>0</aLwin>
|
<aLwin>1</aLwin>
|
||||||
<aCover>0</aCover>
|
<aCover>0</aCover>
|
||||||
<aSer1>0</aSer1>
|
<aSer1>0</aSer1>
|
||||||
<aSer2>0</aSer2>
|
<aSer2>0</aSer2>
|
||||||
|
|||||||
Submodule Project/GateWay/source/Module/FatFS updated: d04067afda...1d10fbd56e
Submodule Project/GateWay/source/Module/GateWay_Debug updated: 28b612dd28...a57b9ddf31
Submodule Project/GateWay/source/Module/SDCard updated: d8ee1ba41e...1fa0c642ed
Submodule Project/GateWay/source/Module/sx127x updated: 149f38bf3f...a4dafc526f
@@ -14,6 +14,15 @@
|
|||||||
|
|
||||||
#define CAT_ONE_DELAY_1MS(X)
|
#define CAT_ONE_DELAY_1MS(X)
|
||||||
|
|
||||||
|
// ETH状态机相关宏定义
|
||||||
|
#define ETH_RESET_DELAY_TIME_MAX (5 * 60 * 1000)
|
||||||
|
#define ETH_LINK_WAIT_TIME_MAX (10 * 1000)
|
||||||
|
#define ETH_REG_TIMEOUT_MAX (30 * 1000)
|
||||||
|
#define ETH_SEND_TIMEOUT_MAX (5 * 1000)
|
||||||
|
#define ETH_RECV_TIMEOUT_MAX (60 * 1000)
|
||||||
|
#define ETH_SEND_RETRY_MAX 3
|
||||||
|
#define ETH_FIRST_REG_DELAY (5 * 1000)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CAT_ONE_AT_NULL,
|
CAT_ONE_AT_NULL,
|
||||||
CAT_ONE_AT, //开机检测
|
CAT_ONE_AT, //开机检测
|
||||||
@@ -49,6 +58,17 @@ typedef enum {
|
|||||||
CAT_ONE_CLOSE_TCP,
|
CAT_ONE_CLOSE_TCP,
|
||||||
}CatOneStatus_m;
|
}CatOneStatus_m;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ETH_IDEL,
|
||||||
|
ETH_RESET,
|
||||||
|
ETH_WAIT_LINK,
|
||||||
|
ETH_REG_SVR,
|
||||||
|
ETH_WAIT_SEND,
|
||||||
|
ETH_SEND_DATA,
|
||||||
|
ETH_WAIT_RECV,
|
||||||
|
ETH_OFF,
|
||||||
|
}EthStatus_m;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CAT_ONE_RET_NULL,
|
CAT_ONE_RET_NULL,
|
||||||
CAT_ONE_RET_OK,
|
CAT_ONE_RET_OK,
|
||||||
@@ -67,7 +87,7 @@ typedef enum {
|
|||||||
}CatOneNetType_m;
|
}CatOneNetType_m;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CatOneStatus_m Status;
|
CatOneStatus_m Cat1Status;
|
||||||
CatOneStatus_m NextStatus;
|
CatOneStatus_m NextStatus;
|
||||||
CatOneRetStatus_m ATCmdRet;
|
CatOneRetStatus_m ATCmdRet;
|
||||||
uint32_t CatOne1mSDelayCnt;
|
uint32_t CatOne1mSDelayCnt;
|
||||||
@@ -90,17 +110,30 @@ typedef struct {
|
|||||||
|
|
||||||
GateWayPara GateWay;
|
GateWayPara GateWay;
|
||||||
DataRevCallBack CatOneRevCallBack;
|
DataRevCallBack CatOneRevCallBack;
|
||||||
|
|
||||||
|
// ETH状态机相关字段
|
||||||
|
EthStatus_m EthStatus;
|
||||||
|
uint32_t EthResetDelayCnt;
|
||||||
|
uint32_t EthLinkWaitCnt;
|
||||||
|
uint32_t EthRecvTimeoutCnt;
|
||||||
|
uint8_t EthSendRetryCnt;
|
||||||
|
bool EthFirstRegFlag;
|
||||||
}CatOne_t, *pCatOne_t;
|
}CatOne_t, *pCatOne_t;
|
||||||
|
|
||||||
CatOneRetStatus_m CatOneSend(uint8_t *sData, uint16_t sLen);
|
CatOneRetStatus_m CatOneSend(uint8_t *sData, uint16_t sLen);
|
||||||
void CatOneStart(void);
|
void CatOneStart(void);
|
||||||
void CatOneStop(void);
|
void CatOneStop(void);
|
||||||
void CatOneReset(void);
|
void CatOneReset(void);
|
||||||
|
void ETHStop(void);
|
||||||
|
void ETHReset(void);
|
||||||
void Cat1DBGOnOff(bool OnOff);
|
void Cat1DBGOnOff(bool OnOff);
|
||||||
void CatOneGetLocationInfo(int *Longitude, int *Latitude);
|
void CatOneGetLocationInfo(int *Longitude, int *Latitude);
|
||||||
void CatOneGetIMEIAndSIM(char *Imei, char *Sim);
|
void CatOneGetIMEIAndSIM(char *Imei, char *Sim);
|
||||||
bool CatOneGetStatus(void);
|
bool CatOneGetStatus(void);
|
||||||
bool CatOneEthSendQueue(uint8_t *sData, uint16_t sLen);
|
bool CatOneEthSendQueue(uint8_t *sData, uint16_t sLen);
|
||||||
|
void CatOneTriggerRegister(void);
|
||||||
|
void ETHTriggerRegister(void);
|
||||||
|
void ETHApplyNetPara(void);
|
||||||
void CatOne_Eth_Thread_Entry(void *parameter);
|
void CatOne_Eth_Thread_Entry(void *parameter);
|
||||||
void EthRxOverhandler(void);
|
void EthRxOverhandler(void);
|
||||||
void CatReadImeiOrSim(char *Imei, char *Sim);
|
void CatReadImeiOrSim(char *Imei, char *Sim);
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ typedef enum {
|
|||||||
DEBUG_CH_RS485_2,
|
DEBUG_CH_RS485_2,
|
||||||
}DebugChannel_m;
|
}DebugChannel_m;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DEV_TYPE_BROADCAST,
|
DEV_TYPE_BROADCAST,
|
||||||
DEV_TYPE_INC_COMMUNIT = 0x8001,
|
DEV_TYPE_INC_COMMUNIT = 0x8001,
|
||||||
@@ -128,9 +127,11 @@ typedef struct {
|
|||||||
}__attribute__((packed))LaserTracingType_T;
|
}__attribute__((packed))LaserTracingType_T;
|
||||||
|
|
||||||
typedef struct {//0x0020 位移计
|
typedef struct {//0x0020 位移计
|
||||||
|
MasterDev_T MasterDev;
|
||||||
int16_t PitchAngle; //俯仰角偏斜(范围±900)单位0.1°
|
int16_t PitchAngle; //俯仰角偏斜(范围±900)单位0.1°
|
||||||
int16_t RollAngle; //横滚角偏斜(范围±900)单位0.1°
|
int16_t RollAngle; //横滚角偏斜(范围±900)单位0.1°
|
||||||
int16_t YawAngle; //偏航角偏斜(范围0~3600)单位0.1°
|
int16_t YawAngle; //偏航角偏斜(范围0~3600)单位0.1°
|
||||||
|
float Temp; //温度
|
||||||
float Altitude; //海拔()单位cm
|
float Altitude; //海拔()单位cm
|
||||||
int16_t Distance; //1轴应力值转位移(范围±300,单位0.1mm)
|
int16_t Distance; //1轴应力值转位移(范围±300,单位0.1mm)
|
||||||
}__attribute__ ((packed))Displacement_T,*DisplacementDp;
|
}__attribute__ ((packed))Displacement_T,*DisplacementDp;
|
||||||
@@ -212,7 +213,8 @@ typedef struct {
|
|||||||
uint8_t Power;
|
uint8_t Power;
|
||||||
uint32_t BaudRate;
|
uint32_t BaudRate;
|
||||||
SendData RS485Send;
|
SendData RS485Send;
|
||||||
CommUnit_t CUData;
|
CommUnit_t CUPara;
|
||||||
|
CommUnitData_t CUData;
|
||||||
}__attribute__((packed))RS485Para_t, *RS485Para;
|
}__attribute__((packed))RS485Para_t, *RS485Para;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -248,12 +250,41 @@ typedef struct {
|
|||||||
uint32_t FreqCent;
|
uint32_t FreqCent;
|
||||||
}LoraPara_t, *pLoraPara;
|
}LoraPara_t, *pLoraPara;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t DestAddr[4]; //目的服务器地址
|
||||||
|
uint16_t DestPort; //目的服务器端口
|
||||||
|
uint8_t LocalAddr[4]; //本地客户端地址(预留)
|
||||||
|
uint16_t LocalPort; //本地客户端端口(预留)
|
||||||
|
}LTENetPara_t, *pLTENetPara;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ETH_IP_DHCP, //动态IP
|
||||||
|
ETH_IP_STATIC, //静态IP
|
||||||
|
}EthIpMode_m;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ETH_MODE_TCP_CLIENT, //TCP客户端
|
||||||
|
ETH_MODE_TCP_SERVER, //TCP服务器
|
||||||
|
ETH_MODE_UDP, //UDP模式
|
||||||
|
}EthWorkMode_m;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EthIpMode_m IpMode; //IP模式:DHCP/静态
|
||||||
|
uint8_t IpAddr[4]; //本地IP地址
|
||||||
|
uint16_t IpPort; //本地端口
|
||||||
|
EthWorkMode_m WorkMode; //工作模式
|
||||||
|
uint8_t SubnetMask[4]; //子网掩码
|
||||||
|
uint8_t Gateway[4]; //网关
|
||||||
|
uint8_t DestIp[4]; //目的IP地址
|
||||||
|
uint16_t DestPort; //目的端口
|
||||||
|
}EthNetPara_t, *pEthNetPara;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t SavFlag; //存储标志
|
uint32_t SavFlag; //存储标志
|
||||||
CommType_m Comm; //网关通讯方式
|
CommType_m Comm; //网关通讯方式
|
||||||
uint8_t GwMac[6]; //网关mac
|
uint8_t GwMac[6]; //网关mac
|
||||||
char SvrAddr[4]; //服务器地址
|
LTENetPara_t LTENet; //Cat1/4G服务器参数
|
||||||
uint32_t SvrPort; //服务器端口
|
EthNetPara_t EthNet; //以太网网络参数
|
||||||
uint32_t CommUnitReadInterval; //通讯单元读取时间间隔,单位S
|
uint32_t CommUnitReadInterval; //通讯单元读取时间间隔,单位S
|
||||||
CommUnitPara_t CommUnitArray[COMMUNIT_NUM_MAX]; //注册的通讯单元信息
|
CommUnitPara_t CommUnitArray[COMMUNIT_NUM_MAX]; //注册的通讯单元信息
|
||||||
ExclCommUnit_t ExclCommUnit[COMMUNIT_NUM_MAX]; //排除的通讯单元信息
|
ExclCommUnit_t ExclCommUnit[COMMUNIT_NUM_MAX]; //排除的通讯单元信息
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
#include "rtthread.h"
|
#include "rtthread.h"
|
||||||
#include "ff.h"
|
#include "ff.h"
|
||||||
|
|
||||||
|
#define SOFTWARE_VERSION 10
|
||||||
|
#define HARDWARE_VERSION 12
|
||||||
|
|
||||||
//#define USE_BOOTLOADER
|
//#define USE_BOOTLOADER
|
||||||
|
|
||||||
//#define FLASH_SECTOR_SIZE 0x2000ul
|
//#define FLASH_SECTOR_SIZE 0x2000ul
|
||||||
@@ -164,8 +167,14 @@
|
|||||||
|
|
||||||
#define ETH_OR_CAT1_CTRL_PORT (PortB)
|
#define ETH_OR_CAT1_CTRL_PORT (PortB)
|
||||||
#define ETH_OR_CAT1_CTRL_PIN (Pin08)
|
#define ETH_OR_CAT1_CTRL_PIN (Pin08)
|
||||||
|
|
||||||
|
#if (HARDWARE_VERSION == 12)
|
||||||
#define ETH_ON() PORT_SetBits(ETH_OR_CAT1_CTRL_PORT, ETH_OR_CAT1_CTRL_PIN)
|
#define ETH_ON() PORT_SetBits(ETH_OR_CAT1_CTRL_PORT, ETH_OR_CAT1_CTRL_PIN)
|
||||||
#define CAT1_ON() PORT_ResetBits(ETH_OR_CAT1_CTRL_PORT, ETH_OR_CAT1_CTRL_PIN)
|
#define CAT1_ON() PORT_ResetBits(ETH_OR_CAT1_CTRL_PORT, ETH_OR_CAT1_CTRL_PIN)
|
||||||
|
#elif (HARDWARE_VERSION >= 13)
|
||||||
|
#define ETH_ON() PORT_ResetBits(ETH_OR_CAT1_CTRL_PORT, ETH_OR_CAT1_CTRL_PIN)
|
||||||
|
#define CAT1_ON() PORT_SetBits(ETH_OR_CAT1_CTRL_PORT, ETH_OR_CAT1_CTRL_PIN)
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define ETH_OR_CAT1_TX_CTRL_PORT (PortH)
|
//#define ETH_OR_CAT1_TX_CTRL_PORT (PortH)
|
||||||
//#define ETH_OR_CAT1_TX_CTRL_PIN (Pin02)
|
//#define ETH_OR_CAT1_TX_CTRL_PIN (Pin02)
|
||||||
@@ -182,11 +191,6 @@
|
|||||||
#define CAT1_RESET_CLR() PORT_SetBits(CAT1_RESET_PORT, CAT1_RESET_PIN)
|
#define CAT1_RESET_CLR() PORT_SetBits(CAT1_RESET_PORT, CAT1_RESET_PIN)
|
||||||
#define CAT1_RESET_SET() PORT_ResetBits(CAT1_RESET_PORT, CAT1_RESET_PIN)
|
#define CAT1_RESET_SET() PORT_ResetBits(CAT1_RESET_PORT, CAT1_RESET_PIN)
|
||||||
|
|
||||||
//#define CAT1_POW_PORT (PortA)
|
|
||||||
//#define CAT1_POW_PIN (Pin00)
|
|
||||||
//#define CAT1_POW_ON() PORT_SetBits(CAT1_POW_PORT, CAT1_POW_PIN)
|
|
||||||
//#define CAT1_POW_OFF() PORT_ResetBits(CAT1_POW_PORT, CAT1_POW_PIN)
|
|
||||||
|
|
||||||
#define ETH_RESET_PORT (PortB)
|
#define ETH_RESET_PORT (PortB)
|
||||||
#define ETH_RESET_PIN (Pin05)
|
#define ETH_RESET_PIN (Pin05)
|
||||||
#define ETH_RESET_SET() PORT_SetBits(ETH_RESET_PORT, ETH_RESET_PIN)
|
#define ETH_RESET_SET() PORT_SetBits(ETH_RESET_PORT, ETH_RESET_PIN)
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
#include "Public.h"
|
#include "Public.h"
|
||||||
#include "DebugCmd.h"
|
#include "DebugCmd.h"
|
||||||
|
|
||||||
#define SOFTWARE_VERSION 12
|
#define MAC_ADDR_TYPE 0//0为测试服务器
|
||||||
#define HARDWARE_VERSION 12
|
|
||||||
|
|
||||||
#define MAC_ADDR_TYPE 4//0为测试服务器
|
|
||||||
|
|
||||||
extern bool MainDispEn;
|
extern bool MainDispEn;
|
||||||
#define MAIN_DBG_LOG(...) { if(MainDispEn) Debug_Printf(__VA_ARGS__);}
|
#define MAIN_DBG_LOG(...) { if(MainDispEn) Debug_Printf(__VA_ARGS__);}
|
||||||
|
|||||||
@@ -23,11 +23,33 @@ static uint8_t EthRevTimeOutCnt;
|
|||||||
|
|
||||||
static uint16_t CatSendErrCnt = 0;
|
static uint16_t CatSendErrCnt = 0;
|
||||||
|
|
||||||
|
// ETH状态机相关变量已移至 CatOne_t 结构体中
|
||||||
|
|
||||||
#define CAT1_DBG_LOG(...) { if(CAT1DispEn) Debug_Printf(__VA_ARGS__);}
|
#define CAT1_DBG_LOG(...) { if(CAT1DispEn) Debug_Printf(__VA_ARGS__);}
|
||||||
//#define CAT1_DBG_ARRAY(ARRAY, SIZE) { if(CAT1DispEn) {DBG_ARRAY(ARRAY,SIZE)}}
|
//#define CAT1_DBG_ARRAY(ARRAY, SIZE) { if(CAT1DispEn) {DBG_ARRAY(ARRAY,SIZE)}}
|
||||||
|
|
||||||
#define CATONE_RESET_DELAY_TIME_MAX (5 * 60 * 1000)
|
#define CATONE_RESET_DELAY_TIME_MAX (5 * 60 * 1000)
|
||||||
|
|
||||||
|
//const char *CatOneATCmdStr[16] = {
|
||||||
|
// "NULL",
|
||||||
|
// "AT\r\n", //开机检测
|
||||||
|
// "ATE0\r\n", //关回显
|
||||||
|
// "AT+CPIN?\r\n", //识卡
|
||||||
|
//// "AT+CIMI\r\n", //IMEI
|
||||||
|
// "AT+CGSN=1\r\n",
|
||||||
|
// "AT+LCCID\r\n", //读卡号
|
||||||
|
// "AT+CEREG?\r\n", //查询注册状态
|
||||||
|
// "AT+CGPADDR=1\r\n", //查询IP地址
|
||||||
|
// "AT+CSQ\r\n", //查询信号强度
|
||||||
|
// "AT+LDNSGIP=gxjt.cui635.cn\r\n",
|
||||||
|
// "AT+LBS=0\r\n", //获取基站定位信息
|
||||||
|
// "AT+LIPOPEN=", //设置TCP服务器地址和端口,AT+LIPOPEN="TCP","114.55.52.96",6803
|
||||||
|
// "AT+LIPSEND=", //发送数据, AT+LIPSEND=0,1,20,"31313131313131323232323232"
|
||||||
|
// "AT+LIPCLOSE=0\r\n",//断开连接
|
||||||
|
// "AT+LBSPARA=http://locator-aep.xiot.senthink.com:80/locator/v0.1/locate,B84E427D95B1DF4A3F49B18DDF714C72\r\n",
|
||||||
|
// "AT+CCLK?\r\n", //获取时间
|
||||||
|
//};
|
||||||
|
|
||||||
const char *CatOneATCmdStr[16] = {
|
const char *CatOneATCmdStr[16] = {
|
||||||
"NULL",
|
"NULL",
|
||||||
"AT\r\n", //开机检测
|
"AT\r\n", //开机检测
|
||||||
@@ -35,17 +57,18 @@ const char *CatOneATCmdStr[16] = {
|
|||||||
"AT+CPIN?\r\n", //识卡
|
"AT+CPIN?\r\n", //识卡
|
||||||
// "AT+CIMI\r\n", //IMEI
|
// "AT+CIMI\r\n", //IMEI
|
||||||
"AT+CGSN=1\r\n",
|
"AT+CGSN=1\r\n",
|
||||||
"AT+LCCID\r\n", //读卡号
|
"AT+QCCID\r\n", //读卡号
|
||||||
"AT+CEREG?\r\n", //查询注册状态
|
"AT+CEREG?\r\n", //查询注册状态
|
||||||
"AT+CGPADDR=1\r\n", //查询IP地址
|
"AT+CGPADDR=1\r\n", //查询IP地址
|
||||||
"AT+CSQ\r\n", //查询信号强度
|
"AT+CSQ\r\n", //查询信号强度
|
||||||
"AT+LDNSGIP=gxjt.cui635.cn\r\n",
|
"AT+LDNSGIP=gxjt.cui635.cn\r\n",
|
||||||
"AT+LBS=0\r\n", //获取基站定位信息
|
"AT+QLBS\r\n", //获取基站定位信息
|
||||||
"AT+LIPOPEN=", //设置TCP服务器地址和端口,AT+LIPOPEN="TCP","114.55.52.96",6803
|
"AT+QIOPEN=", //设置TCP服务器地址和端口,AT+LIPOPEN="TCP","114.55.52.96",6803
|
||||||
"AT+LIPSEND=", //发送数据, AT+LIPSEND=0,1,20,"31313131313131323232323232"
|
"AT+QISEND=", //发送数据, AT+LIPSEND=0,1,20,"31313131313131323232323232"
|
||||||
"AT+LIPCLOSE=0\r\n",//断开连接
|
"AT+QICLOSE=0\r\n",//断开连接
|
||||||
"AT+LBSPARA=http://locator-aep.xiot.senthink.com:80/locator/v0.1/locate,B84E427D95B1DF4A3F49B18DDF714C72\r\n",
|
"AT+QLBSCFG=\"server\",http://locator-aep.xiot.senthink.com:80/locator/v0.1/locate\r\n",
|
||||||
"AT+CCLK?\r\n", //获取时间
|
"AT+QLBSCFG=\"token\",45B516D3078467E84DD2CFBF3532A4CB\r\n",
|
||||||
|
"AT+CCLK?\r\n", //获取时间
|
||||||
};
|
};
|
||||||
|
|
||||||
void Cat1DBGOnOff(bool OnOff)
|
void Cat1DBGOnOff(bool OnOff)
|
||||||
@@ -77,10 +100,10 @@ const CatOneATCMD_m CatOneModeSetCmdArray[] = {
|
|||||||
//{
|
//{
|
||||||
// rt_err_t result;
|
// rt_err_t result;
|
||||||
//
|
//
|
||||||
// if(CatOne.Status != CAT_ONE_IDEL && CatOne.Status != CAT_ONE_WAIT_SEND)
|
// if(CatOne.Cat1Status != CAT_ONE_IDEL && CatOne.Cat1Status != CAT_ONE_WAIT_SEND)
|
||||||
// return CAT_ONE_RET_ERR;
|
// return CAT_ONE_RET_ERR;
|
||||||
//
|
//
|
||||||
// //CatOne.Status = CAT_ONE_RESET;
|
// //CatOne.Cat1Status = CAT_ONE_RESET;
|
||||||
// result = rt_mq_send(CatOneRev_MQ, sData, sLen);
|
// result = rt_mq_send(CatOneRev_MQ, sData, sLen);
|
||||||
// if(result != RT_EOK) {
|
// if(result != RT_EOK) {
|
||||||
// CAT1_DBG_LOG("CatOne MQ Send ERR...\r\n");
|
// CAT1_DBG_LOG("CatOne MQ Send ERR...\r\n");
|
||||||
@@ -92,7 +115,17 @@ const CatOneATCMD_m CatOneModeSetCmdArray[] = {
|
|||||||
|
|
||||||
void CatOneStop(void)
|
void CatOneStop(void)
|
||||||
{
|
{
|
||||||
CatOne.Status = CAT_ONE_OFF;
|
CatOne.Cat1Status = CAT_ONE_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETHStop(void)
|
||||||
|
{
|
||||||
|
CatOne.EthStatus = ETH_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETHReset(void)
|
||||||
|
{
|
||||||
|
CatOne.EthStatus = ETH_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CatOneGetLocationInfo(int *Longitude, int *Latitude)
|
void CatOneGetLocationInfo(int *Longitude, int *Latitude)
|
||||||
@@ -116,14 +149,14 @@ void CatOneGetIMEIAndSIM(char *Imei, char *Sim)
|
|||||||
//返回true-busy, false-Idle
|
//返回true-busy, false-Idle
|
||||||
bool CatOneGetStatus(void)
|
bool CatOneGetStatus(void)
|
||||||
{
|
{
|
||||||
if(CatOne.Status == CAT_ONE_IDEL)
|
if(CatOne.Cat1Status == CAT_ONE_IDEL)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CatOneReset(void)
|
void CatOneReset(void)
|
||||||
{
|
{
|
||||||
CatOne.Status = CAT_ONE_RESET;
|
CatOne.Cat1Status = CAT_ONE_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CatTimeSync(char *Data)
|
void CatTimeSync(char *Data)
|
||||||
@@ -213,22 +246,22 @@ void CatOneAtCmdAnalyze(char *RxBuff)
|
|||||||
if(strstr(RxBuff, "OK") == NULL) {
|
if(strstr(RxBuff, "OK") == NULL) {
|
||||||
CatOne.ATCmdRet = CAT_ONE_RET_ERR;
|
CatOne.ATCmdRet = CAT_ONE_RET_ERR;
|
||||||
}
|
}
|
||||||
p = strstr(RxBuff, "+LCCID");
|
p = strstr(RxBuff, "+QCCID");
|
||||||
if(p == NULL) {
|
if(p == NULL) {
|
||||||
CatOne.ATCmdRet = CAT_ONE_RET_ERR;
|
CatOne.ATCmdRet = CAT_ONE_RET_ERR;
|
||||||
}
|
}
|
||||||
memset(CatOne.SIM, 0, 32);
|
memset(CatOne.SIM, 0, 32);
|
||||||
ret = sscanf(p, "+LCCID: %s\r\n", CatOne.SIM);
|
ret = sscanf(p, "+QCCID: %s\r\n", CatOne.SIM);
|
||||||
if(ret != 1) {
|
if(ret != 1) {
|
||||||
memset(CatOne.SIM, 0, 32);
|
memset(CatOne.SIM, 0, 32);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAT_ONE_LBS:
|
case CAT_ONE_LBS:
|
||||||
p = strstr(RxBuff, "+LBS");
|
p = strstr(RxBuff, "+QLBS");
|
||||||
if(p != NULL) {
|
if(p != NULL) {
|
||||||
double Longitude, Latitude;
|
double Longitude, Latitude;
|
||||||
int ret = sscanf(p, "+LBS: %lf,%lf\r\n", &Longitude, &Latitude);
|
int ret = sscanf(p, "+QLBS: %lf,%lf\r\n", &Longitude, &Latitude);
|
||||||
if(ret == 2) {
|
if(ret == 2) {
|
||||||
CatOne.LBSFlag = true;
|
CatOne.LBSFlag = true;
|
||||||
CatOne.Longitude = Longitude * 100000;
|
CatOne.Longitude = Longitude * 100000;
|
||||||
@@ -239,7 +272,7 @@ void CatOneAtCmdAnalyze(char *RxBuff)
|
|||||||
|
|
||||||
case CAT_ONE_LIPOPEN:
|
case CAT_ONE_LIPOPEN:
|
||||||
if(strstr(RxBuff, "OK") != NULL) {
|
if(strstr(RxBuff, "OK") != NULL) {
|
||||||
CatOne.Status = CatOne.NextStatus;
|
CatOne.Cat1Status = CatOne.NextStatus;
|
||||||
CatOne.CatOne1mSDelayCnt = 10 * 1000;
|
CatOne.CatOne1mSDelayCnt = 10 * 1000;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -247,13 +280,13 @@ void CatOneAtCmdAnalyze(char *RxBuff)
|
|||||||
if(strstr(RxBuff, "LIPOPEN: 0,1") != NULL) {
|
if(strstr(RxBuff, "LIPOPEN: 0,1") != NULL) {
|
||||||
CAT1_DBG_LOG("Cat1 successfully to connect to the server.\r\n\r\n");
|
CAT1_DBG_LOG("Cat1 successfully to connect to the server.\r\n\r\n");
|
||||||
CatOne.TcpConnFlag = true;
|
CatOne.TcpConnFlag = true;
|
||||||
CatOne.Status = CatOne.NextStatus;
|
CatOne.Cat1Status = CatOne.NextStatus;
|
||||||
rt_sem_release(CatOneRev_Sem);
|
rt_sem_release(CatOneRev_Sem);
|
||||||
}
|
}
|
||||||
else if(strstr(RxBuff, "LIPOPEN: 0,0") != NULL) {
|
else if(strstr(RxBuff, "LIPOPEN: 0,0") != NULL) {
|
||||||
CAT1_DBG_LOG("Cat1 failed to connect to the server.\r\n\r\n");
|
CAT1_DBG_LOG("Cat1 failed to connect to the server.\r\n\r\n");
|
||||||
CatOne.TcpConnFlag = false;
|
CatOne.TcpConnFlag = false;
|
||||||
CatOne.Status = CAT_ONE_OFF;
|
CatOne.Cat1Status = CAT_ONE_OFF;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -305,7 +338,7 @@ void CatOneAtCmdAnalyze(char *RxBuff)
|
|||||||
if(strstr(p, "+LIPURC: 0,0") != NULL) {
|
if(strstr(p, "+LIPURC: 0,0") != NULL) {
|
||||||
CAT1_DBG_LOG("TCP connection disconnected.\r\n\r\n");
|
CAT1_DBG_LOG("TCP connection disconnected.\r\n\r\n");
|
||||||
CatOne.TcpConnFlag = false;
|
CatOne.TcpConnFlag = false;
|
||||||
CatOne.Status = CAT_ONE_OFF;
|
CatOne.Cat1Status = CAT_ONE_OFF;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +354,7 @@ void CatOneAtCmdAnalyze(char *RxBuff)
|
|||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//CatOne.Status = CAT_ONE_CLOSE_TCP;
|
//CatOne.Cat1Status = CAT_ONE_CLOSE_TCP;
|
||||||
rt_sem_release(CatOneRev_Sem);//接收任务
|
rt_sem_release(CatOneRev_Sem);//接收任务
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -330,7 +363,7 @@ void CatOneAtCmdAnalyze(char *RxBuff)
|
|||||||
|
|
||||||
}
|
}
|
||||||
if(CatOne.ATCmdRet == CAT_ONE_RET_OK) {
|
if(CatOne.ATCmdRet == CAT_ONE_RET_OK) {
|
||||||
CatOne.Status = CatOne.NextStatus;
|
CatOne.Cat1Status = CatOne.NextStatus;
|
||||||
if(CatOne.AtCmd == CAT_ONE_LIPSEND)
|
if(CatOne.AtCmd == CAT_ONE_LIPSEND)
|
||||||
CatOne.CatOne1mSDelayCnt = 5 * 1000;
|
CatOne.CatOne1mSDelayCnt = 5 * 1000;
|
||||||
else
|
else
|
||||||
@@ -350,11 +383,11 @@ void CatOneAtCmdSend(CatOneATCMD_m Cmd, uint32_t Dly, CatOneStatus_m NextStatus)
|
|||||||
}
|
}
|
||||||
else if(CatOne.AtCmd == CAT_ONE_LIPOPEN) {
|
else if(CatOne.AtCmd == CAT_ONE_LIPOPEN) {
|
||||||
sprintf(CatOne.CatOneSendBuff,"AT+LIPOPEN=\"TCP\",\"%d.%d.%d.%d\",%d\r\n",
|
sprintf(CatOne.CatOneSendBuff,"AT+LIPOPEN=\"TCP\",\"%d.%d.%d.%d\",%d\r\n",
|
||||||
CatOne.GateWay->ConfigPara.SvrAddr[0],
|
CatOne.GateWay->ConfigPara.LTENet.DestAddr[0],
|
||||||
CatOne.GateWay->ConfigPara.SvrAddr[1],
|
CatOne.GateWay->ConfigPara.LTENet.DestAddr[1],
|
||||||
CatOne.GateWay->ConfigPara.SvrAddr[2],
|
CatOne.GateWay->ConfigPara.LTENet.DestAddr[2],
|
||||||
CatOne.GateWay->ConfigPara.SvrAddr[3],
|
CatOne.GateWay->ConfigPara.LTENet.DestAddr[3],
|
||||||
CatOne.GateWay->ConfigPara.SvrPort);
|
CatOne.GateWay->ConfigPara.LTENet.DestPort);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strcpy(CatOne.CatOneSendBuff, CatOneATCmdStr[CatOne.AtCmd]);
|
strcpy(CatOne.CatOneSendBuff, CatOneATCmdStr[CatOne.AtCmd]);
|
||||||
@@ -363,7 +396,7 @@ void CatOneAtCmdSend(CatOneATCMD_m Cmd, uint32_t Dly, CatOneStatus_m NextStatus)
|
|||||||
EthRevTimeOutCnt = 0;
|
EthRevTimeOutCnt = 0;
|
||||||
EthOrCat1UartSend((uint8_t *)CatOne.CatOneSendBuff, strlen(CatOne.CatOneSendBuff));
|
EthOrCat1UartSend((uint8_t *)CatOne.CatOneSendBuff, strlen(CatOne.CatOneSendBuff));
|
||||||
CatOne.CatOne1mSDelayCnt = Dly;
|
CatOne.CatOne1mSDelayCnt = Dly;
|
||||||
CatOne.Status = CAT_ONE_WAIT_REV;
|
CatOne.Cat1Status = CAT_ONE_WAIT_REV;
|
||||||
CatOne.NextStatus = NextStatus;
|
CatOne.NextStatus = NextStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,12 +408,12 @@ int GateWayRegister(uint8_t *TxBuff)
|
|||||||
|
|
||||||
if(CatOne.GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true && CatOne.GateWay->ConfigPara.Rs485Ch1.Enable == true) {
|
if(CatOne.GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true && CatOne.GateWay->ConfigPara.Rs485Ch1.Enable == true) {
|
||||||
UnitCommCnt++;
|
UnitCommCnt++;
|
||||||
memcpy(&p[len], CatOne.GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0], 6);
|
memcpy(&p[len], CatOne.GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0], 6);
|
||||||
len += 6;
|
len += 6;
|
||||||
}
|
}
|
||||||
if(CatOne.GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true && CatOne.GateWay->ConfigPara.Rs485Ch2.Enable == true) {
|
if(CatOne.GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true && CatOne.GateWay->ConfigPara.Rs485Ch2.Enable == true) {
|
||||||
UnitCommCnt++;
|
UnitCommCnt++;
|
||||||
memcpy(&p[len], CatOne.GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0], 6);
|
memcpy(&p[len], CatOne.GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0], 6);
|
||||||
len += 6;
|
len += 6;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < COMMUNIT_NUM_MAX; i++) {
|
for(int i = 0; i < COMMUNIT_NUM_MAX; i++) {
|
||||||
@@ -407,14 +440,14 @@ void CatOneLoopHandler(void)
|
|||||||
uint16_t ret;
|
uint16_t ret;
|
||||||
static uint8_t Cat1RevErrCnt = 0;
|
static uint8_t Cat1RevErrCnt = 0;
|
||||||
|
|
||||||
switch(CatOne.Status){
|
switch(CatOne.Cat1Status){
|
||||||
case CAT_ONE_IDEL:
|
case CAT_ONE_IDEL:
|
||||||
rt_thread_delay(1);
|
rt_thread_delay(1);
|
||||||
if(CatOne.ResetDelayCnt > 0) {
|
if(CatOne.ResetDelayCnt > 0) {
|
||||||
CatOne.ResetDelayCnt--;
|
CatOne.ResetDelayCnt--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CatOne.Status = CAT_ONE_RESET;
|
CatOne.Cat1Status = CAT_ONE_RESET;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -429,9 +462,9 @@ void CatOneLoopHandler(void)
|
|||||||
else { //3次错误,关机
|
else { //3次错误,关机
|
||||||
CAT1_DBG_LOG("Cat1 error, Close!\r\n");
|
CAT1_DBG_LOG("Cat1 error, Close!\r\n");
|
||||||
if(CatOne.AtCmd == CAT_ONE_LIPSEND)
|
if(CatOne.AtCmd == CAT_ONE_LIPSEND)
|
||||||
CatOne.Status = CAT_ONE_CLOSE_TCP;
|
CatOne.Cat1Status = CAT_ONE_CLOSE_TCP;
|
||||||
else
|
else
|
||||||
CatOne.Status = CAT_ONE_OFF;
|
CatOne.Cat1Status = CAT_ONE_OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -446,7 +479,7 @@ void CatOneLoopHandler(void)
|
|||||||
CatOneAtCmdSend(CatOneModeSetCmdArray[CatOne.AtCmdIdx], 1000, CAT_ONE_INIT);
|
CatOneAtCmdSend(CatOneModeSetCmdArray[CatOne.AtCmdIdx], 1000, CAT_ONE_INIT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CatOne.Status = CAT_ONE_TCP_CONN;
|
CatOne.Cat1Status = CAT_ONE_TCP_CONN;
|
||||||
CatOne.CatOne1mSDelayCnt = 0;
|
CatOne.CatOne1mSDelayCnt = 0;
|
||||||
CatOne.AtCmdIdx = 0;
|
CatOne.AtCmdIdx = 0;
|
||||||
CatOne.AtCmd = CAT_ONE_AT_NULL;
|
CatOne.AtCmd = CAT_ONE_AT_NULL;
|
||||||
@@ -460,39 +493,39 @@ void CatOneLoopHandler(void)
|
|||||||
case CAT_ONE_WAIT_CONN:
|
case CAT_ONE_WAIT_CONN:
|
||||||
if(CatOne.TcpConnFlag) {
|
if(CatOne.TcpConnFlag) {
|
||||||
if(CatOne.GateWay->SvrRegFlag == false)
|
if(CatOne.GateWay->SvrRegFlag == false)
|
||||||
CatOne.Status = CAT_ONE_REG_SVR;
|
CatOne.Cat1Status = CAT_ONE_REG_SVR;
|
||||||
else
|
else
|
||||||
CatOne.Status = CAT_ONE_WAIT_SEND;
|
CatOne.Cat1Status = CAT_ONE_WAIT_SEND;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAT_ONE_REG_SVR: //注册服务器
|
case CAT_ONE_REG_SVR: //注册服务器
|
||||||
ret = GateWayRegister(CatOneEthTxBuff);
|
ret = GateWayRegister(CatOneEthTxBuff);
|
||||||
rt_mq_send(CatOne.GateWay->NetSendData_MQ, CatOneEthTxBuff, ret);
|
rt_mq_send(CatOne.GateWay->NetSendData_MQ, CatOneEthTxBuff, ret);
|
||||||
CatOne.Status = CAT_ONE_WAIT_SEND;
|
CatOne.Cat1Status = CAT_ONE_WAIT_SEND;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAT_ONE_WAIT_SEND:
|
case CAT_ONE_WAIT_SEND:
|
||||||
result = rt_mq_recv(CatOne.GateWay->NetSendData_MQ, Payload, CAT_ONE_REV_LEN_MAX, 1000);
|
result = rt_mq_recv(CatOne.GateWay->NetSendData_MQ, Payload, CAT_ONE_REV_LEN_MAX, 1000);
|
||||||
if(result == RT_EOK) {
|
if(result == RT_EOK) {
|
||||||
CatOneEthTxLen = NetCommOrgData(CatOne.GateWay, Payload, CatOneEthTxBuff);
|
CatOneEthTxLen = NetCommOrgData(CatOne.GateWay, Payload, CatOneEthTxBuff);
|
||||||
CatOne.Status = CAT_ONE_SEND_DATA;
|
CatOne.Cat1Status = CAT_ONE_SEND_DATA;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(CatOne.Status == CAT_ONE_RESET || CatOne.Status == CAT_ONE_OFF) //外部命令执行,状态改变
|
if(CatOne.Cat1Status == CAT_ONE_RESET || CatOne.Cat1Status == CAT_ONE_OFF) //外部命令执行,状态改变
|
||||||
return;
|
return;
|
||||||
if(!CatOne.TcpConnFlag) {
|
if(!CatOne.TcpConnFlag) {
|
||||||
CatOne.Status = CAT_ONE_OFF;
|
CatOne.Cat1Status = CAT_ONE_OFF;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CatSendErrCnt++;
|
CatSendErrCnt++;
|
||||||
if(CatSendErrCnt > CAT1_ERR_RESET_DLY_MAX) {
|
if(CatSendErrCnt > CAT1_ERR_RESET_DLY_MAX) {
|
||||||
CatOne.Status = CAT_ONE_RESET;
|
CatOne.Cat1Status = CAT_ONE_RESET;
|
||||||
CAT1_DBG_LOG("Cat1 has no data for a long time, Reset!\r\n");
|
CAT1_DBG_LOG("Cat1 has no data for a long time, Reset!\r\n");
|
||||||
CatSendErrCnt = 0;
|
CatSendErrCnt = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CatOne.Status = CAT_ONE_WAIT_SEND;
|
CatOne.Cat1Status = CAT_ONE_WAIT_SEND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -501,7 +534,7 @@ void CatOneLoopHandler(void)
|
|||||||
CatOne.AtCmdResendCnt = 3;
|
CatOne.AtCmdResendCnt = 3;
|
||||||
Cat1RevErrCnt++;
|
Cat1RevErrCnt++;
|
||||||
if(Cat1RevErrCnt > 10) {
|
if(Cat1RevErrCnt > 10) {
|
||||||
CatOne.Status = CAT_ONE_RESET;
|
CatOne.Cat1Status = CAT_ONE_RESET;
|
||||||
CAT1_DBG_LOG("Cat1 has no receive data for a long time, Reset!\r\n");
|
CAT1_DBG_LOG("Cat1 has no receive data for a long time, Reset!\r\n");
|
||||||
Cat1RevErrCnt = 0;
|
Cat1RevErrCnt = 0;
|
||||||
break;
|
break;
|
||||||
@@ -521,9 +554,9 @@ void CatOneLoopHandler(void)
|
|||||||
Cat1RevErrCnt = 0;
|
Cat1RevErrCnt = 0;
|
||||||
}
|
}
|
||||||
if(CatOne.GateWay->SvrRegFlag == false) //设备没注册,关闭4G,等待下一次重新注册
|
if(CatOne.GateWay->SvrRegFlag == false) //设备没注册,关闭4G,等待下一次重新注册
|
||||||
CatOne.Status = CAT_ONE_OFF;
|
CatOne.Cat1Status = CAT_ONE_OFF;
|
||||||
else
|
else
|
||||||
CatOne.Status = CAT_ONE_WAIT_SEND;
|
CatOne.Cat1Status = CAT_ONE_WAIT_SEND;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAT_ONE_CLOSE_TCP:
|
case CAT_ONE_CLOSE_TCP:
|
||||||
@@ -539,7 +572,7 @@ void CatOneLoopHandler(void)
|
|||||||
CAT1_PWR_KEY_SET();
|
CAT1_PWR_KEY_SET();
|
||||||
CatSendErrCnt = 0;
|
CatSendErrCnt = 0;
|
||||||
CAT1_DBG_LOG("Cat1 Power Off!\r\n");
|
CAT1_DBG_LOG("Cat1 Power Off!\r\n");
|
||||||
CatOne.Status = CAT_ONE_IDEL;
|
CatOne.Cat1Status = CAT_ONE_IDEL;
|
||||||
CatOne.ResetDelayCnt = CATONE_RESET_DELAY_TIME_MAX;
|
CatOne.ResetDelayCnt = CATONE_RESET_DELAY_TIME_MAX;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -554,7 +587,7 @@ void CatOneLoopHandler(void)
|
|||||||
CAT1_PWR_KEY_CLR();
|
CAT1_PWR_KEY_CLR();
|
||||||
rt_thread_delay(1000);
|
rt_thread_delay(1000);
|
||||||
CAT1_PWR_KEY_SET();
|
CAT1_PWR_KEY_SET();
|
||||||
CatOne.Status = CAT_ONE_INIT;
|
CatOne.Cat1Status = CAT_ONE_INIT;
|
||||||
CatOne.AtCmdIdx = 0;
|
CatOne.AtCmdIdx = 0;
|
||||||
rt_thread_delay(1000);
|
rt_thread_delay(1000);
|
||||||
CatOne.GateWay->BatteryReadDlyCnt = 60;
|
CatOne.GateWay->BatteryReadDlyCnt = 60;
|
||||||
@@ -566,27 +599,150 @@ void EthLoopHandler(void)
|
|||||||
{
|
{
|
||||||
rt_err_t result;
|
rt_err_t result;
|
||||||
|
|
||||||
if(CatOne.GateWay->SvrRegFlag == false) {
|
switch(CatOne.EthStatus) {
|
||||||
if(CatOne.RegisterDelayCnt == 0) {
|
case ETH_IDEL:
|
||||||
|
rt_thread_delay(1);
|
||||||
|
if(CatOne.EthResetDelayCnt > 0) {
|
||||||
|
CatOne.EthResetDelayCnt--;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CatOne.EthStatus = ETH_RESET;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ETH_RESET:
|
||||||
|
CAT1_DBG_LOG("ETH Reset!\r\n");
|
||||||
|
ETH_RESET_CLR();
|
||||||
|
rt_thread_delay(10);
|
||||||
|
ETH_RESET_SET();
|
||||||
|
rt_thread_delay(2000); // 延长复位后稳定时间到2秒
|
||||||
|
ETHApplyNetPara(); // 配置EthNet网络参数
|
||||||
|
CatOne.EthStatus = ETH_WAIT_LINK;
|
||||||
|
CatOne.EthLinkWaitCnt = 0;
|
||||||
|
CatOne.EthFirstRegFlag = true; // 重置首次注册标志
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ETH_WAIT_LINK:
|
||||||
|
if(CatOne.EthLinkWaitCnt == 0) {
|
||||||
|
/* 首次进入等待链路状态,等待模块完全启动 */
|
||||||
|
CAT1_DBG_LOG("ETH Waiting for module ready...\r\n");
|
||||||
|
rt_thread_delay(2000);
|
||||||
|
}
|
||||||
if(ETH_LINK_GET() == Reset) {
|
if(ETH_LINK_GET() == Reset) {
|
||||||
CatOne.RegisterDelayCnt = REGISTER_INTERVAL_MAX * 10;
|
CAT1_DBG_LOG("ETH Link OK!\r\n");
|
||||||
|
if(CatOne.GateWay->SvrRegFlag == false) {
|
||||||
|
CatOne.EthStatus = ETH_REG_SVR;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CatOne.EthStatus = ETH_WAIT_SEND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CatOne.EthLinkWaitCnt++;
|
||||||
|
if(CatOne.EthLinkWaitCnt >= ETH_LINK_WAIT_TIME_MAX) {
|
||||||
|
CAT1_DBG_LOG("ETH Link Timeout, Reset!\r\n");
|
||||||
|
CatOne.EthStatus = ETH_OFF;
|
||||||
|
}
|
||||||
|
rt_thread_delay(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ETH_REG_SVR:
|
||||||
|
{
|
||||||
|
// 首次注册时添加延迟,等待系统稳定
|
||||||
|
if(CatOne.EthFirstRegFlag) {
|
||||||
|
CAT1_DBG_LOG("ETH First Register, waiting for system stable...\r\n");
|
||||||
|
rt_thread_delay(ETH_FIRST_REG_DELAY);
|
||||||
|
CatOne.EthFirstRegFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t ret = GateWayRegister(CatOneEthTxBuff);
|
uint8_t ret = GateWayRegister(CatOneEthTxBuff);
|
||||||
rt_mq_send(CatOne.GateWay->NetSendData_MQ, CatOneEthTxBuff, ret);
|
rt_mq_send(CatOne.GateWay->NetSendData_MQ, CatOneEthTxBuff, ret);
|
||||||
|
CAT1_DBG_LOG("ETH Register Server...\r\n");
|
||||||
|
CatOne.EthStatus = ETH_WAIT_SEND;
|
||||||
|
CatOne.EthSendRetryCnt = 0; // 重置重试计数器
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else {
|
|
||||||
CatOne.RegisterDelayCnt--;
|
case ETH_WAIT_SEND:
|
||||||
}
|
result = rt_mq_recv(CatOne.GateWay->NetSendData_MQ, Payload, CAT_ONE_REV_LEN_MAX, 100);
|
||||||
|
if(result == RT_EOK) {
|
||||||
|
CatOneEthTxLen = NetCommOrgData(CatOne.GateWay, Payload, CatOneEthTxBuff);
|
||||||
|
CatOne.EthStatus = ETH_SEND_DATA;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(CatOne.EthStatus == ETH_RESET || CatOne.EthStatus == ETH_OFF)
|
||||||
|
return;
|
||||||
|
if(ETH_LINK_GET() != Reset) {
|
||||||
|
CAT1_DBG_LOG("ETH Link Lost!\r\n");
|
||||||
|
CatOne.EthStatus = ETH_OFF;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rt_thread_delay(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ETH_SEND_DATA:
|
||||||
|
HexToAscii(CatOneEthTxBuff, CommUnitSendASCII, CatOneEthTxLen);
|
||||||
|
EthRevTimeOutCnt = 0;
|
||||||
|
EthOrCat1UartSend((uint8_t *)CommUnitSendASCII, CatOneEthTxLen * 2);
|
||||||
|
CommUnitSendASCII[CatOneEthTxLen * 2] = 0;
|
||||||
|
CAT1_DBG_LOG("Eth Send: %s\r\n", CommUnitSendASCII);
|
||||||
|
|
||||||
|
CatOne.EthStatus = ETH_WAIT_RECV;
|
||||||
|
CatOne.EthRecvTimeoutCnt = 0;
|
||||||
|
CatOne.EthSendRetryCnt = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ETH_WAIT_RECV:
|
||||||
|
rt_thread_delay(1);
|
||||||
|
CatOne.EthRecvTimeoutCnt++;
|
||||||
|
|
||||||
|
if(CatOne.EthRecvTimeoutCnt >= ETH_RECV_TIMEOUT_MAX) {
|
||||||
|
CAT1_DBG_LOG("ETH Recv Timeout!\r\n");
|
||||||
|
CatOne.EthSendRetryCnt++;
|
||||||
|
if(CatOne.EthSendRetryCnt >= ETH_SEND_RETRY_MAX) {
|
||||||
|
CAT1_DBG_LOG("ETH Send Retry Max, Reset!\r\n");
|
||||||
|
CatOne.EthStatus = ETH_OFF;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(CatOne.GateWay->SvrRegFlag == false) {
|
||||||
|
CatOne.EthStatus = ETH_REG_SVR;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CatOne.EthStatus = ETH_WAIT_SEND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ETH_LINK_GET() != Reset) {
|
||||||
|
CAT1_DBG_LOG("ETH Link Lost During Wait!\r\n");
|
||||||
|
CatOne.EthStatus = ETH_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CatOne.GateWay->SvrRegFlag == true) {
|
||||||
|
CAT1_DBG_LOG("ETH Register Success!\r\n");
|
||||||
|
CatOne.EthStatus = ETH_WAIT_SEND;
|
||||||
|
CatOne.EthRecvTimeoutCnt = 0;
|
||||||
|
CatOne.EthSendRetryCnt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ETH_OFF:
|
||||||
|
CAT1_DBG_LOG("ETH Power Off!\r\n");
|
||||||
|
//ETH_RESET_CLR();
|
||||||
|
//rt_thread_delay(3000);
|
||||||
|
//ETH_RESET_SET();
|
||||||
|
CatOne.EthStatus = ETH_IDEL;
|
||||||
|
CatOne.EthResetDelayCnt = ETH_RESET_DELAY_TIME_MAX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
CatOne.EthStatus = ETH_RESET;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
result = rt_mq_recv(CatOne.GateWay->NetSendData_MQ, Payload, CAT_ONE_REV_LEN_MAX, 100);
|
|
||||||
if(result == RT_EOK) {
|
|
||||||
CatOneEthTxLen = NetCommOrgData(CatOne.GateWay, Payload, CatOneEthTxBuff);
|
|
||||||
HexToAscii(CatOneEthTxBuff, CommUnitSendASCII, CatOneEthTxLen);
|
|
||||||
EthRevTimeOutCnt = 0;
|
|
||||||
EthOrCat1UartSend((uint8_t *)CommUnitSendASCII, CatOneEthTxLen * 2);
|
|
||||||
CommUnitSendASCII[CatOneEthTxLen * 2] = 0;
|
|
||||||
CAT1_DBG_LOG("Eth Send: %s\r\n",CommUnitSendASCII);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CatOneEthSendQueue(uint8_t *sData, uint16_t sLen)
|
bool CatOneEthSendQueue(uint8_t *sData, uint16_t sLen)
|
||||||
@@ -600,7 +756,7 @@ bool CatOneEthSendQueue(uint8_t *sData, uint16_t sLen)
|
|||||||
static void CatOneInit(GateWayPara GateWay)
|
static void CatOneInit(GateWayPara GateWay)
|
||||||
{
|
{
|
||||||
memset(&CatOne, 0x00, sizeof(CatOne_t));
|
memset(&CatOne, 0x00, sizeof(CatOne_t));
|
||||||
CatOne.Status = CAT_ONE_RESET;
|
CatOne.Cat1Status = CAT_ONE_RESET;
|
||||||
CatOne.GateWay = GateWay;
|
CatOne.GateWay = GateWay;
|
||||||
CatOne.CatOneRevCallBack = GateWay->SvrRevCallBack;
|
CatOne.CatOneRevCallBack = GateWay->SvrRevCallBack;
|
||||||
}
|
}
|
||||||
@@ -707,7 +863,7 @@ void EthRxOverhandler(void)
|
|||||||
{
|
{
|
||||||
if(EthRevTimeOutCnt > 0)
|
if(EthRevTimeOutCnt > 0)
|
||||||
EthRevTimeOutCnt--;
|
EthRevTimeOutCnt--;
|
||||||
|
|
||||||
if(CatOneEthRxLen > 5 && EthRevTimeOutCnt == 0) {
|
if(CatOneEthRxLen > 5 && EthRevTimeOutCnt == 0) {
|
||||||
EthRevTimeOutCnt = 20;
|
EthRevTimeOutCnt = 20;
|
||||||
if(CatOne.GateWay->ConfigPara.Comm == CATONE_COMM)
|
if(CatOne.GateWay->ConfigPara.Comm == CATONE_COMM)
|
||||||
@@ -728,3 +884,122 @@ void CatReadImeiOrSim(char *Imei, char *Sim)
|
|||||||
Sim[20] = 0x00;
|
Sim[20] = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CatOneTriggerRegister(void)
|
||||||
|
{
|
||||||
|
CatOne.Cat1Status = CAT_ONE_REG_SVR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETHTriggerRegister(void)
|
||||||
|
{
|
||||||
|
CatOne.EthStatus = ETH_REG_SVR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETHApplyNetPara(void)
|
||||||
|
{
|
||||||
|
uint8_t cmdBuf[128];
|
||||||
|
uint16_t idx = 0;
|
||||||
|
GWConfigPara_t *pCfg = (GWConfigPara_t *)&CatOne.GateWay->ConfigPara;
|
||||||
|
|
||||||
|
/* EthNet模块二进制命令协议:
|
||||||
|
* 识别流(10B): ED F2 A3 56 CA DB 91 84 B0 D7
|
||||||
|
* 命令类型00: 读参数/状态
|
||||||
|
* 命令类型03: 写参数并保存到Flash
|
||||||
|
* 命令类型07: 写参数+保存+重启模块
|
||||||
|
*
|
||||||
|
* 参数偏移: 0x00=LocalIP(4B), 0x04=NetMask(4B), 0x08=Gateway(4B),
|
||||||
|
* 0x0C=DestIP(4B), 0x10=LocalPort(2B), 0x12=DestPort(2B),
|
||||||
|
* 0x14=WorkMode(1B: 0=TCP Server,1=TCP Client,2=UDP),
|
||||||
|
* 0x38=DHCP(1B: 0=静态,1=DHCP)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 步骤0: 检查系统是否初始化完毕
|
||||||
|
* 发送命令: ed f2 a3 56 ca db 91 84 b0 d7 00 3d 01
|
||||||
|
* 如果返回00或01则表示初始化完成,可以进行写参数
|
||||||
|
*/
|
||||||
|
CAT1_DBG_LOG("ETH Check init...");
|
||||||
|
for(int waitCnt = 0; waitCnt < 50; waitCnt++) {
|
||||||
|
idx = 0;
|
||||||
|
cmdBuf[idx++] = 0xED; cmdBuf[idx++] = 0xF2; cmdBuf[idx++] = 0xA3; cmdBuf[idx++] = 0x56;
|
||||||
|
cmdBuf[idx++] = 0xCA; cmdBuf[idx++] = 0xDB; cmdBuf[idx++] = 0x91; cmdBuf[idx++] = 0x84;
|
||||||
|
cmdBuf[idx++] = 0xB0; cmdBuf[idx++] = 0xD7;
|
||||||
|
cmdBuf[idx++] = 0x00; /* 读参数 */
|
||||||
|
cmdBuf[idx++] = 0x3D; /* 偏移: 0x3D (Status) */
|
||||||
|
cmdBuf[idx++] = 0x01; /* 长度: 1字节 */
|
||||||
|
EthOrCat1UartSend(cmdBuf, idx);
|
||||||
|
rt_thread_delay(100);
|
||||||
|
/* 实际应该检查返回值,这里简单等待后继续 */
|
||||||
|
}
|
||||||
|
CAT1_DBG_LOG("ETH Init check done");
|
||||||
|
|
||||||
|
/* 步骤1: 一次性写入从0x00开始的网络参数(LocalIP~WorkMode, 共0x15字节)
|
||||||
|
* 偏移0x00~0x14: LocalIP(4) + NetMask(4) + Gateway(4) + DestIP(4) + LocalPort(2) + DestPort(2) + WorkMode(1)
|
||||||
|
*/
|
||||||
|
idx = 0;
|
||||||
|
cmdBuf[idx++] = 0xED; cmdBuf[idx++] = 0xF2; cmdBuf[idx++] = 0xA3; cmdBuf[idx++] = 0x56;
|
||||||
|
cmdBuf[idx++] = 0xCA; cmdBuf[idx++] = 0xDB; cmdBuf[idx++] = 0x91; cmdBuf[idx++] = 0x84;
|
||||||
|
cmdBuf[idx++] = 0xB0; cmdBuf[idx++] = 0xD7;
|
||||||
|
cmdBuf[idx++] = 0x01; /* 命令类型: 写参数,部分参数修改后会自动重启 */
|
||||||
|
cmdBuf[idx++] = 0x00; /* 偏移: 0x00 */
|
||||||
|
cmdBuf[idx++] = 0x15; /* 长度: 21字节 */
|
||||||
|
|
||||||
|
/* Local IP */
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.IpAddr[0];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.IpAddr[1];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.IpAddr[2];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.IpAddr[3];
|
||||||
|
/* Net Mask */
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.SubnetMask[0];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.SubnetMask[1];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.SubnetMask[2];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.SubnetMask[3];
|
||||||
|
/* Gateway */
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.Gateway[0];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.Gateway[1];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.Gateway[2];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.Gateway[3];
|
||||||
|
/* Dest IP */
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.DestIp[0];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.DestIp[1];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.DestIp[2];
|
||||||
|
cmdBuf[idx++] = pCfg->EthNet.DestIp[3];
|
||||||
|
/* Local Port (大端) */
|
||||||
|
cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.IpPort >> 8);
|
||||||
|
cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.IpPort & 0xFF);
|
||||||
|
/* Dest Port (大端) */
|
||||||
|
cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.DestPort >> 8);
|
||||||
|
cmdBuf[idx++] = (uint8_t)(pCfg->EthNet.DestPort & 0xFF);
|
||||||
|
/* Work Mode: 0=TCP Server, 1=TCP Client, 2=UDP */
|
||||||
|
if(pCfg->EthNet.WorkMode == ETH_MODE_TCP_SERVER) {
|
||||||
|
cmdBuf[idx++] = 0x00;
|
||||||
|
} else if(pCfg->EthNet.WorkMode == ETH_MODE_TCP_CLIENT) {
|
||||||
|
cmdBuf[idx++] = 0x01;
|
||||||
|
} else {
|
||||||
|
cmdBuf[idx++] = 0x02;
|
||||||
|
}
|
||||||
|
|
||||||
|
CAT1_DBG_LOG("ETH Write IP/Mode, len=%d", idx);
|
||||||
|
EthOrCat1UartSend(cmdBuf, idx);
|
||||||
|
rt_thread_delay(500);
|
||||||
|
|
||||||
|
/* 步骤2: 写入DHCP/IP模式 (偏移0x38, 1字节)
|
||||||
|
* 0=静态IP, 1=DHCP
|
||||||
|
*/
|
||||||
|
idx = 0;
|
||||||
|
cmdBuf[idx++] = 0xED; cmdBuf[idx++] = 0xF2; cmdBuf[idx++] = 0xA3; cmdBuf[idx++] = 0x56;
|
||||||
|
cmdBuf[idx++] = 0xCA; cmdBuf[idx++] = 0xDB; cmdBuf[idx++] = 0x91; cmdBuf[idx++] = 0x84;
|
||||||
|
cmdBuf[idx++] = 0xB0; cmdBuf[idx++] = 0xD7;
|
||||||
|
cmdBuf[idx++] = 0x01; /* 命令类型: 写参数,DHCP修改后会自动重启 */
|
||||||
|
cmdBuf[idx++] = 0x38; /* 偏移: 0x38 (DHCP en) */
|
||||||
|
cmdBuf[idx++] = 0x01; /* 长度: 1字节 */
|
||||||
|
cmdBuf[idx++] = (pCfg->EthNet.IpMode == ETH_IP_DHCP) ? 0x01 : 0x00;
|
||||||
|
|
||||||
|
CAT1_DBG_LOG("ETH Write DHCP=%d", cmdBuf[idx - 1]);
|
||||||
|
EthOrCat1UartSend(cmdBuf, idx);
|
||||||
|
rt_thread_delay(3000); /* 等待模块重启 */
|
||||||
|
|
||||||
|
/* 注意:不要向DevID(偏移0x1F)区域写入任意数据,否则根据手册说明,
|
||||||
|
* 如果写入的ID不正确,设备会丢弃所有其他写入的参数
|
||||||
|
* 模块会在下次上电时自动使用Flash中保存的参数工作
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,23 +8,39 @@
|
|||||||
|
|
||||||
//传感器对应的数据长度
|
//传感器对应的数据长度
|
||||||
const uint8_t SensorTypeDataLen[] = {
|
const uint8_t SensorTypeDataLen[] = {
|
||||||
0, //0x0000-保留
|
0, //0x0000-保留
|
||||||
30, //0x0001-应力场检测单元
|
30, //0x0001-应力场检测单元
|
||||||
12, //0x0002-渗透压检测单元
|
12, //0x0002-渗透压检测单元
|
||||||
14, //0x0003-弹性波导检测单元
|
14, //0x0003-弹性波导检测单元
|
||||||
10, //0x0004-介电质普检测单元
|
10, //0x0004-介电质普检测单元
|
||||||
6, //0x0005-微振动
|
6, //0x0005-微振动
|
||||||
6, //0x0006-三维连续变形检测单元
|
6, //0x0006-三维连续变形检测单元
|
||||||
3, //0x0007-通讯单元
|
3, //0x0007-通讯单元
|
||||||
18, //0x0008-三维应力检测单元
|
18, //0x0008-三维应力检测单元
|
||||||
9, //0x0009-激光示踪(主设备)
|
9, //0x0009-激光示踪(主设备)
|
||||||
12, //0x000A-水位计
|
12, //0x000A-水位计
|
||||||
0, //0x000B-保留
|
0, //0x000B-保留
|
||||||
0, //0x000C-保留
|
0, //0x000C-保留
|
||||||
14, //0x000D-二维应力场检测单元
|
14, //0x000D-二维应力场检测单元
|
||||||
9, //0x000E-裂缝检测单元
|
9, //0x000E-裂缝检测单元
|
||||||
|
0, //0x000F-预留
|
||||||
8, //0x0010-姿态检测单元
|
8, //0x0010-姿态检测单元
|
||||||
4, //0x0011-激光位移检测单元
|
4, //0x0011-激光位移检测单元
|
||||||
|
4, //0x0012-表面应力传感器
|
||||||
|
4, //0x0013-压力传感器
|
||||||
|
4, //0x0014-微波测距传感器
|
||||||
|
0, //0x0015-表贴式结冰传感器
|
||||||
|
0, //0x0016-埋入式结冰传感器
|
||||||
|
4, //0x0017-单通道钢筋应力传感器
|
||||||
|
4, //0x0018-单通道锚杆轴力传感器
|
||||||
|
32, //0x0019-8通道钢筋拉压力传感器
|
||||||
|
32, //0x001A-8通道锚杆轴力传感器
|
||||||
|
0, //0x001B-16通道钢筋应力传感器
|
||||||
|
0, //0x001C-16通道锚杆轴力传感器
|
||||||
|
0, //0x001D-爆炸冲击传感器
|
||||||
|
0, //0x001E-随行支架传感器
|
||||||
|
0, //0x001F-冻融循环传感器
|
||||||
|
19, //0x0020-位移计
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
@@ -264,8 +280,8 @@ void CommUnitCmdSend(GateWayPara GateWay, uint8_t *CommUnitMac, CommUnitCmd_m Cm
|
|||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
* 函数名称: CommUintOrgData
|
* 函数名称: CommUintOrgData
|
||||||
* 功能描述: 上传传感器数据函数
|
* 功能描述: 上传传感器数据函数
|
||||||
* 参 数: GWMac,网关mac地址
|
* 参 数: CUPara, 通讯单元参数
|
||||||
CUPara, 通讯单元参数
|
CUData, 通讯单元数据
|
||||||
sData, 数据入口
|
sData, 数据入口
|
||||||
* 返 回 值: 数据长度
|
* 返 回 值: 数据长度
|
||||||
*****************************************************************************************/
|
*****************************************************************************************/
|
||||||
@@ -441,8 +457,8 @@ void DebugDisplaySensorData(int SensorIdx, uint16_t SensorType, uint8_t *SensorD
|
|||||||
case DISPLACEMENT: {
|
case DISPLACEMENT: {
|
||||||
Displacement_T Sensor;
|
Displacement_T Sensor;
|
||||||
memcpy((uint8_t *)&Sensor, SensorData, sizeof(Displacement_T));
|
memcpy((uint8_t *)&Sensor, SensorData, sizeof(Displacement_T));
|
||||||
MAIN_DBG_LOG("Sensor%d Type %04x: PitchAngle=%04d, RollAngle=%04d, YawAngle=%04d, Altitude=%06f, Distance=%04d\r\n",
|
MAIN_DBG_LOG("Sensor%d Type %04x: PitchAngle=%04d, RollAngle=%04d, YawAngle=%04d, Temp=%06f, Altitude=%06f, Distance=%04d\r\n",
|
||||||
SensorIdx, SensorType, Sensor.PitchAngle, Sensor.RollAngle, Sensor.YawAngle, Sensor.Altitude, Sensor.Distance);
|
SensorIdx, SensorType, Sensor.PitchAngle, Sensor.RollAngle, Sensor.YawAngle, Sensor.Temp, Sensor.Altitude, Sensor.Distance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -559,11 +575,13 @@ int CommUnitAnalyze(GateWayPara GateWay, uint8_t *rData, uint16_t rLen, SendData
|
|||||||
MegData[0] = PayLoadLen & 0x00ff;;
|
MegData[0] = PayLoadLen & 0x00ff;;
|
||||||
MegData[1] = (PayLoadLen >> 8) & 0x00ff;
|
MegData[1] = (PayLoadLen >> 8) & 0x00ff;
|
||||||
MegData[2] = NET_COMM_CMD_ADD_UNIT;
|
MegData[2] = NET_COMM_CMD_ADD_UNIT;
|
||||||
|
MegData[3] = (GateWay->ConfigPara.CommUnitArray[i].SensorN) & 0x00ff;;
|
||||||
|
MegData[4] = (GateWay->ConfigPara.CommUnitArray[i].SensorN >> 8) & 0x00ff;
|
||||||
for(uint8_t i = 0; i < GateWay->ConfigPara.CommUnitArray[i].SensorN; i++)
|
for(uint8_t i = 0; i < GateWay->ConfigPara.CommUnitArray[i].SensorN; i++)
|
||||||
{
|
{
|
||||||
memcpy(&MegData[3], GateWay->ConfigPara.CommUnitArray[i].Mac[i], 6);
|
memcpy(&MegData[5], GateWay->ConfigPara.CommUnitArray[i].Mac[i], 6);
|
||||||
}
|
}
|
||||||
CatOneEthSendQueue(MegData, PayLoadLen+3);
|
CatOneEthSendQueue(MegData, PayLoadLen+5);
|
||||||
rt_free(MegData);
|
rt_free(MegData);
|
||||||
}
|
}
|
||||||
return 0xff;
|
return 0xff;
|
||||||
@@ -995,14 +1013,14 @@ int Cat1EthRevCallBack(GateWayPara GateWay, uint8_t *rData, uint16_t rLen)
|
|||||||
if(GateWay->ConfigPara.Rs485Ch1.Enable == true) { //内部通讯单元处理
|
if(GateWay->ConfigPara.Rs485Ch1.Enable == true) { //内部通讯单元处理
|
||||||
if(GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) {
|
if(GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) {
|
||||||
SensorCnt++;
|
SensorCnt++;
|
||||||
memcpy(&MegData[sLen], GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0], 6);
|
memcpy(&MegData[sLen], GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0], 6);
|
||||||
sLen += 6;
|
sLen += 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(GateWay->ConfigPara.Rs485Ch2.Enable == true) {
|
if(GateWay->ConfigPara.Rs485Ch2.Enable == true) {
|
||||||
if(GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) {
|
if(GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) {
|
||||||
SensorCnt++;
|
SensorCnt++;
|
||||||
memcpy(&MegData[sLen], GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0], 6);
|
memcpy(&MegData[sLen], GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0], 6);
|
||||||
sLen += 6;
|
sLen += 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,18 +289,18 @@ void RS485LoopHandler(GateWayPara GateWay, RS485Para RS485Ch, SensorCommPara SCP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(RS485Ch->CUData.Para.SensorN > 0){
|
else if(RS485Ch->CUPara.Para.SensorN > 0){
|
||||||
SCPara->SendFlag = false;
|
SCPara->SendFlag = false;
|
||||||
if(SCPara->ReadSensorInterval > 0) {
|
if(SCPara->ReadSensorInterval > 0) {
|
||||||
SCPara->ReadSensorInterval--;
|
SCPara->ReadSensorInterval--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SCPara->ReadSensorCnt >= RS485Ch->CUData.Para.SensorN || SCPara->SensorCnt >= SENSOR_NUM_MAX) {
|
if(SCPara->ReadSensorCnt >= RS485Ch->CUPara.Para.SensorN || SCPara->SensorCnt >= SENSOR_NUM_MAX) {
|
||||||
SCPara->SensorCnt = 0;
|
SCPara->SensorCnt = 0;
|
||||||
SCPara->ReadSensorCnt = 0;
|
SCPara->ReadSensorCnt = 0;
|
||||||
SCPara->ReadSensorInterval = GateWay->ConfigPara.CommUnitReadInterval * 5;
|
SCPara->ReadSensorInterval = GateWay->ConfigPara.CommUnitReadInterval * 5;
|
||||||
RS485Ch->CUData.Para.BatLevel = GateWay->Battery;
|
RS485Ch->CUPara.Para.BatLevel = GateWay->Battery;
|
||||||
CommUintLen = CommUintOrgData(GateWay, &RS485Ch->CUData.Para, &SCPara->SensorData, CommUintData);
|
CommUintLen = CommUintOrgData(GateWay, &RS485Ch->CUPara.Para, &SCPara->SensorData, CommUintData);
|
||||||
//AddLog(&CommUintData[2], CommUintLen - 2);
|
//AddLog(&CommUintData[2], CommUintLen - 2);
|
||||||
CatOneEthSendQueue(CommUintData, CommUintLen);
|
CatOneEthSendQueue(CommUintData, CommUintLen);
|
||||||
if(RS485Ch == &GateWay->ConfigPara.Rs485Ch1) {
|
if(RS485Ch == &GateWay->ConfigPara.Rs485Ch1) {
|
||||||
@@ -312,11 +312,11 @@ void RS485LoopHandler(GateWayPara GateWay, RS485Para RS485Ch, SensorCommPara SCP
|
|||||||
SCPara->SensorCnt = 0;
|
SCPara->SensorCnt = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(RS485Ch->CUData.Para.SensorType[SCPara->SensorCnt] != 0) {
|
if(RS485Ch->CUPara.Para.SensorType[SCPara->SensorCnt] != 0) {
|
||||||
rt_thread_delay(50);
|
rt_thread_delay(50);
|
||||||
SCPara->Cmd = RS485_SENSOR_CMD_READ;
|
SCPara->Cmd = RS485_SENSOR_CMD_READ;
|
||||||
SCPara->SensorAddr = SCPara->SensorCnt + 1;
|
SCPara->SensorAddr = SCPara->SensorCnt + 1;
|
||||||
SCPara->SensorType = RS485Ch->CUData.Para.SensorType[SCPara->SensorCnt];
|
SCPara->SensorType = RS485Ch->CUPara.Para.SensorType[SCPara->SensorCnt];
|
||||||
SCPara->CmdParaLen = RS485SensorCmdPayLoadLen[RS485_SENSOR_CMD_READ];
|
SCPara->CmdParaLen = RS485SensorCmdPayLoadLen[RS485_SENSOR_CMD_READ];
|
||||||
SCPara->CmdPara = NULL;
|
SCPara->CmdPara = NULL;
|
||||||
//rt_mutex_take(GateWay->UartRevMutex, RT_WAITING_FOREVER);
|
//rt_mutex_take(GateWay->UartRevMutex, RT_WAITING_FOREVER);
|
||||||
@@ -402,7 +402,7 @@ void RS485LoopHandler(GateWayPara GateWay, RS485Para RS485Ch, SensorCommPara SCP
|
|||||||
else {
|
else {
|
||||||
if(RS485Ch->CommUnitEnable == true) {
|
if(RS485Ch->CommUnitEnable == true) {
|
||||||
//rt_mutex_release(GateWay->UartRevMutex);
|
//rt_mutex_release(GateWay->UartRevMutex);
|
||||||
if(SCPara->SendFlag == true) { //&& RS485Ch->CUData.Para.SensorN > 0 && RS485Ch->QuerySensorFlag == false){
|
if(SCPara->SendFlag == true) { //&& RS485Ch->CUPara.Para.SensorN > 0 && RS485Ch->QuerySensorFlag == false){
|
||||||
if(RS485Ch == &GateWay->ConfigPara.Rs485Ch1) {
|
if(RS485Ch == &GateWay->ConfigPara.Rs485Ch1) {
|
||||||
test++;
|
test++;
|
||||||
MAIN_DBG_LOG("InCommUint1, Sensor %d Comm Error, Cmd %d...\r\n", SCPara->SensorAddr, SCPara->Cmd);
|
MAIN_DBG_LOG("InCommUint1, Sensor %d Comm Error, Cmd %d...\r\n", SCPara->SensorAddr, SCPara->Cmd);
|
||||||
@@ -455,13 +455,13 @@ void RS485Ch1_Thread_Entry(void *parameter)
|
|||||||
InCommUnitMac[3] = GateWay->ConfigPara.GwMac[4];
|
InCommUnitMac[3] = GateWay->ConfigPara.GwMac[4];
|
||||||
InCommUnitMac[4] = GateWay->ConfigPara.GwMac[5];
|
InCommUnitMac[4] = GateWay->ConfigPara.GwMac[5];
|
||||||
RS485Ch = &GateWay->ConfigPara.Rs485Ch1;
|
RS485Ch = &GateWay->ConfigPara.Rs485Ch1;
|
||||||
memcpy(RS485Ch->CUData.Para.Mac, InCommUnitMac, 6);
|
memcpy(RS485Ch->CUPara.Para.Mac, InCommUnitMac, 6);
|
||||||
if(RS485Ch->CommUnitEnable == true) {
|
if(RS485Ch->CommUnitEnable == true) {
|
||||||
RS485_CH1_POW_ON();
|
RS485_CH1_POW_ON();
|
||||||
RS485Ch->CUData.Para.SensorN = 0;
|
RS485Ch->CUPara.Para.SensorN = 0;
|
||||||
memset(RS485Ch->CUData.Para.SensorType, 0x00, sizeof(SENSOR_NUM_MAX * 2));
|
memset(RS485Ch->CUPara.Para.SensorType, 0x00, sizeof(SENSOR_NUM_MAX * 2));
|
||||||
RS485Ch->QuerySensorFlag = true;
|
RS485Ch->QuerySensorFlag = true;
|
||||||
RS485Ch->CUData.Para.CommStatus = true;
|
RS485Ch->CUPara.Para.CommStatus = true;
|
||||||
}
|
}
|
||||||
SCPara->RS485CommUnitReadTimeDelay = 100;
|
SCPara->RS485CommUnitReadTimeDelay = 100;
|
||||||
SCPara->RS485Rev_Sem = rt_sem_create("rsch1sem", 0, RT_IPC_FLAG_FIFO);
|
SCPara->RS485Rev_Sem = rt_sem_create("rsch1sem", 0, RT_IPC_FLAG_FIFO);
|
||||||
@@ -519,13 +519,13 @@ void RS485Ch2_Thread_Entry(void *parameter)
|
|||||||
InCommUnitMac[3] = GateWay->ConfigPara.GwMac[4];
|
InCommUnitMac[3] = GateWay->ConfigPara.GwMac[4];
|
||||||
InCommUnitMac[4] = GateWay->ConfigPara.GwMac[5];
|
InCommUnitMac[4] = GateWay->ConfigPara.GwMac[5];
|
||||||
RS485Ch = &GateWay->ConfigPara.Rs485Ch2;
|
RS485Ch = &GateWay->ConfigPara.Rs485Ch2;
|
||||||
memcpy(RS485Ch->CUData.Para.Mac, InCommUnitMac, 6);
|
memcpy(RS485Ch->CUPara.Para.Mac, InCommUnitMac, 6);
|
||||||
if(RS485Ch->CommUnitEnable == true) {
|
if(RS485Ch->CommUnitEnable == true) {
|
||||||
RS485_CH2_POW_ON();
|
RS485_CH2_POW_ON();
|
||||||
RS485Ch->CUData.Para.SensorN = 0;
|
RS485Ch->CUPara.Para.SensorN = 0;
|
||||||
memset(RS485Ch->CUData.Para.SensorType, 0x00, sizeof(SENSOR_NUM_MAX * 2));
|
memset(RS485Ch->CUPara.Para.SensorType, 0x00, sizeof(SENSOR_NUM_MAX * 2));
|
||||||
RS485Ch->QuerySensorFlag = true;
|
RS485Ch->QuerySensorFlag = true;
|
||||||
RS485Ch->CUData.Para.CommStatus = 1;
|
RS485Ch->CUPara.Para.CommStatus = 1;
|
||||||
}
|
}
|
||||||
SCPara->RS485CommUnitReadTimeDelay = 100;
|
SCPara->RS485CommUnitReadTimeDelay = 100;
|
||||||
SCPara->RS485Rev_Sem = rt_sem_create("rsch2sem", 0, RT_IPC_FLAG_FIFO);
|
SCPara->RS485Rev_Sem = rt_sem_create("rsch2sem", 0, RT_IPC_FLAG_FIFO);
|
||||||
@@ -565,7 +565,7 @@ void RS485RxOverhandler(void)
|
|||||||
if(SComm1Para.RS485TimeOutCnt > 0)
|
if(SComm1Para.RS485TimeOutCnt > 0)
|
||||||
SComm1Para.RS485TimeOutCnt--;
|
SComm1Para.RS485TimeOutCnt--;
|
||||||
|
|
||||||
if(SComm1Para.RS485RxLen > 5 && SComm1Para.RS485TimeOutCnt == 0) {
|
if(SComm1Para.RS485RxLen >= 1 && SComm1Para.RS485TimeOutCnt == 0) {
|
||||||
if(SComm1Para.InitOverFlag == true) {
|
if(SComm1Para.InitOverFlag == true) {
|
||||||
rt_sem_release(SComm1Para.RS485Rev_Sem);
|
rt_sem_release(SComm1Para.RS485Rev_Sem);
|
||||||
SComm1Para.RS485TimeOutCnt = 20;
|
SComm1Para.RS485TimeOutCnt = 20;
|
||||||
@@ -579,7 +579,7 @@ void RS485RxOverhandler(void)
|
|||||||
if(SComm2Para.RS485TimeOutCnt > 0)
|
if(SComm2Para.RS485TimeOutCnt > 0)
|
||||||
SComm2Para.RS485TimeOutCnt--;
|
SComm2Para.RS485TimeOutCnt--;
|
||||||
|
|
||||||
if(SComm2Para.RS485RxLen > 5 && SComm2Para.RS485TimeOutCnt == 0) {
|
if(SComm2Para.RS485RxLen >= 1 && SComm2Para.RS485TimeOutCnt == 0) {
|
||||||
if(SComm2Para.InitOverFlag == true) {
|
if(SComm2Para.InitOverFlag == true) {
|
||||||
SComm2Para.RS485TimeOutCnt = 20;
|
SComm2Para.RS485TimeOutCnt = 20;
|
||||||
rt_sem_release(SComm2Para.RS485Rev_Sem);
|
rt_sem_release(SComm2Para.RS485Rev_Sem);
|
||||||
|
|||||||
@@ -134,11 +134,41 @@ void GateWayInit(void)
|
|||||||
memset((uint8_t *)&GateWay.ConfigPara, 0x00, sizeof(GWConfigPara_t));
|
memset((uint8_t *)&GateWay.ConfigPara, 0x00, sizeof(GWConfigPara_t));
|
||||||
GateWay.ConfigPara.SavFlag = LOG_SAV_FLAG;
|
GateWay.ConfigPara.SavFlag = LOG_SAV_FLAG;
|
||||||
GateWay.ConfigPara.Comm = CATONE_COMM;
|
GateWay.ConfigPara.Comm = CATONE_COMM;
|
||||||
GateWay.ConfigPara.SvrAddr[0] = 103;
|
#if MAC_ADDR_TYPE == 0//测试服务器
|
||||||
GateWay.ConfigPara.SvrAddr[1] = 217;
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
GateWay.ConfigPara.SvrAddr[2] = 192;
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
GateWay.ConfigPara.SvrAddr[3] = 248;
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
GateWay.ConfigPara.SvrPort = 12111;
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8080;
|
||||||
|
#elif MAC_ADDR_TYPE > 0
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 217;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 192;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 248;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 12111;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GateWay.ConfigPara.EthNet.IpMode = ETH_IP_STATIC;
|
||||||
|
GateWay.ConfigPara.EthNet.IpAddr[0] = 192;
|
||||||
|
GateWay.ConfigPara.EthNet.IpAddr[1] = 168;
|
||||||
|
GateWay.ConfigPara.EthNet.IpAddr[2] = 1;
|
||||||
|
GateWay.ConfigPara.EthNet.IpAddr[3] = 101;
|
||||||
|
GateWay.ConfigPara.EthNet.IpPort = 10000;
|
||||||
|
GateWay.ConfigPara.EthNet.WorkMode = ETH_MODE_TCP_CLIENT;
|
||||||
|
GateWay.ConfigPara.EthNet.SubnetMask[0] = 255;
|
||||||
|
GateWay.ConfigPara.EthNet.SubnetMask[1] = 255;
|
||||||
|
GateWay.ConfigPara.EthNet.SubnetMask[2] = 255;
|
||||||
|
GateWay.ConfigPara.EthNet.SubnetMask[3] = 0;
|
||||||
|
GateWay.ConfigPara.EthNet.Gateway[0] = 192;
|
||||||
|
GateWay.ConfigPara.EthNet.Gateway[1] = 168;
|
||||||
|
GateWay.ConfigPara.EthNet.Gateway[2] = 1;
|
||||||
|
GateWay.ConfigPara.EthNet.Gateway[3] = 1;
|
||||||
|
GateWay.ConfigPara.EthNet.DestIp[0] = 192;
|
||||||
|
GateWay.ConfigPara.EthNet.DestIp[1] = 168;
|
||||||
|
GateWay.ConfigPara.EthNet.DestIp[2] = 1;
|
||||||
|
GateWay.ConfigPara.EthNet.DestIp[3] = 100;
|
||||||
|
GateWay.ConfigPara.EthNet.DestPort = 8080;
|
||||||
|
|
||||||
GateWay.ConfigPara.CommUnitReadInterval = COMMUNIT_READ_SENSOR_INTERVAL_MAX;//非低功耗设备
|
GateWay.ConfigPara.CommUnitReadInterval = COMMUNIT_READ_SENSOR_INTERVAL_MAX;//非低功耗设备
|
||||||
memset(GateWay.ConfigPara.CommUnitArray, 0x00, sizeof(CommUnitData_t) * COMMUNIT_NUM_MAX);
|
memset(GateWay.ConfigPara.CommUnitArray, 0x00, sizeof(CommUnitData_t) * COMMUNIT_NUM_MAX);
|
||||||
GateWay.ConfigPara.Rs485Ch1.Enable = true;
|
GateWay.ConfigPara.Rs485Ch1.Enable = true;
|
||||||
@@ -168,7 +198,7 @@ void GateWayInit(void)
|
|||||||
|
|
||||||
#if MAC_ADDR_TYPE == 0
|
#if MAC_ADDR_TYPE == 0
|
||||||
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_Test, 6);
|
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_Test, 6);
|
||||||
GateWay.ConfigPara.DebugChannel = DEBUG_CH_DBG;
|
GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;
|
||||||
#elif MAC_ADDR_TYPE == 1
|
#elif MAC_ADDR_TYPE == 1
|
||||||
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_BL1, 6);
|
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_BL1, 6);
|
||||||
GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;
|
GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;
|
||||||
@@ -202,25 +232,6 @@ void GateWayInit(void)
|
|||||||
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_BL10, 6);
|
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_BL10, 6);
|
||||||
GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;
|
GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MAC_ADDR_TYPE == 0//测试服务器
|
|
||||||
GateWay.ConfigPara.SvrAddr[0] = 39;
|
|
||||||
GateWay.ConfigPara.SvrAddr[1] = 106;
|
|
||||||
GateWay.ConfigPara.SvrAddr[2] = 103;
|
|
||||||
GateWay.ConfigPara.SvrAddr[3] = 147;
|
|
||||||
GateWay.ConfigPara.SvrPort = 8080;
|
|
||||||
#elif MAC_ADDR_TYPE > 0
|
|
||||||
// GateWay.ConfigPara.SvrAddr[0] = 39;
|
|
||||||
// GateWay.ConfigPara.SvrAddr[1] = 106;
|
|
||||||
// GateWay.ConfigPara.SvrAddr[2] = 103;
|
|
||||||
// GateWay.ConfigPara.SvrAddr[3] = 147;
|
|
||||||
// GateWay.ConfigPara.SvrPort = 8080;
|
|
||||||
GateWay.ConfigPara.SvrAddr[0] = 103;
|
|
||||||
GateWay.ConfigPara.SvrAddr[1] = 217;
|
|
||||||
GateWay.ConfigPara.SvrAddr[2] = 192;
|
|
||||||
GateWay.ConfigPara.SvrAddr[3] = 248;
|
|
||||||
GateWay.ConfigPara.SvrPort = 12111;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GateWay.ConfigPara.OutageFlag != true && GateWay.ConfigPara.OutageFlag != false)
|
if(GateWay.ConfigPara.OutageFlag != true && GateWay.ConfigPara.OutageFlag != false)
|
||||||
@@ -301,7 +312,7 @@ void GateWayInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WritePara((uint8_t *)&GateWay.ConfigPara, sizeof(GWConfigPara_t));
|
WritePara((uint8_t *)&GateWay.ConfigPara, sizeof(GWConfigPara_t));
|
||||||
|
|
||||||
LogInit();
|
LogInit();
|
||||||
|
|
||||||
Header.LogEndAddr = 0;
|
Header.LogEndAddr = 0;
|
||||||
@@ -322,6 +333,8 @@ void GateWayInit(void)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ETH_ON();
|
ETH_ON();
|
||||||
|
rt_thread_delay(1000);
|
||||||
|
ETHReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<<<<<<< HEAD
|
||||||
|
# GateWay
|
||||||
|
|
||||||
|
一代网关
|
||||||
|
=======
|
||||||
|
# LaserTracing_Debug
|
||||||
|
|
||||||
|
>>>>>>> aaff1aeec5ea03de83eee8888e10da1bf6a62ded
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<<<<<<< HEAD
|
||||||
|
# GateWay
|
||||||
|
|
||||||
|
一代网关
|
||||||
|
=======
|
||||||
|
# LaserTracing_Debug
|
||||||
|
|
||||||
|
>>>>>>> aaff1aeec5ea03de83eee8888e10da1bf6a62ded
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# GateWay
|
||||||
|
|
||||||
|
一代网关
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# GateWay
|
||||||
|
|
||||||
|
一代网关
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# LaserTracing_Debug
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# LaserTracing_Debug
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
old=b"b'\xb7\xb5\xbb\xd8\xd6\xb5,\xd5\xe2\xc0\xef\xbc\xf2\xb5\xa5\xb5\xc8\xb4\xfd\xba\xf3\xbc\xcc\xd0\xf8 */\r\n\t}\r\n\tCAT1_DBG_LOG("ETH Init check done");\r\n\r\n\t/* \xb2\xbd\xd6\xe81: \xd2\xbb\xb4\xce\xd0\xd4\xd0\xb4\xc8\xeb\xb4\xd30x00\xbf\xaa\xca\xbc\xb5\xc4\xcd\xf8\xc2\xe7\xb2\xce\xca\xfd(LocalIP~WorkMode, \xb9\xb20x15\xd7\xd6\xbd\xda)\r\n\t * \xc6\xab\xd2\xc60x00~0x14: LocalIP(4) + NetMask(4) + Gateway(4) + DestIP(4) + LocalPort(2) + DestPort(2) + WorkMode(1)\r\n\t */\r\n\tidx = 0;\r\n\tcmdBuf[idx++] = 0xED; cmdBuf[idx++] = 0xF2; cmdBuf[idx++] = 0xA3; cmdBuf[idx++] = 0x56;\r\n\tcmdBuf[idx++] = 0xCA; cmdBuf[idx++] = 0xDB; cmdBuf[idx++] = 0x91; cmdBuf[idx++] = 0x84;\r\n\tcmdBuf[idx++] = 0xB0; cmdBuf[idx++] = 0xD7;\r\n\tcmdBuf[idx++] = 0x03; /* \xc3\xfc\xc1\xee\xc0\xe0\xd0\xcd: \xd0\xb4\xb2\xce\xca\xfd\xb2\xa2\xb1\xa3\xb4\xe6\xb5\xbdFlash */\r\n\tcmdBuf[idx++] = 0x00; /* \xc6\xab\xd2\xc6: 0x00 */\r\n\tcmdBuf[idx++] = 0x15; /* \xb3\xa4\xb6\xc8: 21\xd7\xd6\xbd\xda */\r\n\r\n\t/* Local IP */\r\n\tcmdBuf[idx++] = pCfg->EthNet.IpAddr[0];\r\n\tcmdBuf[idx++] = pCfg->EthNet.IpAddr[1];\r\n\tcmdBuf[idx++] = pCfg->EthNet.IpAddr[2];\r\n\tcmdBuf[idx++] = pCfg->EthNet.IpAddr[3];\r\n\t/* Net Mask */\r\n\tcmdBuf[idx++] = pCfg->EthNet.SubnetMask[0];\r\n\tcmdBuf[idx++] = pCfg->EthNet.SubnetMask[1];\r\n\tcmdBuf[idx++] = pCfg->EthNet.SubnetMask[2];\r\n\tcmdBuf[idx++] = pCfg->EthNet.SubnetMask[3];\r\n\t/* Gateway */\r\n\tcmdBuf[idx++] = pCfg->EthNet.Gateway[0];\r\n\tcmdBuf[idx++] = pCfg->EthNet.Gateway[1];\r\n\tcmdBuf[idx++] = pCfg->EthNet.Gateway[2];\r\n\tcmdBuf[idx++] = pCfg->EthNet.Gateway[3];\r\n\t/* Dest IP */\r\n\tcmdBuf[idx++] = pCfg->EthNet.DestIp[0];\r\n\tcmdBuf[idx++] = pCfg->EthNet.DestIp[1];\r\n\tcmdBuf[idx++] = pCfg->EthNet.DestIp[2];\r\n\tcmdBuf[idx++] = pCfg->EthNet.DestIp[3];\r\n\t/* Local Port (\xb4\xf3\xb6\xcb) */\r\n\tcmdBuf[idx++] = (uint8_t)(pCfg->EthNet.IpPort >> 8);\r\n\tcmdBuf[idx++] = (uint8_t)(pCfg->EthNet.IpPort & 0xFF);\r\n\t/* Dest Port (\xb4\xf3\xb6\xcb) */\r\n\tcmdBuf[idx++] = (uint8_t)(pCfg->EthNet.DestPort >> 8);\r\n\tcmdBuf[idx++] = (uint8_t)(pCfg->EthNet.DestPort & 0xFF);\r\n\t/* Work Mode: 0=TCP Server, 1=TCP Client, 2=UDP */\r\n\tif(pCfg->EthNet.WorkMode == ETH_MODE_TCP_SERVER) {\r\n\t\tcmdBuf[idx++] = 0x00;\r\n\t} else if(pCfg->EthNet.WorkMode == ETH_MODE_TCP_CLIENT) {\r\n\t\tcmdBuf[idx++] = 0x01;\r\n\t} else {\r\n\t\tcmdBuf[idx++] = 0x02;\r\n\t}\r\n\r\n\tCAT1_DBG_LOG("ETH Write IP/Mode, len=%d", idx);\r\n'"
|
||||||
Reference in New Issue
Block a user