@@ -77,7 +77,6 @@ static void shell_prompt(); |
77 | 77 | */ |
78 | 78 | static void shell_format(const char * fmt, va_list va); |
79 | 79 |
|
80 | | - |
81 | 80 | bool shell_init(shell_reader_t reader, shell_writer_t writer, char * msg) |
82 | 81 | { |
83 | 82 | if (reader == 0 || writer == 0) |
@@ -141,7 +140,7 @@ void shell_print_error(int error, const char * field) |
141 | 140 | { |
142 | 141 | #ifdef ARDUINO |
143 | 142 | if (field != 0) { |
144 | | - shell_print_pm(PSTR("#ERROR-FIELD:")); |
| 143 | + shell_print_pm(PSTR("#ERROR-PARAM:")); |
145 | 144 | shell_print(field); |
146 | 145 | shell_print_pm(PSTR("\r\n")); |
147 | 146 | } |
@@ -174,24 +173,24 @@ void shell_print_error(int error, const char * field) |
174 | 173 | } |
175 | 174 | #else |
176 | 175 | if (field != 0) { |
177 | | - shell_print((const char *) "#ERROR-FIELD:"); |
| 176 | + shell_print((const char *) "#ERROR-PARAM:"); |
178 | 177 | shell_print(field); |
179 | 178 | shell_print("\r\n"); |
180 | 179 | } |
181 | 180 |
|
182 | 181 | shell_print((const char *) "#ERROR-TYPE:"); |
183 | 182 | switch (error) { |
184 | 183 | case E_SHELL_ERR_ARGCOUNT: |
185 | | - shell_print((const char *) "ARG_COUNT"); |
| 184 | + shell_print((const char *) "ARG-COUNT"); |
186 | 185 | break; |
187 | 186 | case E_SHELL_ERR_OUTOFRANGE: |
188 | | - shell_print((const char *) "OUT_OF_RANGE"); |
| 187 | + shell_print((const char *) "OUT-OF-RANGE"); |
189 | 188 | break; |
190 | 189 | case E_SHELL_ERR_VALUE: |
191 | | - shell_print((const char *) "INVALID_VALUE"); |
| 190 | + shell_print((const char *) "INVALID-VALUE"); |
192 | 191 | break; |
193 | 192 | case E_SHELL_ERR_ACTION: |
194 | | - shell_print((const char *) "INVALID_ACTION"); |
| 193 | + shell_print((const char *) "INVALID-ACTION"); |
195 | 194 | break; |
196 | 195 | case E_SHELL_ERR_PARSE: |
197 | 196 | shell_print((const char *) "PARSING"); |
@@ -216,6 +215,7 @@ void shell_print(const char * string) |
216 | 215 | } |
217 | 216 |
|
218 | 217 | #ifdef ARDUINO |
| 218 | + |
219 | 219 | void shell_print_pm(const char * string) |
220 | 220 | { |
221 | 221 | uint8_t c; |
@@ -234,7 +234,7 @@ void shell_println(const char * string) |
234 | 234 | #ifdef ARDUINO |
235 | 235 | shell_print_pm(PSTR("\r\n")); |
236 | 236 | #else |
237 | | - shell_print((const char *)"\r\n"); |
| 237 | + shell_print((const char *) "\r\n"); |
238 | 238 | #endif |
239 | 239 | } |
240 | 240 |
|
@@ -258,7 +258,7 @@ void shell_printf(const char * fmt, ...) |
258 | 258 | void shell_printf_pm(const char * fmt, ...) |
259 | 259 | { |
260 | 260 | // First copy to RAM |
261 | | - memcpy_P(shellfmtbuf, fmt, strlen_P(fmt)+1); |
| 261 | + memcpy_P(shellfmtbuf, fmt, strlen_P(fmt) + 1); |
262 | 262 | va_list argl; |
263 | 263 | va_start(argl, shellfmtbuf); |
264 | 264 | shell_format(shellfmtbuf, argl); |
@@ -326,7 +326,11 @@ void shell_task() |
326 | 326 | if (list[i].shell_program == 0) |
327 | 327 | continue; |
328 | 328 | // If string matches one on the list |
| 329 | +#ifdef ARDUINO |
| 330 | + if (!strcmp_P(argv_list[0], list[i].shell_command_string)) { |
| 331 | +#else |
329 | 332 | if (!strcmp(argv_list[0], list[i].shell_command_string)) { |
| 333 | +#endif |
330 | 334 | // Run the appropiate function |
331 | 335 | retval = list[i].shell_program(argc, argv_list); |
332 | 336 | finished = 0; |
@@ -348,6 +352,7 @@ void shell_task() |
348 | 352 |
|
349 | 353 | /*-------------------------------------------------------------*/ |
350 | 354 | /* Internal functions */ |
| 355 | + |
351 | 356 | /*-------------------------------------------------------------*/ |
352 | 357 | static int shell_parse(char * buf, char ** argv, unsigned short maxargs) |
353 | 358 | { |
|