Switch isp/twi mode with progmode commands

This commit is contained in:
Olaf Rempel 2020-01-26 00:15:12 +01:00
parent 144016f65d
commit afd7b92c1f
1 changed files with 9 additions and 13 deletions

View File

@ -396,12 +396,6 @@ static void cmd_handler_isp(uint8_t cmd)
{ {
switch (cmd) switch (cmd)
{ {
/* Enter programming mode */
case 'P':
reset_statemachine_wait(EV_PROG_ENTER);
uart_send((m_state == STATE_RESET_PROGMODE) ? '\r' : '!');
break;
/* Write program memory, low byte */ /* Write program memory, low byte */
case 'c': case 'c':
m_led_mode = LED_FAST; m_led_mode = LED_FAST;
@ -629,12 +623,6 @@ static void cmd_handler_twi(uint8_t cmd)
{ {
switch (cmd) switch (cmd)
{ {
/* Enter programming mode */
case 'P':
reset_statemachine_wait(EV_PROG_ENTER_TWI);
uart_send((m_state == STATE_TWI_PROGMODE) ? '\r' : '!');
break;
/* Chip erase */ /* Chip erase */
case 'e': case 'e':
uart_send('\r'); uart_send('\r');
@ -771,6 +759,15 @@ static void cmdloop(void)
cmd = uart_recv(); cmd = uart_recv();
switch (cmd) switch (cmd)
{ {
/* Enter programming mode */
case 'P':
reset_statemachine_wait(EV_PROG_ENTER);
uart_send((m_state == STATE_RESET_PROGMODE) ? '\r' : '!');
#if (USE_TWI_SUPPORT)
m_twi_address = 0x00;
#endif
break;
/* Autoincrement address */ /* Autoincrement address */
case 'a': case 'a':
uart_send('Y'); uart_send('Y');
@ -864,7 +861,6 @@ static void cmdloop(void)
} }
else else
{ {
m_twi_address = 0x00;
uart_send('!'); uart_send('!');
} }
} }