Skip to content

Commit 6be2877

Browse files
authored
Merge pull request #54 from tmobile/tmo-Fix-test-in-116
Fix manufacturing tests in 1.16
2 parents e16c677 + 59eaffa commit 6be2877

File tree

1 file changed

+45
-35
lines changed

1 file changed

+45
-35
lines changed

samples/tmo_shell/src/misc_test.c

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,67 +12,77 @@
1212
#include <zephyr/shell/shell.h>
1313
#include <zephyr/shell/shell_uart.h>
1414

15+
#define I2C_1 DT_NODE_FULL_NAME(DT_NODELABEL(i2c1))
16+
17+
#if DT_NODE_EXISTS(DT_NODELABEL(as6212))
18+
#define TEMP_0 DT_NODE_FULL_NAME(DT_NODELABEL(as6212))
19+
#endif /* DT_NODE_EXISTS(DT_NODELABEL(as6212)) */
20+
21+
#if DT_NODE_EXISTS(DT_NODELABEL(tsl2540))
22+
#define TSL2540 DT_NODE_FULL_NAME(DT_NODELABEL(tsl2540))
23+
#endif /* DT_NODE_EXISTS(DT_NODELABEL(tsl2540)) */
24+
25+
#if DT_NODE_EXISTS(DT_NODELABEL(lis2dw12))
26+
#define LIS2DW12 DT_NODE_FULL_NAME(DT_NODELABEL(lis2dw12))
27+
#endif /* DT_NODE_EXISTS(DT_NODELABEL(lis2dw12)) */
28+
29+
#if DT_NODE_EXISTS(DT_NODELABEL(lps22hh))
30+
#define LPS22HH DT_NODE_FULL_NAME(DT_NODELABEL(lps22hh))
31+
#endif /* DT_NODE_EXISTS(DT_NODELABEL(lps22hh)) */
32+
1533
int misc_test()
1634
{
1735
int ret = 0, rc = 0;
1836

1937
#if DT_NODE_EXISTS(DT_NODELABEL(as6212))
20-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get TEMP_0")) != 0)
21-
{
22-
rc |= ret;
23-
printf("sensor get TEMP_0 - as6212 temp sensor - shell command failed %d \n", ret);
24-
} else {
25-
printf("sensor get TEMP_0 - as6212 temp sensor - shell command was successful\n");
26-
}
27-
#else
28-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get TEMP_0")) != 0)
38+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " TEMP_0)) != 0)
2939
{
3040
rc |= ret;
31-
printf("sensor get TEMP_0 - tmp108 temp sensor - shell command failed %d \n", ret);
41+
printf("sensor get " TEMP_0 " - as6212 temp sensor - shell command failed %d \n", ret);
3242
} else {
33-
printf("sensor get TEMP_0 - tmp108 temp sensor - shell command was successful\n");
43+
printf("sensor get " TEMP_0 " - as6212 temp sensor - shell command was successful\n");
3444
}
3545
#endif
3646
#if DT_NODE_EXISTS(DT_NODELABEL(bq24250))
37-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read_byte I2C_1 0x6a 0x3")) != 0)
47+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read_byte " I2C_1 " 0x6a 0x3")) != 0)
3848
{
3949
rc |= ret;
40-
printf("i2c read_byte I2C_1 0x6a 0x3 - BQ24250 voltage regulator- shell command failed %d \n", ret);
50+
printf("i2c read_byte " I2C_1 " 0x6a 0x3 - BQ24250 voltage regulator- shell command failed %d \n", ret);
4151
} else {
42-
printf("i2c read_byte I2C_1 0x6a 0x3 - BQ24250 voltage regulator- shell command was successful\n");
52+
printf("i2c read_byte " I2C_1 " 0x6a 0x3 - BQ24250 voltage regulator- shell command was successful\n");
4353
}
4454
#else
45-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read I2C_1 25 10")) != 0)
55+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read " I2C_1 " 25 10")) != 0)
4656
{
4757
rc |= ret;
48-
printf("i2c read I2C_1 25 10 - ACT81460 PMIC - shell command failed %d \n", ret);
58+
printf("i2c read " I2C_1 " 25 10 - ACT81460 PMIC - shell command failed %d \n", ret);
4959
} else {
50-
printf("i2c read I2C_1 25 10 - ACT81460 PMIC - shell command was successful\n");
60+
printf("i2c read " I2C_1 " 25 10 - ACT81460 PMIC - shell command was successful\n");
5161
}
52-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c write_byte I2C_1 25 47 98")) != 0)
62+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c write_byte " I2C_1 " 25 47 98")) != 0)
5363
{
5464
rc |= ret;
55-
printf("i2c write_byte I2C_1 25 47 98 - ACT81460 PMIC turn on GNSS - shell command failed %d \n", ret);
65+
printf("i2c write_byte " I2C_1 " 25 47 98 - ACT81460 PMIC turn on GNSS - shell command failed %d \n", ret);
5666
} else {
57-
printf("i2c write_byte I2C_1 25 47 98 - ACT81460 PMIC turn on GNSS - shell command was successful\n");
67+
printf("i2c write_byte " I2C_1 " 25 47 98 - ACT81460 PMIC turn on GNSS - shell command was successful\n");
5868
}
5969
#endif
6070
#if DT_NODE_EXISTS(DT_NODELABEL(sonycxd5605))
61-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read I2C_1 24 10")) != 0)
71+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c read " I2C_1 " 24 10")) != 0)
6272
{
6373
rc |= ret;
64-
printf("i2c read I2C_1 24 10 - Sony cxd5605 GNSS - shell command failed %d \n", ret);
74+
printf("i2c read " I2C_1 " 24 10 - Sony cxd5605 GNSS - shell command failed %d \n", ret);
6575
} else {
66-
printf("i2c read I2C_1 24 10 - Sony cxd5605 GNSS - shell command was successful\n");
76+
printf("i2c read " I2C_1 " 24 10 - Sony cxd5605 GNSS - shell command was successful\n");
6777
}
6878
#endif
6979
#if DT_NODE_EXISTS(DT_NODELABEL(tsl2540))
70-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get TSL2540")) != 0)
80+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " TSL2540)) != 0)
7181
{
7282
rc |= ret;
73-
printf("sensor get TSL2540 - tsl25403 ambient light sensor - shell command failed %d \n", ret);
83+
printf("sensor get " TSL2540 " - tsl25403 ambient light sensor - shell command failed %d \n", ret);
7484
} else {
75-
printf("sensor get TSL2540 - tsl25403 ambient light sensor - shell command was successful\n");
85+
printf("sensor get " TSL2540 " - tsl25403 ambient light sensor - shell command was successful\n");
7686
}
7787
#endif
7888
#if DT_NODE_EXISTS(DT_NODELABEL(murata_1sc))
@@ -101,21 +111,21 @@ int misc_test()
101111
}
102112
#endif
103113
#if DT_NODE_EXISTS(DT_NODELABEL(lis2dw12))
104-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get LIS2DW12")) != 0)
114+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " LIS2DW12)) != 0)
105115
{
106116
rc |= ret;
107-
printf("sensor get LIS2DW12 - accelerometer - shell command failed %d \n", ret);
117+
printf("sensor get " LIS2DW12 " - accelerometer - shell command failed %d \n", ret);
108118
} else {
109-
printf("sensor get LIS2DW12 - accelerometer - shell command was successful\n");
119+
printf("sensor get " LIS2DW12 " - accelerometer - shell command was successful\n");
110120
}
111121
#endif
112122
#if DT_NODE_EXISTS(DT_NODELABEL(lps22hh))
113-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get LPS22HH")) != 0)
123+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "sensor get " LPS22HH)) != 0)
114124
{
115125
rc |= ret;
116-
printf("sensor get LPS22HH - pressure sensor - shell command failed %d \n", ret);
126+
printf("sensor get " LPS22HH " - pressure sensor - shell command failed %d \n", ret);
117127
} else {
118-
printf("sensor get LPS22HH - pressure sensor - shell command was successful\n");
128+
printf("sensor get " LPS22HH " - pressure sensor - shell command was successful\n");
119129
}
120130
#endif
121131
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "fs write /tmo/access_id.txt 30 31 32 33 0a 0d")) != 0)
@@ -140,12 +150,12 @@ int misc_test()
140150
printf("fs rm /tmo/access_id.txt - SPI nor flash - shell command was successful\n");
141151
}
142152
if (strcmp(CONFIG_BOARD, "tmo_dev_edge") == 0) {
143-
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c scan I2C_1")) != 0)
153+
if ((ret = shell_execute_cmd(shell_backend_uart_get_ptr(), "i2c scan " I2C_1)) != 0)
144154
{
145155
rc |= ret;
146-
printf("i2c scan I2C_1 - shell command failed %d \n", ret);
156+
printf("i2c scan " I2C_1 " - shell command failed %d \n", ret);
147157
} else {
148-
printf("i2c scan I2C_1 - shell command was successful\n");
158+
printf("i2c scan " I2C_1 " - shell command was successful\n");
149159
}
150160
}
151161
return rc;

0 commit comments

Comments
 (0)