@@ -181,38 +181,23 @@ bool Commander::executeCommand( const char *cmd ){
181
181
// If show_description flag is set, than we have to print the description.
182
182
if ( show_description ){
183
183
184
- if ( memoryType == MEMORY_REGULAR ){
185
-
186
- // if( caller -> channel != NULL ){
187
-
188
- // Print the description text to the output channel.
189
- caller -> print ( commandData_ptr -> name );
190
- caller -> print ( ' :' );
191
- caller -> print ( ' ' );
192
- caller -> println ( commandData_ptr -> data.desc );
193
-
194
- // }
195
-
196
- }
197
-
198
- #ifdef __AVR__
199
-
200
- else if ( memoryType == MEMORY_PROGMEM ){
201
-
202
- // if( response != NULL ){
203
-
204
- // Print the description text to the output channel.
205
- caller -> print ( commandData_ptr -> name_P );
206
- caller -> print ( ' :' );
207
- caller -> print ( ' ' );
208
- caller -> println ( commandData_ptr -> data.desc_P );
209
-
210
- // }
211
-
212
- }
213
-
214
- #endif
215
-
184
+ #ifdef __AVR__
185
+ caller -> print ( commandData_ptr -> name );
186
+ caller -> print ( ' :' );
187
+ caller -> print ( ' ' );
188
+ if ( commandData_ptr -> data.desc ){
189
+ caller -> print ( commandData_ptr -> data.desc );
190
+ }
191
+ else if ( commandData_ptr -> data.desc_P ){
192
+ caller -> print ( commandData_ptr -> data.desc_P );
193
+ }
194
+ caller -> println ();
195
+ #else
196
+ caller -> print ( commandData_ptr -> name );
197
+ caller -> print ( ' :' );
198
+ caller -> print ( ' ' );
199
+ caller -> println ( commandData_ptr -> data.desc );
200
+ #endif
216
201
217
202
}
218
203
@@ -475,15 +460,8 @@ void Commander::printHelp( Stream* out, bool description, bool style ){
475
460
out -> print ( __CONST_TXT__ ( " \033 [1;32m" ) );
476
461
}
477
462
478
- if ( memoryType == MEMORY_REGULAR ){
479
- // out -> print( API_tree[ find_api_index_by_place( i ) ].name );
480
- out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> name );
481
- }
482
- #ifdef __AVR__
483
- else if ( memoryType == MEMORY_PROGMEM ){
484
- out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> name_P );
485
- }
486
- #endif
463
+ // out -> print( API_tree[ find_api_index_by_place( i ) ].name );
464
+ out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> name );
487
465
488
466
if ( style ){
489
467
out -> print ( __CONST_TXT__ ( " \033 [0;37m" ) );
@@ -497,13 +475,15 @@ void Commander::printHelp( Stream* out, bool description, bool style ){
497
475
498
476
out -> print ( __CONST_TXT__ ( " : " ) );
499
477
500
- if ( memoryType == MEMORY_REGULAR ){
501
- out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> data.desc );
502
- }
503
478
#ifdef __AVR__
504
- else if ( memoryType == MEMORY_PROGMEM ){
505
- out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> data.desc_P );
506
- }
479
+ if ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> data.desc ){
480
+ out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> data.desc );
481
+ }
482
+ else if ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> data.desc_P ){
483
+ out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> data.desc_P );
484
+ }
485
+ #else
486
+ out -> print ( regularCommands[ regularCommands.findIndexByPlace ( i ) ] -> data.desc );
507
487
#endif
508
488
509
489
out -> println ();
@@ -572,25 +552,6 @@ int Commander::hasChar( const char* str, char c, int number, bool ignoreString )
572
552
573
553
}
574
554
575
- /*
576
- #ifdef __AVR__
577
-
578
- int Commander::commander_strcmp_progmem( API_t* element1, API_t* element2 ){
579
-
580
- strncpy_P( progmemBuffer, ( PGM_P ) element1 -> name_P, COMMANDER_MAX_COMMAND_SIZE );
581
- return strcmp_P( progmemBuffer, ( PGM_P )element2 -> name_P );
582
-
583
- }
584
-
585
- int Commander::commander_strcmp_tree_ram_progmem( API_t* element1, const char* element2 ){
586
-
587
- return strcmp_P( element2, (PGM_P)element1 -> name_P ) * -1;
588
-
589
- }
590
-
591
- #endif
592
- */
593
-
594
555
void Commander::enableFormatting (){
595
556
formatting = true ;
596
557
}
0 commit comments