int main(void) { Error check_error = success; uint8 narrow; uint8 wide; os_sleep(100); CheckCleanup(os_boot(boot_module_table, LENGTH(boot_module_table)), boot_failure); CheckCleanup(record_command(0, null), record_failure); record_failure: narrow = 2; wide = 1; goto failure; boot_failure: narrow = 1; wide = os_boot_index(); goto failure; failure: while (!uart_character_ready()) led_signal(narrow, wide); error_stack_print(); write(PSTR("\r\n\r\nWavelogger v4.0\r\n")); write(PSTR("Reset reason: 0x%hx\r\n"), os_reset_reason()); shell_run(shell_command_table, LENGTH(shell_command_table)); return 0; }
/* ------------- entering return in command prompt */ G_MODULE_EXPORT void on_textEntry_Command_activate( GtkObject *object, gpointer user_data) { char cmd_buffer[256]; // copy it in strncpy(cmd_buffer, gtk_entry_get_text(GTK_ENTRY(object)), ARRAY_SIZE(cmd_buffer)-1); cmd_buffer[ARRAY_SIZE(cmd_buffer)-1]= 0; // clear it out.. gtk_entry_set_text(GTK_ENTRY(object), ""); /*only do something if a command was entered. Don't do anything if user just hit return*/ if(strcspn(cmd_buffer," ,\n\t")) { /* remember it */ record_command(cmd_buffer); /* call cmd multiplexor */ command_handler(cmd_buffer); } }