Skip to content

Commit e09f7c2

Browse files
committed
merge: Merge branch 'develop' into develop.
Signed-off-by: icyqwq <[email protected]>
2 parents 8c1cd15 + 9984ec6 commit e09f7c2

File tree

11 files changed

+549
-38
lines changed

11 files changed

+549
-38
lines changed

.github/workflows/nightly-build.yml

Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
run: source tools/ci.sh && ci_esp32_idf504_setup
1818
- name: Build
1919
run: source tools/ci.sh && ci_esp32_nightly_build
20+
- name: Deliver AirQ firmware
21+
uses: actions/upload-artifact@v3
22+
with:
23+
name: M5STACK_AirQ_firmware
24+
path: ./m5stack/build-M5STACK_AirQ/uiflow-*.bin
2025
- name: Deliver AtomS3 firmware
2126
uses: actions/upload-artifact@v3
2227
with:
@@ -27,58 +32,88 @@ jobs:
2732
with:
2833
name: M5STACK_AtomS3-Lite_firmware
2934
path: ./m5stack/build-M5STACK_AtomS3_Lite/uiflow-*.bin
30-
- name: Deliver StampS3 firmware
35+
- name: Deliver AtomS3U firmware
3136
uses: actions/upload-artifact@v3
3237
with:
33-
name: M5STACK_StampS3_firmware
34-
path: ./m5stack/build-M5STACK_StampS3/uiflow-*.bin
35-
- name: Deliver CoreS3 firmware
38+
name: M5STACK_AtomS3U_firmware
39+
path: ./m5stack/build-M5STACK_AtomS3U/uiflow-*.bin
40+
- name: Deliver Basic firmware
3641
uses: actions/upload-artifact@v3
3742
with:
38-
name: M5STACK_CoreS3_firmware
39-
path: ./m5stack/build-M5STACK_CoreS3/uiflow-*.bin
40-
- name: Deliver AtomS3U firmware
43+
name: M5STACK_Basic_firmware
44+
path: ./m5stack/build-M5STACK_Basic/uiflow-*.bin
45+
- name: Deliver Basic(4MB Flash) firmware
4146
uses: actions/upload-artifact@v3
4247
with:
43-
name: M5STACK_AtomS3U_firmware
44-
path: ./m5stack/build-M5STACK_AtomS3U/uiflow-*.bin
48+
name: M5STACK_Basic_4MB_Flash_firmware
49+
path: ./m5stack/build-M5STACK_Basic_4MB/uiflow-*.bin
50+
- name: Deliver Capsule firmware
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: M5STACK_Capsule_firmware
54+
path: ./m5stack/build-M5STACK_Capsule/uiflow-*.bin
55+
- name: Deliver Cardputer firmware
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: M5STACK_Cardputer_firmware
59+
path: ./m5stack/build-M5STACK_Cardputer/uiflow-*.bin
4560
- name: Deliver Core2 firmware
4661
uses: actions/upload-artifact@v3
4762
with:
4863
name: M5STACK_Core2_firmware
4964
path: ./m5stack/build-M5STACK_Core2/uiflow-*.bin
50-
- name: Deliver StickC_PLUS2 firmware
65+
- name: Deliver CoreInk firmware
5166
uses: actions/upload-artifact@v3
5267
with:
53-
name: M5STACK_StickC_PLUS2_firmware
54-
path: ./m5stack/build-M5STACK_StickC_PLUS2/uiflow-*.bin
55-
- name: Deliver StickC_PLUS firmware
68+
name: M5STACK_CoreInk_firmware
69+
path: ./m5stack/build-M5STACK_CoreInk/uiflow-*.bin
70+
- name: Deliver CoreS3 firmware
5671
uses: actions/upload-artifact@v3
5772
with:
58-
name: M5STACK_StickC_PLUS_firmware
59-
path: ./m5stack/build-M5STACK_StickC_PLUS/uiflow-*.bin
73+
name: M5STACK_CoreS3_firmware
74+
path: ./m5stack/build-M5STACK_CoreS3/uiflow-*.bin
75+
- name: Deliver Dial firmware
76+
uses: actions/upload-artifact@v3
77+
with:
78+
name: M5STACK_Dial_firmware
79+
path: ./m5stack/build-M5STACK_Dial/uiflow-*.bin
80+
- name: Deliver DinMeter firmware
81+
uses: actions/upload-artifact@v3
82+
with:
83+
name: M5STACK_DinMeter_firmware
84+
path: ./m5stack/build-M5STACK_DinMeter/uiflow-*.bin
6085
- name: Deliver Fire firmware
6186
uses: actions/upload-artifact@v3
6287
with:
6388
name: M5STACK_Fire_firmware
6489
path: ./m5stack/build-M5STACK_Fire/uiflow-*.bin
65-
- name: Deliver Basic firmware
90+
- name: Deliver Paper firmware
6691
uses: actions/upload-artifact@v3
6792
with:
68-
name: M5STACK_Basic_firmware
69-
path: ./m5stack/build-M5STACK_Basic/uiflow-*.bin
70-
- name: Deliver Basic(4MB Flash) firmware
93+
name: M5STACK_Paper_firmware
94+
path: ./m5stack/build-M5STACK_Paper/uiflow-*.bin
95+
- name: Deliver StampS3 firmware
7196
uses: actions/upload-artifact@v3
7297
with:
73-
name: M5STACK_Basic_4MB_Flash_firmware
74-
path: ./m5stack/build-M5STACK_Basic_4MB/uiflow-*.bin
75-
- name: Deliver Capsule firmware
98+
name: M5STACK_StampS3_firmware
99+
path: ./m5stack/build-M5STACK_StampS3/uiflow-*.bin
100+
- name: Deliver StickC firmware
76101
uses: actions/upload-artifact@v3
77102
with:
78-
name: M5STACK_Capsule_firmware
79-
path: ./m5stack/build-M5STACK_Capsule/uiflow-*.bin
80-
- name: Deliver Dial firmware
103+
name: M5STACK_StickC_firmware
104+
path: ./m5stack/build-M5STACK_StickC/uiflow-*.bin
105+
- name: Deliver StickC_PLUS firmware
81106
uses: actions/upload-artifact@v3
82107
with:
83-
name: M5STACK_Dial_firmware
84-
path: ./m5stack/build-M5STACK_Dial/uiflow-*.bin
108+
name: M5STACK_StickC_PLUS_firmware
109+
path: ./m5stack/build-M5STACK_StickC_PLUS/uiflow-*.bin
110+
- name: Deliver StickC_PLUS2 firmware
111+
uses: actions/upload-artifact@v3
112+
with:
113+
name: M5STACK_StickC_PLUS2_firmware
114+
path: ./m5stack/build-M5STACK_StickC_PLUS2/uiflow-*.bin
115+
- name: Deliver Tough firmware
116+
uses: actions/upload-artifact@v3
117+
with:
118+
name: M5STACK_Tough_firmware
119+
path: ./m5stack/build-M5STACK_Tough/uiflow-*.bin

