Skip to content

Commit 62da992

Browse files
authored
Merge pull request #129 from tmobile/tmo-CFSPDK-1084-Improve-tmo-test-mfg-all
Improve tmo test mfg all command
2 parents e5adb5f + 8236df5 commit 62da992

File tree

2 files changed

+59
-32
lines changed

2 files changed

+59
-32
lines changed

samples/tmo_shell/src/misc_test.c

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,69 +35,73 @@ int misc_test()
3535
{
3636
int ret = 0, rc = 0;
3737

38+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "device list")) != 0) {
39+
rc |= ret;
40+
printf("device list - shell command failed %d\n", ret);
41+
} else {
42+
printf("device list - shell command was successful\n");
43+
}
44+
3845
#if DT_NODE_EXISTS(DT_NODELABEL(as6212))
39-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " TEMP_0)) != 0)
40-
{
46+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " TEMP_0)) != 0) {
4147
rc |= ret;
4248
printf("sensor get " TEMP_0 " - as6212 temp sensor - shell command failed %d \n", ret);
4349
} else {
4450
printf("sensor get " TEMP_0 " - as6212 temp sensor - shell command was successful\n");
4551
}
4652
#endif
53+
4754
#if DT_NODE_EXISTS(DT_NODELABEL(bq24250))
48-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read_byte " I2C_1 " 0x6a 0x3")) != 0)
49-
{
55+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read_byte " I2C_1 " 0x6a 0x3")) != 0) {
5056
rc |= ret;
5157
printf("i2c read_byte " I2C_1 " 0x6a 0x3 - BQ24250 voltage regulator- shell command failed %d \n", ret);
5258
} else {
5359
printf("i2c read_byte " I2C_1 " 0x6a 0x3 - BQ24250 voltage regulator- shell command was successful\n");
5460
}
5561
#else
56-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read " I2C_1 " 25 10")) != 0)
57-
{
62+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read " I2C_1 " 25 10")) != 0) {
5863
rc |= ret;
5964
printf("i2c read " I2C_1 " 25 10 - ACT81460 PMIC - shell command failed %d \n", ret);
6065
} else {
6166
printf("i2c read " I2C_1 " 25 10 - ACT81460 PMIC - shell command was successful\n");
6267
}
63-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c write_byte " I2C_1 " 25 47 98")) != 0)
64-
{
68+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c write_byte " I2C_1 " 25 47 98")) != 0) {
6569
rc |= ret;
6670
printf("i2c write_byte " I2C_1 " 25 47 98 - ACT81460 PMIC turn on GNSS - shell command failed %d \n", ret);
6771
} else {
6872
printf("i2c write_byte " I2C_1 " 25 47 98 - ACT81460 PMIC turn on GNSS - shell command was successful\n");
6973
}
7074
#endif
75+
7176
#if DT_NODE_EXISTS(DT_NODELABEL(sonycxd5605))
72-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read " I2C_1 " 24 10")) != 0)
73-
{
77+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read " I2C_1 " 24 10")) != 0) {
7478
rc |= ret;
7579
printf("i2c read " I2C_1 " 24 10 - Sony cxd5605 GNSS - shell command failed %d \n", ret);
7680
} else {
7781
printf("i2c read " I2C_1 " 24 10 - Sony cxd5605 GNSS - shell command was successful\n");
7882
}
7983
#endif
84+
8085
#if DT_NODE_EXISTS(DT_NODELABEL(tsl2540))
81-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " TSL2540)) != 0)
82-
{
86+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " TSL2540)) != 0) {
8387
rc |= ret;
8488
printf("sensor get " TSL2540 " - tsl25403 ambient light sensor - shell command failed %d \n", ret);
8589
} else {
8690
printf("sensor get " TSL2540 " - tsl25403 ambient light sensor - shell command was successful\n");
8791
}
8892
#endif
93+
8994
#if DT_NODE_EXISTS(DT_NODELABEL(murata_1sc))
90-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "tmo modem 1 imei")) != 0)
91-
{
95+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "tmo modem 1 imei")) != 0) {
9296
rc |= ret;
9397
printf("tmo modem 1 imei - murata 1sc- shell command failed %d \n", ret);
9498
} else {
9599
printf("tmo modem 1 imei - murata 1sc - shell command was successful\n");
96100
}
97101
#endif
102+
98103
#if DT_NODE_EXISTS(DT_NODELABEL(rs9116w))
99-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "tmo wifi status 2")) != 0)
100-
{
104+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "tmo wifi status 2")) != 0) {
101105
rc |= ret;
102106
printf("tmo wifi status 2 - rs9116w- shell command failed %d \n", ret);
103107
} else {
@@ -111,48 +115,57 @@ int misc_test()
111115
printf("tmo wifi scan 2 - rs9116w - shell command was successful\n");
112116
}
113117
#endif
118+
114119
#if DT_NODE_EXISTS(DT_NODELABEL(lis2dw12))
115-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " LIS2DW12)) != 0)
116-
{
120+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " LIS2DW12)) != 0) {
117121
rc |= ret;
118122
printf("sensor get " LIS2DW12 " - accelerometer - shell command failed %d \n", ret);
119123
} else {
120124
printf("sensor get " LIS2DW12 " - accelerometer - shell command was successful\n");
121125
}
122126
#endif
127+
123128
#if DT_NODE_EXISTS(DT_NODELABEL(lps22hh))
124-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " LPS22HH)) != 0)
125-
{
129+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " LPS22HH)) != 0) {
126130
rc |= ret;
127131
printf("sensor get " LPS22HH " - pressure sensor - shell command failed %d \n", ret);
128132
} else {
129133
printf("sensor get " LPS22HH " - pressure sensor - shell command was successful\n");
130134
}
131135
#endif
132-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "fs write /tmo/access_id.txt 30 31 32 33 0a 0d")) != 0)
133-
{
136+
137+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "fs write /tmo/access_id.txt 30 31 32 33 0a 0d")) != 0) {
134138
rc |= ret;
135139
printf("fs write /tmo/access_id.txt 30 31 32 33 0a 0d - SPI nor flash - shell command failed %d \n", ret);
136140
} else {
137141
printf("fs write /tmo/access_id.txt 30 31 32 33 0a 0d - SPI nor flash - shell command was successful\n");
138142
}
139-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "fs read /tmo/access_id.txt")) != 0)
140-
{
143+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "fs read /tmo/access_id.txt")) != 0) {
141144
rc |= ret;
142145
printf("fs read /tmo/access_id.txt - SPI nor flash - shell command failed %d \n", ret);
143146
} else {
144147
printf("fs read /tmo/access_id.txt - SPI nor flash - shell command was successful\n");
145148
}
146-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "fs rm /tmo/access_id.txt")) != 0)
147-
{
149+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "fs rm /tmo/access_id.txt")) != 0) {
148150
rc |= ret;
149151
printf("fs fs rm /tmo/access_id.txt - SPI nor flash - shell command failed %d \n", ret);
150152
} else {
151153
printf("fs rm /tmo/access_id.txt - SPI nor flash - shell command was successful\n");
152154
}
155+
153156
if (strcmp(CONFIG_BOARD, "tmo_dev_edge") == 0) {
154-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c scan " I2C_0)) != 0)
155-
{
157+
/* Check for presence of On Semi LC709204F fuel gauge
158+
* (battery must be present for this to pass)
159+
*/
160+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read " I2C_1 " 0xb 0x15 2")) != 0) {
161+
rc |= ret;
162+
printf("i2c read " I2C_1 "0xb 0x15 2 - LC709204F fuel gauge - shell command failed %d \n", ret);
163+
} else {
164+
printf("i2c read " I2C_1 "0xb 0x15 2 - LC709204F fuel gauge - shell command was successful\n");
165+
}
166+
167+
/* Scan the secondary I2C bus (I2C_0) */
168+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c scan " I2C_0)) != 0) {
156169
rc |= ret;
157170
printf("i2c scan " I2C_0 " - shell command failed %d \n", ret);
158171
} else {

samples/tmo_shell/src/tmo_shell.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,13 +2279,27 @@ K_TIMER_DEFINE(led_blink_timer, led_blnk_tmr_f, NULL);
22792279

22802280
int cmd_mfg_test(const struct shell *shell, size_t argc, char **argv)
22812281
{
2282-
k_timer_stop(&led_blink_timer);
22832282
int rc = 0;
2283+
22842284
shell_print(shell, "Run mfg tests...");
2285+
k_timer_stop(&led_blink_timer);
2286+
2287+
/* Print slot info */
2288+
#ifndef BOOT_SLOT
2289+
shell_print(shell, "Bootloader not in use");
2290+
#else
2291+
print_gecko_slot_info();
2292+
#endif
2293+
2294+
/* Print version of tmo_shell */
2295+
cmd_version(shell, argc, argv);
2296+
22852297
rc |= buzzer_test();
22862298
k_sleep(K_SECONDS(1));
2299+
22872300
rc |= led_test();
22882301
k_sleep(K_SECONDS(2));
2302+
22892303
rc |=misc_test();
22902304
#if CONFIG_TMO_TEST_MFG_CHECK_GOLDEN
22912305
rc |= golden_check();
@@ -2299,18 +2313,18 @@ int cmd_mfg_test(const struct shell *shell, size_t argc, char **argv)
22992313
shell_fprintf(shell_backend_uart_get_ptr(), SHELL_INFO, "TESTS PASSED\n");
23002314
} else if (rc == 0 && !fw_test_passed) {
23012315
led_on(pwm_dev, LED_PWM_BLUE); // Blue LED
2302-
shell_fprintf(shell_backend_uart_get_ptr(), SHELL_WARNING, "FIRMWARE OUT OF DATE\n");
2316+
shell_warn(shell, "FIRMWARE OUT OF DATE");
23032317
restore_led = LED_PWM_BLUE;
23042318
k_timer_start(&led_blink_timer, K_MSEC(500), K_SECONDS(1));
23052319
} else if (rc == 0 && !acc_code_test_passed) {
23062320
led_on(pwm_dev, LED_PWM_BLUE); // Blue LED
2307-
shell_fprintf(shell_backend_uart_get_ptr(), SHELL_WARNING, "ACCESS CODE FAILURE\n");
2321+
shell_warn(shell, "ACCESS CODE FAILURE");
23082322
restore_led = LED_PWM_BLUE;
23092323
k_timer_start(&led_blink_timer, K_MSEC(1), K_SECONDS(1));
23102324
} else {
23112325
led_on(pwm_dev, LED_PWM_RED); // Red LED
23122326
restore_led = LED_PWM_RED;
2313-
shell_fprintf(shell_backend_uart_get_ptr(), SHELL_ERROR, "TESTS FAILED\n");
2327+
shell_error(shell, "TESTS FAILED");
23142328
k_timer_start(&led_blink_timer, K_MSEC(500), K_MSEC(500));
23152329
}
23162330
return 0;

0 commit comments

Comments
 (0)