Skip to content

Commit 568c88f

Browse files
committed
Format examples.
1 parent a152b5b commit 568c88f

File tree

3 files changed

+49
-29
lines changed

3 files changed

+49
-29
lines changed

examples/Angle_Example/Angle_Example.ino

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,24 @@ void setup()
101101

102102
// M5Chain.setAngleRotationDirection(devices_list->devices[i].id, ANGLE_ROTATION_DECREASING,
103103
// &operation_status,
104-
// CHAIN_SAVE_FLASH_ENABLE); // Angle rotation direction decreasing, save to flash
104+
// CHAIN_SAVE_FLASH_ENABLE); // Angle rotation direction decreasing,
105+
// save to flash
105106
// M5Chain.setAngleRotationDirection(devices_list->devices[i].id, ANGLE_ROTATION_INCREASING,
106107
// &operation_status,
107-
// CHAIN_SAVE_FLASH_ENABLE); // Angle rotation direction increasing, save to flash
108+
// CHAIN_SAVE_FLASH_ENABLE); // Angle rotation direction increasing,
109+
// save to flash
108110
// chain_status = M5Chain.setAngleRotationDirection(devices_list->devices[i].id,
109111
// ANGLE_ROTATION_DECREASING,
110112
// &operation_status,
111-
// CHAIN_SAVE_FLASH_DISABLE); // Angle rotation direction decreasing, not save to flash
112-
M5Chain.setAngleRotationDirection(devices_list->devices[i].id, ANGLE_ROTATION_INCREASING,
113-
&operation_status,
114-
CHAIN_SAVE_FLASH_DISABLE); // Angle rotation direction increasing, not save to flash
113+
// CHAIN_SAVE_FLASH_DISABLE); // Angle rotation direction decreasing,
114+
// not save to flash
115+
M5Chain.setAngleRotationDirection(
116+
devices_list->devices[i].id, ANGLE_ROTATION_INCREASING, &operation_status,
117+
CHAIN_SAVE_FLASH_DISABLE); // Angle rotation direction increasing, not save to flash
115118

