Skip to content

Commit 0f19335

Browse files
committed
Use extra_features instead of programmer name for arduino_as_isp
1 parent e618cec commit 0f19335

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/stk500.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -859,15 +859,12 @@ static int stk500_open(PROGRAMMER *pgm, const char *port) {
859859
if(stk500_getsync(pgm) < 0)
860860
return -1;
861861

862-
if(pgm->bitclock) {
863-
if(str_caseeq(pgmid, "arduino_as_isp")) // The Arduino as ISP will crash if we change the bitclock
862+
if(pgm->bitclock) { // Set bitclock if programmer can do so
863+
// Arduino as ISP will crash on changing the bitclock: HAS_BITCLOCK_ADJ bit is not set
864+
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
864865
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
865-
else {
866-
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
867-
pmsg_warning("setting bitclock despite HAS_BITCLOCK_ADJ missing in pgm->extra_features\n");
868-
if(pgm->set_sck_period(pgm, pgm->bitclock) != 0)
869-
return -1;
870-
}
866+
else if(pgm->set_sck_period(pgm, pgm->bitclock))
867+
return -1;
871868
}
872869

873870
return 0;

0 commit comments

Comments
 (0)