diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e8985bb..f9b4484 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -49,6 +49,7 @@ body: label: Driver Version description: What version of the driver are you running? Check with `RPI a2version` options: + - 002B (fix keyboard delay) - 002A (reduce CPU usage) - 0029 (fix hang after shell exit) - 0028 (add live drive loading and regeneration) diff --git a/RaspberryPi/apple2driver/a2io/communication.go b/RaspberryPi/apple2driver/a2io/communication.go index e10be7d..0021b22 100644 --- a/RaspberryPi/apple2driver/a2io/communication.go +++ b/RaspberryPi/apple2driver/a2io/communication.go @@ -15,7 +15,7 @@ type A2Io interface { WriteString(outString string) error WriteBlock(buffer []byte) error WriteBuffer(buffer []byte) error - ReadByte() (byte, error) + ReadByte(noDelay ...bool) (byte, error) ReadString() (string, error) ReadBlock(buffer []byte) error SendCharacter(character byte) diff --git a/RaspberryPi/apple2driver/a2io/gpio.go b/RaspberryPi/apple2driver/a2io/gpio.go index c8a3fe5..853ae7b 100644 --- a/RaspberryPi/apple2driver/a2io/gpio.go +++ b/RaspberryPi/apple2driver/a2io/gpio.go @@ -154,7 +154,7 @@ func (a2 A2Gpio) WriteString(outString string) error { } // ReadByte reads a byte from the Apple II via Raspberry Pi's GPIO ports -func (a2 A2Gpio) ReadByte() (byte, error) { +func (a2 A2Gpio) ReadByte(noDelay ...bool) (byte, error) { // let the Apple II know we are ready to read outRead.Low() @@ -168,7 +168,9 @@ func (a2 A2Gpio) ReadByte() (byte, error) { return 0, errors.New("timed out reading byte -- write stuck high") } if time.Since(lastSleepTime) > edgeTimeout/10 { - sleepDuration *= 3; + if len(noDelay) == 0 || !noDelay[0] { + sleepDuration *= 3; + } time.Sleep(time.Millisecond * time.Duration(sleepDuration)); lastSleepTime = time.Now() } @@ -225,7 +227,9 @@ func (a2 A2Gpio) ReadByte() (byte, error) { return 0, errors.New("timed out reading byte -- write stuck low") } if time.Since(lastSleepTime) > edgeTimeout/10 { - sleepDuration *= 3; + if len(noDelay) == 0 || !noDelay[0] { + sleepDuration *= 3; + } time.Sleep(time.Millisecond * time.Duration(sleepDuration)); lastSleepTime = time.Now() } diff --git a/RaspberryPi/apple2driver/a2io/mockio.go b/RaspberryPi/apple2driver/a2io/mockio.go index fed6172..8afa862 100644 --- a/RaspberryPi/apple2driver/a2io/mockio.go +++ b/RaspberryPi/apple2driver/a2io/mockio.go @@ -66,7 +66,7 @@ func (mockIo MockIo) WriteBuffer(buffer []byte) error { } // ReadByte mocks reading a byte from the Apple II -func (mockIo MockIo) ReadByte() (byte, error) { +func (mockIo MockIo) ReadByte(noDelay ...bool) (byte, error) { b := mockIo.Data.BytesToRead[mockIo.Data.NumberBytesRead] mockIo.Data.NumberBytesRead++ return b, mockIo.Data.ErrorToThrow diff --git a/RaspberryPi/apple2driver/a2io/userio.go b/RaspberryPi/apple2driver/a2io/userio.go index d590125..3568f79 100644 --- a/RaspberryPi/apple2driver/a2io/userio.go +++ b/RaspberryPi/apple2driver/a2io/userio.go @@ -55,7 +55,7 @@ func (userIo UserIo) WriteBuffer(buffer []byte) error { } // ReadByte simulates reading to the Apple II but uses stdin instead -func (userIo UserIo) ReadByte() (byte, error) { +func (userIo UserIo) ReadByte(noDelay ...bool) (byte, error) { fmt.Printf("ReadByte: ") var b byte fmt.Scanf("%x", &b) diff --git a/RaspberryPi/apple2driver/a2io/vt100.go b/RaspberryPi/apple2driver/a2io/vt100.go index 51c4693..486f35e 100644 --- a/RaspberryPi/apple2driver/a2io/vt100.go +++ b/RaspberryPi/apple2driver/a2io/vt100.go @@ -220,7 +220,7 @@ func sendCharacter(comm A2Io, b byte) { } func readCharacter(comm A2Io) (string, error) { - b, err := comm.ReadByte() + b, err := comm.ReadByte(true) var s = string(b) if err == nil { if applicationMode { diff --git a/RaspberryPi/apple2driver/driver.go b/RaspberryPi/apple2driver/driver.go index d36ed12..08f2200 100644 --- a/RaspberryPi/apple2driver/driver.go +++ b/RaspberryPi/apple2driver/driver.go @@ -75,7 +75,7 @@ func main() { } // temporary workaround for busy wait loop heating up the RPi } else { - time.Sleep(time.Millisecond * 100) + time.Sleep(time.Millisecond * 200) } } } diff --git a/RaspberryPi/apple2driver/info/version.go b/RaspberryPi/apple2driver/info/version.go index e71e0bb..71e5e5b 100644 --- a/RaspberryPi/apple2driver/info/version.go +++ b/RaspberryPi/apple2driver/info/version.go @@ -8,4 +8,4 @@ package info // Version is the hexadecimal version number that // should be incremented with each driver update -const Version = "002A" +const Version = "002B"