# HG changeset patch # User David Douard # Date 1605043295 -3600 # Node ID 279868684eb39ab86a01bb90c77c878b718d1a86 # Parent c146d19101a3de2b570a726a84db1fd1aaf01e07 Remove now dead/useless code diff -r c146d19101a3 -r 279868684eb3 src/hp34comm.cpp --- a/src/hp34comm.cpp Mon Nov 09 23:05:24 2020 +0100 +++ b/src/hp34comm.cpp Tue Nov 10 22:21:35 2020 +0100 @@ -8,13 +8,6 @@ #define RXTIMEOUT 50ms #define STARTUPRETRY 0.5 -uint8_t startup_seq[] = { - 0x33, - 0x02, // 0x02? - 0x00, - 0x00, -}; - HPSerial::statemethod HPSerial::state_table[NUM_STATES] = { &HPSerial::do_state_initial, // STATE_IDLE &HPSerial::do_state_command, // STATE_COMMAND @@ -36,34 +29,8 @@ serial.attach(callback(this, &HPSerial::rx_irq), SerialBase::RxIrq); } -void HPSerial::startup(uint8_t keycode) { - cur_gstate = GSTATE_STARTING; - if (keycode != 0xFF) { - printf("Set startup keycode to %X\n", keycode); - startup_seq[2] = 0xFF; - startup_seq[3] = keycode; - } - else - startup_seq[2] = 0x00; - set_timer(10ms); // launch the startup in 10ms -} - -void HPSerial::_startup(void) -{ - cur_gstate = GSTATE_STARTING; - tr_data.cmd = 0xFF; - tr_data.pos = 0; - - if (startup_seq[2] == 0xFF) - tr_data.size = 4; - else - tr_data.size = 3; // sizeof(startup_seq); - for(uint8_t i=0; i*(HPSerial::state_table[cur_state]))(c); }; + void HPSerial::rx_irq(void) { uint8_t val; if(serial.readable()) @@ -367,11 +335,6 @@ void HPSerial::timeout(void) { set_timer(); // detach the timeouter - if (cur_gstate == GSTATE_STARTING) - _startup(); - else // CPU took too long to reply, reset - { - cur_gstate = GSTATE_IDLE; - cur_state = STATE_IDLE; - } + cur_gstate = GSTATE_IDLE; + cur_state = STATE_IDLE; } diff -r c146d19101a3 -r 279868684eb3 src/hp34comm.h --- a/src/hp34comm.h Mon Nov 09 23:05:24 2020 +0100 +++ b/src/hp34comm.h Tue Nov 10 22:21:35 2020 +0100 @@ -30,9 +30,7 @@ bool cmd_buf_full(void); unsigned int nerrors(uint8_t errorno); - void startup(uint8_t keycode=0xFF); void sendkey(uint8_t keycode); - void send_key_when_idle(); void send_startup_seq(); void send_startup_seq(uint8_t keycode); @@ -104,7 +102,6 @@ char payload[MAX_BUFF]; } state_data_t; - void _startup(void); state_t do_state_initial(uint8_t c=0x00); state_t do_state_command(uint8_t c); state_t do_state_payload_size(uint8_t c);