docs/en/refs/unit.weight_i2c.ref

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. |WEIGHT I2C| image:: https://static-cdn.m5stack.com/resource/docs/products/unit/Unit-Weight%20I2C/img-0634712b-2a27-48cf-894f-d6708a771d47.webp
2+
:target: https://docs.m5stack.com/en/unit/Unit-Weight%20I2C
3+
:height: 200px
4+
:width: 200 px
5+
6+
.. |init_i2c_address.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/init.svg
7+
8+
.. |get_adc_raw.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_adc_raw.svg
9+
10+
.. |get_weight_float.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_weight_float.svg
11+
12+
.. |get_weight_int.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_weight_int.svg
13+
14+
.. |get_weight_str.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_weight_str.svg
15+
16+
.. |set_reset_offset.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/set_reset_offset.svg
17+
18+
.. |set_calibration.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/set_calibration.svg
19+
20+
.. |set_lowpass_filter.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/set_lowpass_filter.svg
21+
22+
.. |get_lowpass_filter.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_lowpass_filter.svg
23+
24+
.. |set_average_filter_level.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/set_average_filter_level.svg
25+
26+
.. |get_average_filter_level.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_average_filter_level.svg
27+
28+
.. |set_ema_filter_alpha.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/set_ema_filter_alpha.svg
29+
30+
.. |get_ema_filter_alpha.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_ema_filter_alpha.svg
31+
32+
.. |set_i2c_address.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/set_i2c_address.svg
33+
34+
.. |get_device_spec.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/get_device_spec.svg
35+
36+
.. |example.svg| image:: https://static-cdn.m5stack.com/mpy_docs/unit/weight_i2c/example.svg

