@@ -309,7 +309,10 @@ void IRAM_ATTR systemBus::service()
309309 if (data.secondary == IEC_OPEN || data.secondary == IEC_REOPEN)
310310 {
311311 // pull ( PIN_IEC_SRQ );
312- protocol = selectProtocol ();
312+ if ( detected_protocol != PROTOCOL_SERIAL)
313+ {
314+ protocol = selectProtocol ();
315+ }
313316 // release ( PIN_IEC_SRQ );
314317 }
315318
@@ -336,8 +339,11 @@ void IRAM_ATTR systemBus::service()
336339 // Debug_printv("bus[%d] device[%d] flags[%d]", state, device_state, flags);
337340
338341 // Switch back to standard serial
339- detected_protocol = PROTOCOL_SERIAL;
340- protocol = selectProtocol ();
342+ if ( detected_protocol != PROTOCOL_SERIAL)
343+ {
344+ detected_protocol = PROTOCOL_SERIAL;
345+ protocol = selectProtocol ();
346+ }
341347 // release ( PIN_IEC_SRQ );
342348 }
343349
@@ -836,14 +842,14 @@ void IRAM_ATTR systemBus::deviceListen()
836842void IRAM_ATTR systemBus::deviceTalk ()
837843{
838844 // Now do bus turnaround
839- pull (PIN_IEC_SRQ);
845+ // pull(PIN_IEC_SRQ);
840846 if (!turnAround ())
841847 {
842848 Debug_printv (" error flags[%d]" , flags);
843849 state = BUS_ERROR;
844850 return ;
845851 }
846- release (PIN_IEC_SRQ);
852+ // release(PIN_IEC_SRQ);
847853
848854 // We have recieved a CMD and we should talk now:
849855 state = BUS_PROCESS;
@@ -881,12 +887,13 @@ bool IRAM_ATTR systemBus::turnAround()
881887 return false ; // return error because timeout
882888 }
883889 release ( PIN_IEC_DATA_OUT );
890+ protocol->wait ( TIMING_Ttcp );
884891 pull ( PIN_IEC_CLK_OUT );
885892 // release ( PIN_IEC_SRQ );
886893
887894 // 80us minimum delay after TURNAROUND
888895 // *** IMPORTANT!
889- protocol->wait ( TIMING_Tda, false );
896+ protocol->wait ( TIMING_Tda );
890897
891898 return true ;
892899} // turnAround
0 commit comments