Skip to content

Commit c622161

Browse files
hubmartinblavka
authored andcommitted
applications: control: Add CHESTER Control
1 parent 595016f commit c622161

35 files changed

+5065
-0
lines changed

applications/applications.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,11 @@
176176
fw_version: v2.3.0
177177
shields: ctr_ds18b20 ctr_lte ctr_mb7066_a ctr_z
178178
remark: Support for CHESTER-Z
179+
180+
### CHESTER Control ######
181+
-
182+
name: CHESTER Control
183+
fw_bundle: com.hardwario.chester.app.control
184+
fw_name: hio-chester-control
185+
fw_version: v2.3.0
186+
shields: ctr_lte_v2 ctr_x0_a ctr_x4_b

applications/control/CMakeLists.txt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Copyright (c) 2023 HARDWARIO a.s.
3+
#
4+
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
# Supported shields: ctr_lte_v2 ctr_x0_a ctr_s2 ctr_z ctr_ds18b20 ctr_x4_b
10+
set(SHIELD ctr_lte_v2 ctr_x0_a ctr_x4_b)
11+
12+
set(ENV{FW_BUNDLE} "com.hardwario.chester.app.control")
13+
set(ENV{FW_NAME} "CHESTER Control")
14+
15+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
16+
project(control)
17+
18+
target_sources(app PRIVATE src/app_backup.c)
19+
target_sources(app PRIVATE src/app_cbor.c)
20+
target_sources(app PRIVATE src/app_config.c)
21+
target_sources(app PRIVATE src/app_data.c)
22+
target_sources(app PRIVATE src/app_handler.c)
23+
target_sources(app PRIVATE src/app_init.c)
24+
target_sources(app PRIVATE src/app_power.c)
25+
target_sources(app PRIVATE src/app_send.c)
26+
target_sources(app PRIVATE src/app_sensor.c)
27+
target_sources(app PRIVATE src/app_shell.c)
28+
target_sources(app PRIVATE src/app_work.c)
29+
30+
target_sources(app PRIVATE src/main.c)

applications/control/app.overlay

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (c) 2023 HARDWARIO a.s.
3+
*
4+
* SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
5+
*/
6+
7+
&ctr_x4_a {
8+
line-measurement-interval = <1000>;
9+
line-threshold-min = <6000>;
10+
line-threshold-max = <9000>;
11+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2023 HARDWARIO a.s.
3+
#
4+
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
5+
#
6+
7+
CONFIG_MULTITHREADING=y
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
version: 2
2+
type: decoder
3+
name: com.hardwario.chester.control
4+
schema:
5+
- message:
6+
- version:
7+
- sequence:
8+
- timestamp:
9+
- attribute:
10+
- vendor_name:
11+
- product_name:
12+
- hw_variant:
13+
- hw_revision:
14+
- fw_version:
15+
- serial_number:
16+
- system:
17+
- uptime:
18+
- voltage_rest:
19+
- $div: 1000
20+
- $fpp: 2
21+
- voltage_load:
22+
- $div: 1000
23+
- $fpp: 2
24+
- current_load:
25+
- backup:
26+
- line_voltage:
27+
- $div: 1000
28+
- $fpp: 2
29+
- batt_voltage:
30+
- $div: 1000
31+
- $fpp: 2
32+
- state:
33+
- $enum:
34+
- "disconnected"
35+
- "connected"
36+
- events:
37+
- network:
38+
- imei:
39+
- imsi:
40+
- parameter:
41+
- eest:
42+
- ecl:
43+
- rsrp:
44+
- rsrq:
45+
- snr:
46+
- plmn:
47+
- cid:
48+
- band:
49+
- earfcn:
50+
- thermometer:
51+
- temperature:
52+
- $div: 100
53+
- $fpp: 2
54+
- accelerometer:
55+
- accel_x:
56+
- $div: 1000
57+
- $fpp: 2
58+
- accel_y:
59+
- $div: 1000
60+
- $fpp: 2
61+
- accel_z:
62+
- $div: 1000
63+
- $fpp: 2
64+
- orientation:
65+
- trigger:
66+
- channel:
67+
- state:
68+
- $enum:
69+
- "inactive"
70+
- "active"
71+
- events:
72+
- $tso:
73+
- type:
74+
- $enum:
75+
- "deactivated"
76+
- "activated"
77+
- counter:
78+
- channel:
79+
- value:
80+
- delta:
81+
- measurements:
82+
- $tsp:
83+
- value:
84+
- voltage:
85+
- channel:
86+
- measurements_div:
87+
- $key: "measurements"
88+
- $tsp:
89+
- min:
90+
- $div: 100
91+
- $fpp: 2
92+
- max:
93+
- $div: 100
94+
- $fpp: 2
95+
- avg:
96+
- $div: 100
97+
- $fpp: 2
98+
- mdn:
99+
- $div: 100
100+
- $fpp: 2
101+
- current:
102+
- channel:
103+
- measurements_div:
104+
- $key: "measurements"
105+
- $tsp:
106+
- min:
107+
- $div: 100
108+
- $fpp: 2
109+
- max:
110+
- $div: 100
111+
- $fpp: 2
112+
- avg:
113+
- $div: 100
114+
- $fpp: 2
115+
- mdn:
116+
- $div: 100
117+
- $fpp: 2
118+
- hygrometer:
119+
- temperature:
120+
- measurements_div:
121+
- $key: "measurements"
122+
- $tsp:
123+
- min:
124+
- $div: 100
125+
- $fpp: 2
126+
- max:
127+
- $div: 100
128+
- $fpp: 2
129+
- avg:
130+
- $div: 100
131+
- $fpp: 2
132+
- mdn:
133+
- $div: 100
134+
- $fpp: 2
135+
- humidity:
136+
- measurements_div:
137+
- $key: "measurements"
138+
- $tsp:
139+
- min:
140+
- $div: 100
141+
- $fpp: 2
142+
- max:
143+
- $div: 100
144+
- $fpp: 2
145+
- avg:
146+
- $div: 100
147+
- $fpp: 2
148+
- mdn:
149+
- $div: 100
150+
- $fpp: 2
151+
- w1_thermometers:
152+
- serial_number:
153+
- measurements_div:
154+
- $key: "measurements"
155+
- $tsp:
156+
- min:
157+
- $div: 100
158+
- $fpp: 2
159+
- max:
160+
- $div: 100
161+
- $fpp: 2
162+
- avg:
163+
- $div: 100
164+
- $fpp: 2
165+
- mdn:
166+
- $div: 100
167+
- $fpp: 2
168+
169+
170+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
type: encoder
3+
name: com.hardwario.chester.control
4+
schema:
5+
- output_1_state:
6+
- $type: int
7+
- output_2_state:
8+
- $type: int
9+
- output_3_state:
10+
- $type: int
11+
- output_4_state:
12+
- $type: int

applications/control/codec/config.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#/bin/bash
2+
3+
# Run with
4+
# API_KEY="xxx" DEVICE_ID="xxx" ./codec/config.sh
5+
6+
set -x
7+
8+
curl -X 'POST' \
9+
'https://api.prod.hardwario.cloud/v2/messages' \
10+
-H 'accept: application/json' \
11+
-H "Authorization: ApiKey $API_KEY" \
12+
-H 'Content-Type: application/json' \
13+
-d '{
14+
"body": [
15+
"app config analog-interval-sample 61",
16+
"app config analog-interval-aggreg 301",
17+
],
18+
"device_id": "'"$DEVICE_ID"'",
19+
"type": "config"
20+
}'

