mirror of
https://github.com/dgis/emu48android
synced 2024-12-26 09:58:49 +01:00
Last fix for serial.
This commit is contained in:
parent
b944404deb
commit
2d5262c511
5 changed files with 20 additions and 35 deletions
23
ReadMe.txt
23
ReadMe.txt
|
@ -32,10 +32,13 @@ NOTES
|
||||||
everything that you store in port 2 is lost just because the file "rom.49g" is READONLY.
|
everything that you store in port 2 is lost just because the file "rom.49g" is READONLY.
|
||||||
Since version 2.0, it is now possible from the menu to manage the Flash ROM file (it will fully replaces the ROM).
|
Since version 2.0, it is now possible from the menu to manage the Flash ROM file (it will fully replaces the ROM).
|
||||||
- To speed up printing, set the 'delay' to 0 in the calculator's print options.
|
- To speed up printing, set the 'delay' to 0 in the calculator's print options.
|
||||||
- The serial ports, wire or infrared (infrared limited to 2400 baud) are now supported through the USB port in mode OTG.
|
- The serial ports, wire or infrared (infrared limited to 2400 baud) can now be used through the USB port in mode OTG.
|
||||||
It uses the library https://github.com/mik3y/usb-serial-for-android, which allows to plug most of the serial USB adapters (only tested with Prolific),
|
It uses the library https://github.com/mik3y/usb-serial-for-android, which allows to plug most of the serial USB adapters (only tested with Prolific and Ch34x),
|
||||||
without the need to be root. If it is not automatic, please, activate the OTG mode in your Android device, and then,
|
without the need to be root. If it is not automatic, please, activate the OTG mode in your Android device, and then,
|
||||||
you should be able to see it in the Emu48 settings. If the adapter is unplugged then plugged back in, you may need to set the option again.
|
you should be able to see it in the Emu48 settings.
|
||||||
|
It is still experimental and I see some issues when sending characters from the emulator to a real HP48 or HP49 with the kermit protocol.
|
||||||
|
For the moment, the communication has been artificially slowed down in this direction.
|
||||||
|
If the adapter is unplugged then plugged back in, you may need to call OPENIO/CLOSEIO.
|
||||||
|
|
||||||
|
|
||||||
NOT WORKING YET
|
NOT WORKING YET
|
||||||
|
@ -57,22 +60,12 @@ CHANGES
|
||||||
|
|
||||||
Version 2.3 (2021-09-xx)
|
Version 2.3 (2021-09-xx)
|
||||||
|
|
||||||
- Add the serial port support (via USB OTG).
|
- Add an experimental serial port support (via USB OTG).
|
||||||
FIX: When stop the app, Serial exception seems to delay the save of the calc state!!!!
|
|
||||||
FIX: Inform if the connection is not possible.
|
|
||||||
FIX: No 'No driver' on real device
|
|
||||||
FIX: ID change -> replace id by vendor:device ids?
|
|
||||||
BUG: From Windows to Android with HP49G QINHENG CH340 -> all character at once bug
|
|
||||||
No issue with Prolific PL2303GT3
|
|
||||||
Not reproducible!
|
|
||||||
BUG: When openIO on real device, 1st OPENIO failed, 2nd OPENIO succeeded
|
|
||||||
TEST: With real HP48SX
|
|
||||||
TODO: Check the self test about UART
|
|
||||||
- Show KML log on request.
|
- Show KML log on request.
|
||||||
- Allows pressing a calculator button with the right button of the mouse and prevents its release to allow the On+A+F key combination (with Android version >= 5.0).
|
- Allows pressing a calculator button with the right button of the mouse and prevents its release to allow the On+A+F key combination (with Android version >= 5.0).
|
||||||
- Update the embedded help file "Emu48.html" to the latest version.
|
- Update the embedded help file "Emu48.html" to the latest version.
|
||||||
- Open an external web browser when you click an external links in the Help.
|
- Open an external web browser when you click an external links in the Help.
|
||||||
- Add Real blue 50g faceplate based on Eric KML script.
|
- Add Real blue 50g faceplate based on my calculator and on the KML script from Eric Rechlin.
|
||||||
|
|
||||||
|
|
||||||
Version 2.2 (2020-12-09)
|
Version 2.2 (2020-12-09)
|
||||||
|
|
|
@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.4.1)
|
||||||
#add_compile_options(-DDEBUG_ANDROID_PAINT)
|
#add_compile_options(-DDEBUG_ANDROID_PAINT)
|
||||||
#add_compile_options(-DDEBUG_ANDROID_THREAD)
|
#add_compile_options(-DDEBUG_ANDROID_THREAD)
|
||||||
#add_compile_options(-DDEBUG_ANDROID_FILE)
|
#add_compile_options(-DDEBUG_ANDROID_FILE)
|
||||||
add_compile_options(-DDEBUG_ANDROID_SERIAL)
|
#add_compile_options(-DDEBUG_ANDROID_SERIAL)
|
||||||
|
|
||||||
#add_compile_options(-DNEW_WIN32_SOUND_ENGINE)
|
#add_compile_options(-DNEW_WIN32_SOUND_ENGINE)
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,13 @@ NOTES
|
||||||
everything that you store in port 2 is lost just because the file "rom.49g" is READONLY.
|
everything that you store in port 2 is lost just because the file "rom.49g" is READONLY.
|
||||||
Since version 2.0, it is now possible from the menu to manage the Flash ROM file (it will fully replaces the ROM).
|
Since version 2.0, it is now possible from the menu to manage the Flash ROM file (it will fully replaces the ROM).
|
||||||
- To speed up printing, set the 'delay' to 0 in the calculator's print options.
|
- To speed up printing, set the 'delay' to 0 in the calculator's print options.
|
||||||
- The serial ports, wire or infrared (infrared limited to 2400 baud) are now supported through the USB port in mode OTG.
|
- The serial ports, wire or infrared (infrared limited to 2400 baud) can now be used through the USB port in mode OTG.
|
||||||
It uses the library https://github.com/mik3y/usb-serial-for-android, which allows to plug most of the serial USB adapters (only tested with Prolific),
|
It uses the library https://github.com/mik3y/usb-serial-for-android, which allows to plug most of the serial USB adapters (only tested with Prolific and Ch34x),
|
||||||
without the need to be root. If it is not automatic, please, activate the OTG mode in your Android device, and then,
|
without the need to be root. If it is not automatic, please, activate the OTG mode in your Android device, and then,
|
||||||
you should be able to see it in the Emu48 settings. If the adapter is unplugged then plugged back in, you may need to set the option again.
|
you should be able to see it in the Emu48 settings.
|
||||||
|
It is still experimental and I see some issues when sending characters from the emulator to a real HP48 or HP49 with the kermit protocol.
|
||||||
|
For the moment, the communication has been artificially slowed down in this direction.
|
||||||
|
If the adapter is unplugged then plugged back in, you may need to call OPENIO/CLOSEIO.
|
||||||
|
|
||||||
|
|
||||||
NOT WORKING YET
|
NOT WORKING YET
|
||||||
|
@ -57,12 +60,12 @@ CHANGES
|
||||||
|
|
||||||
Version 2.3 (2021-09-xx)
|
Version 2.3 (2021-09-xx)
|
||||||
|
|
||||||
- Add the serial port support (via USB OTG).
|
- Add an experimental serial port support (via USB OTG).
|
||||||
- Show KML log on request.
|
- Show KML log on request.
|
||||||
- Allows pressing a calculator button with the right button of the mouse and prevents its release to allow the On+A+F key combination (with Android version >= 5.0).
|
- Allows pressing a calculator button with the right button of the mouse and prevents its release to allow the On+A+F key combination (with Android version >= 5.0).
|
||||||
- Update the embedded help file "Emu48.html" to the latest version.
|
- Update the embedded help file "Emu48.html" to the latest version.
|
||||||
- Open an external web browser when you click an external links in the Help.
|
- Open an external web browser when you click an external links in the Help.
|
||||||
- Add Real blue 50g faceplate based on Eric KML script.
|
- Add Real blue 50g faceplate based on my calculator and on the KML script from Eric Rechlin.
|
||||||
|
|
||||||
|
|
||||||
Version 2.2 (2020-12-09)
|
Version 2.2 (2020-12-09)
|
||||||
|
|
|
@ -336,7 +336,7 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,LPDWO
|
||||||
SERIAL_LOGD("WriteFile(hFile: %p, lpBuffer: 0x%08x, nNumberOfBytesToWrite: %d) -> %d bytes\n%s", hFile, lpBuffer, nNumberOfBytesToWrite, writenByteCount, hexAsciiDump);
|
SERIAL_LOGD("WriteFile(hFile: %p, lpBuffer: 0x%08x, nNumberOfBytesToWrite: %d) -> %d bytes\n%s", hFile, lpBuffer, nNumberOfBytesToWrite, writenByteCount, hexAsciiDump);
|
||||||
free(hexAsciiDump);
|
free(hexAsciiDump);
|
||||||
#endif
|
#endif
|
||||||
//Sleep(4); // Seems to be needed else the kermit packet does not fully reach the genuine calculator.
|
Sleep(4); // Seems to be needed else the kermit packet does not fully reach the genuine calculator.
|
||||||
if(lpNumberOfBytesWritten)
|
if(lpNumberOfBytesWritten)
|
||||||
*lpNumberOfBytesWritten = (DWORD) writenByteCount;
|
*lpNumberOfBytesWritten = (DWORD) writenByteCount;
|
||||||
return writenByteCount >= 0;
|
return writenByteCount >= 0;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.regex.Pattern;
|
||||||
public class Serial {
|
public class Serial {
|
||||||
|
|
||||||
private static final String TAG = "Serial";
|
private static final String TAG = "Serial";
|
||||||
private final boolean debug = true;
|
private final boolean debug = false;
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final int serialPortId;
|
private final int serialPortId;
|
||||||
|
@ -260,22 +260,11 @@ public class Serial {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
long maxWritePeriod = 4; //ms
|
|
||||||
long lastTime = 0;
|
|
||||||
public synchronized int write(byte[] data) {
|
public synchronized int write(byte[] data) {
|
||||||
if(!connected)
|
if(!connected)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
long currentTime = SystemClock.elapsedRealtime();
|
if(debug) Log.d(TAG, "write(data: [" + data.length + "]: " + Utils.bytesToHex(data) + ")");
|
||||||
long writePeriod = currentTime - lastTime;
|
|
||||||
|
|
||||||
if(debug) Log.d(TAG, "write(data: [" + data.length + "]: " + Utils.bytesToHex(data) + ") writePeriod: " + writePeriod + "ms");
|
|
||||||
|
|
||||||
if(lastTime > 0 && writePeriod < maxWritePeriod) {
|
|
||||||
// Wait 1ms - (currentTime - lastTime)ms
|
|
||||||
android.os.SystemClock.sleep(maxWritePeriod - writePeriod);
|
|
||||||
}
|
|
||||||
lastTime = SystemClock.elapsedRealtime();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
usbSerialPort.write(data, WRITE_WAIT_MILLIS);
|
usbSerialPort.write(data, WRITE_WAIT_MILLIS);
|
||||||
|
|
Loading…
Reference in a new issue