docs/en/units/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ Unit
2222
miniscale.rst
2323
dac2.rst
2424
lora_e220.rst
25+
weight_i2c.rst

docs/en/units/weight_i2c.rst

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
Weight I2C Unit
2+
===============
3+
4+
.. include:: ../refs/unit.weight_i2c.ref
5+
6+
The ``Weight I2C`` Unit is a weighing acquisition transmitter unit that adopts the "STM32+HX711 chip" solution to achieve 24-bit precision weight measurement through I2C communication and does not include a load cell sensor. This unit is capable of measuring weight and also includes various filters.
7+
8+
Support the following products:
9+
10+
11+
|WEIGHT I2C|
12+
13+
14+
15+
Micropython Example::
16+
17+
import os, sys, io
18+
import M5
19+
from M5 import *
20+
from hardware import *
21+
from unit import WEIGHT_I2CUnit
22+
import time
23+
24+
i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
25+
weight_i2c0 = WEIGHT_I2CUnit(i2c0)
26+
print(weight_i2c_0.get_adc_raw)
27+
print(weight_i2c_0.get_weight_float)
28+
time.sleep_ms(100)
29+
30+
31+
UIFLOW2 Example:
32+
33+
|example.svg|
34+
35+
36+
.. only:: builder_html
37+
38+
39+
class WEIGHT_I2CUnit
40+
--------------------
41+
42+
Constructors
43+
---------------------------
44+
45+
.. class:: WEIGHT_I2CUnit(i2c0, 0x26)
46+
47+
Create an WEIGHT_I2CUnit object.
48+
49+
- ``I2C0`` is I2C Port.
50+
- ``0x26`` is default I2C address
51+
52+
53+
UIFLOW2:
54+
55+
|init_i2c_address.svg|
56+
57+
58+
Methods
59+
----------------------
60+
61+
.. method:: WEIGHT_I2CUnit.get_adc_raw
62+
63+
64+
Gets the raw adc value.
65+
66+
UIFLOW2:
67+
68+
|get_adc_raw.svg|
69+
70+
.. method:: WEIGHT_I2CUnit.get_weight_float
71+
72+
73+
Gets the weight in grams float value.
74+
75+
UIFLOW2:
76+
77+
|get_weight_float.svg|
78+
79+
.. method:: WEIGHT_I2CUnit.get_weight_int
80+
81+
82+
Gets the weight in grams int value.
83+
84+
UIFLOW2:
85+
86+
|get_weight_int.svg|
87+
88+
.. method:: WEIGHT_I2CUnit.get_weight_str
89+
90+
91+
Gets the weight in grams string value.
92+
93+
UIFLOW2:
94+
95+
|get_weight_str.svg|
96+
97+
.. method:: WEIGHT_I2CUnit.set_reset_offset()
98+
99+
Reset the offset value(Tare).
100+
101+
102+
UIFLOW2:
103+
104+
|set_reset_offset.svg|
105+
106+
.. method:: WEIGHT_I2CUnit.set_calibration(weight1_g, weight1_adc, weight2_g, weight2_adc)
107+
108+
109+
Calibrates the Load sensor.
110+
111+
- ``weight1_g``: Weight1 in grams.
112+
- ``weight1_adc``: Weight1 in ADC value.
113+
- ``weight2_g``: Weight2 in grams.
114+
- ``weight2_adc``: Weight2 in ADC value.
115+
116+
calibration steps:
117+
118+
1.Reset offset(Tare).
119+
2.Get the raw ADC value at no-load weight, this is the Raw ADC of zero weight in 0g.
120+
3.Put some weight on it, then get adc, this is the load weight adc value and the gram weight you put on it.
121+
122+
123+
UIFLOW2:
124+
125+
|set_calibration.svg|
126+
127+
.. method:: WEIGHT_I2CUnit.set_lowpass_filter(Enable)
128+
129+
Enable or disable the low pass filter.
130+
131+
132+
UIFLOW2:
133+
134+
|set_lowpass_filter.svg|
135+
136+
137+
.. method:: WEIGHT_I2CUnit.get_lowpass_filter
138+
139+
Returns the status of the low pass filter (enable or disable).
140+
141+
142+
UIFLOW2:
143+
144+
|get_lowpass_filter.svg|
145+
146+
.. method:: WEIGHT_I2CUnit.set_average_filter_level(level)
147+
148+
Sets the level of the average filter.
149+
150+
- ``level``: Level of the average filter (0 - 50). Larger value for smoother result but more latency
151+
152+
UIFLOW2:
153+
154+
|set_average_filter_level.svg|
155+
156+
.. method:: WEIGHT_I2CUnit.get_average_filter_level
157+
158+
Returns the level of the average filter.
159+
160+
UIFLOW2:
161+
162+
|get_average_filter_level.svg|
163+
164+
.. method:: WEIGHT_I2CUnit.set_ema_filter_alpha(alpha)
165+
166+
Sets the alpha value for the EMA filter.
167+
168+
The EMA (Exponential Moving Average) filter is more sensitive to changes in data compared to the average filter.
169+
170+
- ``alpha``: Alpha value for the EMA filter (0 - 99). Smaller value for smoother result but more latency
171+
172+
UIFLOW2:
173+
174+
|set_ema_filter_alpha.svg|
175+
176+
.. method:: WEIGHT_I2CUnit.get_ema_filter_alpha
177+
178+
Returns the alpha value for the EMA filter.
179+
180+
UIFLOW2:
181+
182+
|get_ema_filter_alpha.svg|
183+
184+
.. method:: WEIGHT_I2CUnit.set_i2c_address(address)
185+
186+
The i2c address can be changed by the user and this address should be between 0x01 and 0x7F.
187+
188+
- ``address``: range of address(0x01 - 0x7F).
189+
190+
UIFLOW2:
191+
192+
|set_i2c_address.svg|
193+
194+
.. method:: WEIGHT_I2CUnit.get_device_spec(info)
195+
196+
Get the firmware version details and I2c address of this device.
197+
198+
- ``info``: (0xFE, 0xFF)
199+
200+
UIFLOW2:
201+
202+
|get_device_spec.svg|

m5stack/components/M5Unified/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ endif()
3030

3131
register_component()
3232
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
33-
target_compile_definitions(${COMPONENT_LIB} PRIVATE BOARD_ID=${BOARD_ID})
33+
target_compile_definitions(${COMPONENT_LIB} PRIVATE BOARD_ID=${BOARD_ID})
34+
target_compile_definitions(${COMPONENT_LIB} PRIVATE M5GFX_BOARD=${BOARD_ID})

m5stack/libs/unit/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
"RTC8563Unit": "rtc8563",
4949
"VMeterUnit": "vmeter",
5050
"AMeterUnit": "ameter",
51+
"WEIGHT_I2CUnit": "weight_i2c",
52+
"KMETER_ISOUnit": "kmeter_iso",
5153
}
5254

5355

0 commit comments

Comments
 (0)