applications/control/codec/control.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#/bin/bash
2+
3+
# Run with
4+
# API_KEY="xxx" DEVICE_ID="xxx" ./codec/control.sh
5+
6+
set -x
7+
8+
curl -X 'POST' \
9+
'https://api.prod.hardwario.cloud/v2/messages' \
10+
-H 'accept: application/json' \
11+
-H "Authorization: ApiKey $API_KEY" \
12+
-H 'Content-Type: application/json' \
13+
-d '{
14+
"body": {
15+
"output_1_state": 0,
16+
"output_2_state": 0,
17+
"output_3_state": 0,
18+
"output_4_state": 0
19+
},
20+
"device_id": "'"$DEVICE_ID"'",
21+
"type": "data"
22+
}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
curl -H "Authorization: ApiKey ......-....-....-....-........."^
2+
-H "accept: application/json" -H "Content-Type: application/json"^
3+
-d @config.json https://api.prod.hardwario.cloud/v2/messages
4+
5+
pause
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"body": [
3+
"app config scan-timeout 666",
4+
"app config address count 1",
5+
"app config address add 81763000"
6+
],
7+
"device_id": "...",
8+
"type": "config"
9+
}

applications/control/prj.conf

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Copyright (c) 2023 HARDWARIO a.s.
3+
#
4+
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
5+
#
6+
7+
CONFIG_ADC_SHELL=n
8+
CONFIG_CTR_ACCEL=y
9+
CONFIG_CTR_ADC=y
10+
CONFIG_CTR_BATT=y
11+
CONFIG_CTR_BLE=y
12+
CONFIG_CTR_BUF=y
13+
CONFIG_CTR_BUTTON=y
14+
CONFIG_CTR_CLOUD=y
15+
CONFIG_CTR_DEFAULTS=y
16+
CONFIG_CTR_EDGE=y
17+
CONFIG_CTR_INFO=y
18+
CONFIG_CTR_LED=y
19+
CONFIG_CTR_LOG=y
20+
CONFIG_CTR_LTE_CLKSYNC=y
21+
CONFIG_CTR_RTC=y
22+
CONFIG_CTR_SHELL=y
23+
CONFIG_CTR_THERM=y
24+
CONFIG_CTR_WDOG=y
25+
CONFIG_ENTROPY_GENERATOR=y
26+
CONFIG_TINYCRYPT_SHA256=y
27+
CONFIG_TINYCRYPT=y
28+
CONFIG_ZCBOR_STOP_ON_ERROR=y
29+
CONFIG_ZCBOR=y
30+
31+
CONFIG_SYS_HEAP_RUNTIME_STATS=y
32+
CONFIG_HEAP_MEM_POOL_SIZE=32768
33+
34+
CONFIG_ADC_TLA2021_INIT_PRIORITY=60

0 commit comments

Comments
 (0)