Compare commits
3 Commits
ef29cf88e1
...
a17c8b1977
Author | SHA1 | Date |
---|---|---|
camh | a17c8b1977 | |
camh | 41130edc2f | |
camh | 53e2f4dba0 |
|
@ -626,6 +626,7 @@ class iMessageGraphClientClass {
|
|||
console.log(`return success`)
|
||||
|
||||
canStart = true
|
||||
lastMessageFromSerialPortTime = new Date()
|
||||
|
||||
return `success`
|
||||
}
|
||||
|
@ -638,6 +639,8 @@ class iMessageClient {
|
|||
|
||||
constructor () {
|
||||
|
||||
canStart = false
|
||||
|
||||
// kick off an update interval
|
||||
const updateInterval = setInterval(async () => {
|
||||
|
||||
|
@ -652,9 +655,9 @@ class iMessageClient {
|
|||
return
|
||||
}
|
||||
|
||||
if (new Date() - lastMessageFromSerialPortTime > 30000) {
|
||||
if (new Date() - lastMessageFromSerialPortTime > 300000) {
|
||||
|
||||
console.log(`${intervalDate}: no serial comms for 30 seconds, unloading interval`)
|
||||
console.log(`${intervalDate}: no serial comms for 300 seconds, unloading interval`)
|
||||
|
||||
clearInterval(updateInterval)
|
||||
|
||||
|
|
|
@ -9,8 +9,11 @@ Serial implementation:
|
|||
https://opensource.apple.com/source/gdb/gdb-186.1/src/gdb/ser-mac.c?txt
|
||||
http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/Devices/Devices-320.html
|
||||
*/
|
||||
OSErr writeSerialPortDebug(short refNum, const char* str)
|
||||
{
|
||||
|
||||
short serialPort;
|
||||
|
||||
OSErr setupDebugSerialPort(short refNum) {
|
||||
|
||||
#ifdef PROFILING
|
||||
|
||||
// we need to bail on profiling, because the profile watcher will be reading this serial port
|
||||
|
@ -33,21 +36,37 @@ OSErr writeSerialPortDebug(short refNum, const char* str)
|
|||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
OSErr err;
|
||||
short serialPort = 0;
|
||||
serialPort = 0;
|
||||
err = OpenDriver(nameStr, &serialPort);
|
||||
if (err < 0) return err;
|
||||
|
||||
if (err < 0) return err;
|
||||
|
||||
CntrlParam cb2;
|
||||
cb2.ioCRefNum = serialPort;
|
||||
cb2.csCode = 8;
|
||||
cb2.csParam[0] = stop10 | noParity | data8 | baud9600;
|
||||
err = PBControl ((ParmBlkPtr) & cb2, 0);
|
||||
if (err < 0) return err;
|
||||
|
||||
|
||||
err = PBControl ((ParmBlkPtr) & cb2, 0);
|
||||
|
||||
if (err < 0) {
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OSErr writeSerialPortDebug(short refNum, const char* str)
|
||||
{
|
||||
#ifdef PROFILING
|
||||
|
||||
// we need to bail on profiling, because the profile watcher will be reading this serial port
|
||||
return;
|
||||
|
||||
#endif
|
||||
IOParam pb2;
|
||||
pb2.ioRefNum = serialPort;
|
||||
|
||||
|
@ -56,7 +75,7 @@ OSErr writeSerialPortDebug(short refNum, const char* str)
|
|||
pb2.ioBuffer = (Ptr) str2;
|
||||
pb2.ioReqCount = strlen(str2);
|
||||
|
||||
err = PBWrite((ParmBlkPtr)& pb2, 0);
|
||||
OSErr err = PBWrite((ParmBlkPtr)& pb2, 0);
|
||||
if (err < 0) return err;
|
||||
|
||||
// hangs on Mac512K (write hasn't finished due to slow Speed when we wants to close driver
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
OSErr setupDebugSerialPort(short refNum);
|
||||
OSErr writeSerialPortDebug(short refNum, const char* str);
|
|
@ -271,13 +271,15 @@ void readSerialPort(char* output) {
|
|||
serGetBufStatus = SerGetBuf(incomingSerialPortReference.ioRefNum, &byteCount);
|
||||
|
||||
if (serGetBufStatus != 0 && PRINT_ERRORS) {
|
||||
|
||||
|
||||
printf("potential problem with serGetBufStatus:\n");
|
||||
char debugMessage[100];
|
||||
sprintf(debugMessage, "serGetBufStatus: %d\n", serGetBufStatus);
|
||||
printf(debugMessage);
|
||||
}
|
||||
|
||||
// basically, we're stating that if we have a stall for 2 iterations of the loop where the byteCounts are matching, then
|
||||
// we assume we are no longer receiving communication. could have bugs? ie, we could be "done" reading before the data is all written
|
||||
if (byteCount == lastByteCount && byteCount != 0 && lastByteCount != 0) {
|
||||
|
||||
if (DEBUGGING) {
|
||||
|
@ -310,11 +312,11 @@ void readSerialPort(char* output) {
|
|||
}
|
||||
|
||||
memcpy(tempOutput, GlobalSerialInputBuffer, byteCount);
|
||||
|
||||
|
||||
totalByteCount += byteCount;
|
||||
|
||||
if (strstr(tempOutput, ";;@@&&") != NULL) {
|
||||
|
||||
|
||||
if (DEBUGGING) {
|
||||
|
||||
printf("done building temp output\n");
|
||||
|
@ -336,6 +338,9 @@ void readSerialPort(char* output) {
|
|||
// attach the gathered up output from the buffer to the output variable
|
||||
strncat(output, tempOutput, totalByteCount);
|
||||
|
||||
writeSerialPortDebug(boutRefNum, "coprocessor.readSerialPort complete, output:");
|
||||
writeSerialPortDebug(boutRefNum, output);
|
||||
|
||||
// once we are done reading the buffer entirely, we need to clear it. i'm not sure if this is the best way or not but seems to work
|
||||
memset(&GlobalSerialInputBuffer[0], 0, MAX_RECEIVE_SIZE);
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -148,6 +148,8 @@ int main()
|
|||
{
|
||||
Initialize(); /* initialize the program */
|
||||
UnloadSeg((Ptr) Initialize); /* note that Initialize must not be in Main! */
|
||||
setupDebugSerialPort(boutRefNum);
|
||||
writeSerialPortDebug(boutRefNum, "initializing messages for macintosh");
|
||||
|
||||
// run our nuklear app one time to render the window telling us to be patient for the coprocessor
|
||||
// app to load up
|
||||
|
|
|
@ -294,10 +294,28 @@ void getChatCounts() {
|
|||
return;
|
||||
}
|
||||
|
||||
strcpy(previousChatCountFunctionResponse, chatCountFunctionResponse);
|
||||
|
||||
//#ifdef MESSAGES_FOR_MACINTOSH_DEBUGGING
|
||||
writeSerialPortDebug(boutRefNum, "update current chat count");
|
||||
writeSerialPortDebug(boutRefNum, chatCountFunctionResponse);
|
||||
writeSerialPortDebug(boutRefNum, previousChatCountFunctionResponse);
|
||||
|
||||
// update current chat count
|
||||
// 1
|
||||
// wrangled byn
|
||||
// wrangled by the knockers:::0,Aaron Sunderland:::0,Shirley Waggoner:::0,waggoner6171@icloud.com:::0,Rebecca Henlin:::0,Chris Sjoblom:::0,Leo Torbochkin:::0,Jayant Sai:::0,+15095713317:::0,Adam Struthers:::0
|
||||
// 2
|
||||
// wrangled by the knockers:::0,Aaron Sunderland:::0,Shin
|
||||
// wrangled by the knockers:::0,Aaron Sunderland:::0,Shirley Waggoner:::0,waggoner6171@icloud.com:::0,Rebecca Henlin:::0,Chris Sjoblom:::0,Leo Torbochkin:::0,Jayant Sai:::0,+15095713317:::0,Adam Struthers:::0
|
||||
// 3
|
||||
// wrangled by the knockers:::0,Aaron Sunderland:::0,n
|
||||
// wrangled by the knockers:::0,Aaron Sunderland:::0,Shirley Waggoner:::0,waggoner6171@icloud.com:::0,Rebecca Henlin:::0,Chris Sjoblom:::0,Leo Torbochkin:::0,Jayant Sai:::0,+15095713317:::0,Adam Struthers:::0
|
||||
// 4
|
||||
// wrangled by the knockers:::0,Aaron Sunderland:::0,Shirley Waggoner:::0,waggoner6171@icloud.com:::0,Rebecca Henlin:::0,Chris Sjoblom:::0,Leo Torbochkin:::0,Jayant Sai:::0,+15095713317:::0,Adam Struthers:::0
|
||||
// wrangled by the knockers:::0,Aaron Sunderland:::0,n
|
||||
|
||||
|
||||
//#endif
|
||||
|
||||
SysBeep(1);
|
||||
|
@ -425,7 +443,6 @@ void getChatCounts() {
|
|||
}
|
||||
}
|
||||
|
||||
strcpy(previousChatCountFunctionResponse, chatCountFunctionResponse);
|
||||
forceRedraw = 3;
|
||||
|
||||
return;
|
||||
|
@ -669,7 +686,7 @@ static void nuklearApp(struct nk_context *ctx) {
|
|||
short edit_return_value = nk_edit_string(ctx, NK_EDIT_FIELD|NK_EDIT_SIG_ENTER, box_input_buffer, &box_input_len, 2048, nk_filter_default);
|
||||
|
||||
// this is the enter key, obviously
|
||||
if (edit_return_value == 17) {
|
||||
if (edit_return_value == 17 && box_input_len > 0) {
|
||||
|
||||
sendMessage();
|
||||
}
|
||||
|
|
|
@ -458,9 +458,9 @@ int mostRight = 1;
|
|||
|
||||
void updateBounds(int top, int bottom, int left, int right) {
|
||||
|
||||
// #ifdef DEBUG_FUNCTION_CALLS
|
||||
#ifdef DEBUG_FUNCTION_CALLS
|
||||
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: updateBounds");
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
if (left < mostLeft) {
|
||||
|
||||
|
@ -481,7 +481,6 @@ void updateBounds(int top, int bottom, int left, int right) {
|
|||
|
||||
mostBottom = bottom;
|
||||
}
|
||||
writeSerialPortDebug(boutRefNum, "END OF DEBUG_FUNCTION_CALLS: updateBounds");
|
||||
}
|
||||
|
||||
#ifdef COMMAND_CACHING
|
||||
|
@ -1137,12 +1136,16 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
|||
#endif
|
||||
|
||||
#ifdef COMMAND_CACHING
|
||||
writeSerialPortDebug(boutRefNum, "INCREMENT LAST CMD");
|
||||
if (currentCalls <= lastCalls && lastCmd && lastCmd->next && lastCmd->next < ctx->memory.allocated) {
|
||||
|
||||
writeSerialPortDebug(boutRefNum, "INCREMENT LAST CMD: IN CONDITIONAL");
|
||||
|
||||
lastCmd = nk_ptr_add_const(struct nk_command, last, lastCmd->next);
|
||||
}
|
||||
|
||||
currentCalls++;
|
||||
writeSerialPortDebug(boutRefNum, "DONE INCREMENT LAST CMD");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1172,6 +1175,8 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
|||
PROFILE_START("copy bits");
|
||||
#endif
|
||||
|
||||
writeSerialPortDebug(boutRefNum, "COPYBITS PROCESS");
|
||||
|
||||
SetPort(window);
|
||||
|
||||
Rect quickDrawRectangle;
|
||||
|
@ -1181,6 +1186,7 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
|
|||
quickDrawRectangle.right = mostRight;
|
||||
|
||||
CopyBits(&gMainOffScreen.bits->portBits, &window->portBits, &quickDrawRectangle, &quickDrawRectangle, srcCopy, 0L);
|
||||
writeSerialPortDebug(boutRefNum, "DONE COPYBITS PROCESS");
|
||||
|
||||
mostLeft = WINDOW_WIDTH;
|
||||
mostBottom = 1;
|
||||
|
|
Loading…
Reference in New Issue