116119
if (chain_status == CHAIN_OK && operation_status) {
117-
Serial.printf("Angle ID[%d] set angle rotation direction success \r\n", devices_list->devices[i].id);
120+
Serial.printf("Angle ID[%d] set angle rotation direction success \r\n",
121+
devices_list->devices[i].id);
118122
} else {
119123
Serial.printf(
120124
"Angle ID[%d] set angle rotation direction failed, chain_status:%d operation_status:%d \r\n",
@@ -139,8 +143,8 @@ void loop()
139143
if (chain_status == CHAIN_OK) {
140144
Serial.printf("Angle ID[%d] angle12Bit:%d \r\n", devices_list->devices[i].id, angle12Bit);
141145
} else {
142-
Serial.printf("Angle ID[%d] get 12bit adc failed, chain_status:%d \r\n", devices_list->devices[i].id,
143-
chain_status);
146+
Serial.printf("Angle ID[%d] get 12bit adc failed, chain_status:%d \r\n",
147+
devices_list->devices[i].id, chain_status);
144148
}
145149
chain_status = M5Chain.getAngle8BitAdc(devices_list->devices[i].id, &angle8Bit);
146150
if (chain_status == CHAIN_OK) {

examples/Joystick_Example/Joystick_Example.ino

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,34 +147,47 @@ void loop()
147147
chain_button_mode_t button_mode;
148148
chain_status = M5Chain.getJoystick16Adc(devices_list->devices[i].id, &xAdcValue, &yAdcValue);
149149
if (chain_status == CHAIN_OK) {
150-
Serial.printf("JOYSTICK ID[%d] xAdcValue:%d, yAdcValue:%d \r\n", devices_list->devices[i].id, xAdcValue, yAdcValue);
150+
Serial.printf("JOYSTICK ID[%d] xAdcValue:%d, yAdcValue:%d \r\n", devices_list->devices[i].id,
151+
xAdcValue, yAdcValue);
151152
} else {
152-
Serial.printf("JOYSTICK ID[%d] get 16 adc value failed, chain_status:%d \r\n", devices_list->devices[i].id, chain_status);
153+
Serial.printf("JOYSTICK ID[%d] get 16 adc value failed, chain_status:%d \r\n",
154+
devices_list->devices[i].id, chain_status);
153155
}
154156
chain_status = M5Chain.getJoystick8Adc(devices_list->devices[i].id, &xAdcValue8, &yAdcValue8);
155157
if (chain_status == CHAIN_OK) {
156-
Serial.printf("JOYSTICK ID[%d] xAdcValue8:%d, yAdcValue8:%d \r\n", devices_list->devices[i].id, xAdcValue8, yAdcValue8);
158+
Serial.printf("JOYSTICK ID[%d] xAdcValue8:%d, yAdcValue8:%d \r\n", devices_list->devices[i].id,
159+
xAdcValue8, yAdcValue8);
157160
} else {
158-
Serial.printf("JOYSTICK ID[%d] get 8 adc value failed, chain_status:%d \r\n", devices_list->devices[i].id, chain_status);
161+
Serial.printf("JOYSTICK ID[%d] get 8 adc value failed, chain_status:%d \r\n",
162+
devices_list->devices[i].id, chain_status);
159163
}
160164

161165
chain_status = M5Chain.getJoystickMappedRange(devices_list->devices[i].id, mapRange, JOYSTICK_MAP_SIZE);
162166
if (chain_status == CHAIN_OK) {
163-
Serial.printf("JOYSTICK ID[%d] mapRange:%d %d %d %d %d %d %d %d \r\n", devices_list->devices[i].id, mapRange[0], mapRange[1], mapRange[2], mapRange[3], mapRange[4], mapRange[5], mapRange[6], mapRange[7]);
167+
Serial.printf("JOYSTICK ID[%d] mapRange:%d %d %d %d %d %d %d %d \r\n", devices_list->devices[i].id,
168+
mapRange[0], mapRange[1], mapRange[2], mapRange[3], mapRange[4], mapRange[5],
169+
mapRange[6], mapRange[7]);
164170
} else {
165-
Serial.printf("JOYSTICK ID[%d] get 16 adc map range failed, chain_status:%d \r\n", devices_list->devices[i].id, chain_status);
171+
Serial.printf("JOYSTICK ID[%d] get 16 adc map range failed, chain_status:%d \r\n",
172+
devices_list->devices[i].id, chain_status);
166173
}
167-
chain_status = M5Chain.getJoystickMappedInt16Value(devices_list->devices[i].id, &xMapAdcValue, &yMapAdcValue);
174+
chain_status =
175+
M5Chain.getJoystickMappedInt16Value(devices_list->devices[i].id, &xMapAdcValue, &yMapAdcValue);
168176
if (chain_status == CHAIN_OK) {
169-
Serial.printf("JOYSTICK ID[%d] xMapAdcValue:%d, yMapAdcValue:%d \r\n", devices_list->devices[i].id, xMapAdcValue, yMapAdcValue);
177+
Serial.printf("JOYSTICK ID[%d] xMapAdcValue:%d, yMapAdcValue:%d \r\n", devices_list->devices[i].id,
178+
xMapAdcValue, yMapAdcValue);
170179
} else {
171-
Serial.printf("JOYSTICK ID[%d] get 16 adc map value failed, chain_status:%d \r\n", devices_list->devices[i].id, chain_status);
180+
Serial.printf("JOYSTICK ID[%d] get 16 adc map value failed, chain_status:%d \r\n",
181+
devices_list->devices[i].id, chain_status);
172182
}
173-
chain_status = M5Chain.getJoystickMappedInt8Value(devices_list->devices[i].id, &xMapAdcValue8, &yMapAdcValue8);
183+
chain_status =
184+
M5Chain.getJoystickMappedInt8Value(devices_list->devices[i].id, &xMapAdcValue8, &yMapAdcValue8);
174185
if (chain_status == CHAIN_OK) {
175-
Serial.printf("JOYSTICK ID[%d] xMapAdcValue8:%d, yMapAdcValue8:%d \r\n", devices_list->devices[i].id, xMapAdcValue8, yMapAdcValue8);
186+
Serial.printf("JOYSTICK ID[%d] xMapAdcValue8:%d, yMapAdcValue8:%d \r\n",
187+
devices_list->devices[i].id, xMapAdcValue8, yMapAdcValue8);
176188
} else {
177-
Serial.printf("JOYSTICK ID[%d] get 8 adc map value failed, chain_status:%d \r\n", devices_list->devices[i].id, chain_status);
189+
Serial.printf("JOYSTICK ID[%d] get 8 adc map value failed, chain_status:%d \r\n",
190+
devices_list->devices[i].id, chain_status);
178191
}
179192

180193
chain_status = M5Chain.getJoystickButtonStatus(devices_list->devices[i].id, &button_status);

examples/Key_Example/Key_Example.ino

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,15 @@ void setup()
102102
M5Chain.setKeyButtonTriggerInterval(devices_list->devices[i].id, BUTTON_DOUBLE_CLICK_TIME_200MS,
103103
BUTTON_LONG_PRESS_TIME_3S, &operation_status);
104104
if (chain_status == CHAIN_OK && operation_status) {
105-
Serial.printf("KEY ID[%d] set key button trigger interval success\r\n", devices_list->devices[i].id);
105+
Serial.printf("KEY ID[%d] set key button trigger interval success\r\n",
106+
devices_list->devices[i].id);
106107
} else {
107-
Serial.printf("KEY ID[%d] set key button trigger interval failed, chain_status:%d operation_status:%d \r\n",
108-
devices_list->devices[i].id, chain_status, operation_status);
108+
Serial.printf(
109+
"KEY ID[%d] set key button trigger interval failed, chain_status:%d operation_status:%d \r\n",
110+
devices_list->devices[i].id, chain_status, operation_status);
109111
}
110-
chain_status = M5Chain.setKeyButtonMode(devices_list->devices[i].id, CHAIN_BUTTON_REPORT_MODE, &operation_status);
112+
chain_status =
113+
M5Chain.setKeyButtonMode(devices_list->devices[i].id, CHAIN_BUTTON_REPORT_MODE, &operation_status);
111114
if (chain_status == CHAIN_OK && operation_status) {
112115
Serial.printf("KEY ID[%d] set key button mode success\r\n", devices_list->devices[i].id);
113116
} else {
@@ -135,11 +138,11 @@ void loop()
135138
if (chain_status == CHAIN_OK) {
136139
Serial.printf("KEY ID[%d] button status:%d \r\n", devices_list->devices[i].id, button_status);
137140
} else {
138-
Serial.printf("KEY ID[%d] get button status failed, chain_status:%d \r\n", devices_list->devices[i].id,
139-
chain_status);
141+
Serial.printf("KEY ID[%d] get button status failed, chain_status:%d \r\n",
142+
devices_list->devices[i].id, chain_status);
140143
}
141-
chain_status = M5Chain.getKeyButtonTriggerInterval(devices_list->devices[i].id, &button_double_click_time,
142-
&button_long_press_time);
144+
chain_status = M5Chain.getKeyButtonTriggerInterval(devices_list->devices[i].id,
145+
&button_double_click_time, &button_long_press_time);
143146
if (chain_status == CHAIN_OK) {
144147
Serial.printf("KEY ID[%d] button double click time:%d, button long press time:%d \r\n",
145148
devices_list->devices[i].id, button_double_click_time, button_long_press_time);

0 commit comments

Comments
 (0)