Closed robhagemans closed 6 years ago
Hi Rob, the history of the serial stuff is the following:
-A previous programmer (Nestor Morales) was trying to make an older version of your pcbasic work with the brewer. ( https://github.com/nestormh/pcbasic/commits/master). This branch is not mantained anymore, I have a copy of it in my repo for now, just to comare some things ( https://github.com/Danitegue/PCBasic_Brewer_Repo/tree/master/pcbasic_nestor) -With your specific version of the pyserial library, (v2.7), and the old version of pcbasic he could not communicate with the instrument. -He did some modifications in the old pcbasic, and in that pyserial library, and he could make it work, but, the software was not able to communicate properly with the instrument after 10 or 15 minutes, when a bad data problem always raise, I suppose because the software was receiving wrong data, or memory issues perhaps. -Also they had the issue of the timer, the program time was loosing some seconds per hour, respect the pc. (I discovered afterwards that some changes done for asking for new characters in the serial buffer massively were slowering the emulator performance).
-Then he had to left this project, and I started with it. -That previous version of pcbasic was horrible for me, in a way that it was very difficult to make debugging. The unique interface that worked was the ansi, so the develop was hard and very slow. -As he recommended me, I started with a newer version of pcbasic (the actual we are working now, which is much better, and I can use pycharm for debugging while viewing through pygame or sdl2). Since I thought that some big changes would be needed, I named it "pcbasic_brewer" -Your actual version of pcbasic is prepaired to work with an specific version of the pyserial (v2.7)(as you indicate in https://github.com/robhagemans/pcbasic/blob/master/INSTALL.md). Since the latest version of pyserial is a little bit newer, (v3.4), I decided to adapt the same modifications that Nestor did to the pyserial v2.7 to this newer v3.4 version. -Then, for not mixing an original pyserial package with a modified one specific for the instrument, I decided to make a folder with the entire pyserial_brewer modified library, to manain these changes appart of the original serial library, and adapt the pcbasic_brewer for being able to switch between the standard pyserial, and the customized one (by just adding this to the launchers: "--use-serial-brewer=True" "--use-serial-brewer-verbose=True")
Actual status: -I can communicate with the instrument now, using my pyserial-brewer customized library, but I have noticed something wrong: The answers that the instrument sends to the program, are not detected by the interpreter until at least 2 seconds later or more in other ocassions. This generate a communication issue after some minutes, the program keeps hanged because is waiting for an answer.
I can replicate exaclty the same with the BrewerSimulator.py program and com0com software, which emulate a pair of bridged com ports in my laptop (com15-com14). (I have not any phisical com port neither). I run the BrewerSimulator.py on python, using the com15, and the brewer program on pcbasic_brewer, using the com15. This program emulate the first signals that the instrument send when the software is connected, and the answers to the pdhp command.
I'm researching now what can be the cause of that issue.
What I would do in your latest version of pcbasic, for now: -We can start updating the ports.py for being able to use the latest pyserial module (v3.4), instead of having to use the old one (v2.4). -I also have modified the loggers in the pcbasic_brewer for writting the dates in them, which is extremely useful to determine when a Com message has been received, and compare it with when it was Sent by the BrewerSimulator.
In config.py
def _prepare_logging(self): """Set up the global logger.""" logfile = self.get('logfile') if self.get('version') or self.get('help'): formatstr = '%(message)s' loglevel = logging.INFO else:
#formatstr = '%(levelname)s: %(message)s'
formatstr ='%(asctime)s.%(msecs)04d %(levelname)s: %(message)s'
if self.get('debug'):
loglevel = logging.DEBUG
else:
loglevel = logging.INFO
#logging.basicConfig(format=formatstr, level=loglevel, filename=logfile)
logging.basicConfig(format=formatstr,
level=loglevel,filename=logfile, datefmt='%H:%M:%S')
I attach you a log of a test I did yesterday with the instrument connected, using this modified pyserial version, and in which we can see how are being the serial answers stored in the memory, until I decided to stop it because it was waiting too much for an instrument answer.
I will keep you updated
2018-01-13 9:46 GMT+00:00 Rob Hagemans notifications@github.com:
Hey @Danitegue https://github.com/danitegue,
I was looking through the two brewer libraries and wondered about the modifield serial library. This seems to be a fork of the https://pythonhosted.org/pyserial/ package adapted to the Brewer spectrophotometer.
I was wondering what makes this modified library necessary - does it replace some DOS/Windows XP drivers supplied with the Brewer or is it needed to work around incompatibilities in PC-BASIC?
If it's the latter, we could try to find out what causes the incompatibility and merge the fixes back into PC-BASIC (preferably without having to maintain a fork of pyserial...) Caveat is that I don't have much (any) experience with RS-232 though, and haven't got any serial ports beyond a cheap USB one from ebay that I've never tried.
Cheers, Rob
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Danitegue/PCBasic_Brewer_Repo/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AYutGEK8QYSJUvsodtg0pxACKIl5FuZcks5tKHthgaJpZM4RdKub .
--
Daniel Santana Díaz, Danitegue@gmail.com
You can of course make a diff of my current version of ports.py, to notice some changes that Nestor also did in the old version, and I think are needed to handle properly the com ports files inside the new pcbasic, independently of the pyserial version used.
The most imporant, is that I had to add this line:
in ports.py, class COMDevice, def open():
f = COMFile(self.stream, self.field, self.input_methods, lf, self.serial_in_size)
f.width = self.device_file.width f.col = self.device_file.col
*self*.device_file = f #As nestor discovered, if self.device_file is not updated, there will be a COMFile identifier for events, and another different one for accessing the port.
return f
2018-01-13 15:09 GMT+00:00 Daniel Santana danitegue@gmail.com:
Hi Rob, the history of the serial stuff is the following:
-A previous programmer (Nestor Morales) was trying to make an older version of your pcbasic work with the brewer. ( https://github.com/nestormh/pcbasic/commits/master). This branch is not mantained anymore, I have a copy of it in my repo for now, just to comare some things ( https://github.com/Danitegue/PCBasic_Brewer_Repo/ tree/master/pcbasic_nestor) -With your specific version of the pyserial library, (v2.7), and the old version of pcbasic he could not communicate with the instrument. -He did some modifications in the old pcbasic, and in that pyserial library, and he could make it work, but, the software was not able to communicate properly with the instrument after 10 or 15 minutes, when a bad data problem always raise, I suppose because the software was receiving wrong data, or memory issues perhaps. -Also they had the issue of the timer, the program time was loosing some seconds per hour, respect the pc. (I discovered afterwards that some changes done for asking for new characters in the serial buffer massively were slowering the emulator performance).
-Then he had to left this project, and I started with it. -That previous version of pcbasic was horrible for me, in a way that it was very difficult to make debugging. The unique interface that worked was the ansi, so the develop was hard and very slow. -As he recommended me, I started with a newer version of pcbasic (the actual we are working now, which is much better, and I can use pycharm for debugging while viewing through pygame or sdl2). Since I thought that some big changes would be needed, I named it "pcbasic_brewer" -Your actual version of pcbasic is prepaired to work with an specific version of the pyserial (v2.7)(as you indicate in https://github.com/ robhagemans/pcbasic/blob/master/INSTALL.md). Since the latest version of pyserial is a little bit newer, (v3.4), I decided to adapt the same modifications that Nestor did to the pyserial v2.7 to this newer v3.4 version. -Then, for not mixing an original pyserial package with a modified one specific for the instrument, I decided to make a folder with the entire pyserial_brewer modified library, to manain these changes appart of the original serial library, and adapt the pcbasic_brewer for being able to switch between the standard pyserial, and the customized one (by just adding this to the launchers: "--use-serial-brewer=True" "--use-serial-brewer-verbose=True")
Actual status: -I can communicate with the instrument now, using my pyserial-brewer customized library, but I have noticed something wrong: The answers that the instrument sends to the program, are not detected by the interpreter until at least 2 seconds later or more in other ocassions. This generate a communication issue after some minutes, the program keeps hanged because is waiting for an answer.
I can replicate exaclty the same with the BrewerSimulator.py program and com0com software, which emulate a pair of bridged com ports in my laptop (com15-com14). (I have not any phisical com port neither). I run the BrewerSimulator.py on python, using the com15, and the brewer program on pcbasic_brewer, using the com15. This program emulate the first signals that the instrument send when the software is connected, and the answers to the pdhp command.
I'm researching now what can be the cause of that issue.
What I would do in your latest version of pcbasic, for now: -We can start updating the ports.py for being able to use the latest pyserial module (v3.4), instead of having to use the old one (v2.4). -I also have modified the loggers in the pcbasic_brewer for writting the dates in them, which is extremely useful to determine when a Com message has been received, and compare it with when it was Sent by the BrewerSimulator.
In config.py
def _prepare_logging(self): """Set up the global logger.""" logfile = self.get('logfile') if self.get('version') or self.get('help'): formatstr = '%(message)s' loglevel = logging.INFO else:
logging setup before we import modules and may need to log errors
#formatstr = '%(levelname)s: %(message)s' formatstr ='%(asctime)s.%(msecs)04d %(levelname)s: %(message)s' if self.get('debug'): loglevel = logging.DEBUG else: loglevel = logging.INFO #logging.basicConfig(format=formatstr, level=loglevel, filename=logfile) logging.basicConfig(format=formatstr, level=loglevel,filename=logfile, datefmt='%H:%M:%S')
I attach you a log of a test I did yesterday with the instrument connected, using this modified pyserial version, and in which we can see how are being the serial answers stored in the memory, until I decided to stop it because it was waiting too much for an instrument answer.
I will keep you updated
2018-01-13 9:46 GMT+00:00 Rob Hagemans notifications@github.com:
Hey @Danitegue https://github.com/danitegue,
I was looking through the two brewer libraries and wondered about the modifield serial library. This seems to be a fork of the https://pythonhosted.org/pyserial/ package adapted to the Brewer spectrophotometer.
I was wondering what makes this modified library necessary - does it replace some DOS/Windows XP drivers supplied with the Brewer or is it needed to work around incompatibilities in PC-BASIC?
If it's the latter, we could try to find out what causes the incompatibility and merge the fixes back into PC-BASIC (preferably without having to maintain a fork of pyserial...) Caveat is that I don't have much (any) experience with RS-232 though, and haven't got any serial ports beyond a cheap USB one from ebay that I've never tried.
Cheers, Rob
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Danitegue/PCBasic_Brewer_Repo/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AYutGEK8QYSJUvsodtg0pxACKIl5FuZcks5tKHthgaJpZM4RdKub .
--
Daniel Santana Díaz, Danitegue@gmail.com
--
Daniel Santana Díaz, Danitegue@gmail.com
Hi thanks for the background, I think the suggestion to record time stamps in log files is a good one and I agree it would be better to update to the latest pyserial. Unfortunately the author of pyserial has removed parallel port support form later versions, so I may have to use parts of the old library for that.
Do you have some background of the problem that the device_file
edit is meant to fix? A priori I don't think it's the right approach: the device file exists because GW-BASIC distinguishes "default" settings on its devices from ones that happen on open files on the device. For example, there is a separate WIDTH
setting for LPT1:
and for any files opened on LPT1:
, and the same seems to be true for COM1:
. This is the reason why there are two different COMFile
objects on the port. Apparently this led to a problem, but did Nestor explain what the problem is?
I've created a branch topic-serial
that for now has the timestamp logging and an update to the PySerial 3 API - have a look if you can. I've done very little testing so far but it's a start... I hope my recent string of unrelated commits don't make it too difficult to merge.
I haven't changed the device file yet. I think there may be two issues:
1) the serial buffer is implemented at the file level, which I think is incorrect - fairly sure GW-BASIC would have only one serial buffer given the memory requirement. I think the best may be to move the buffer to the SerialStream
class and refactor the rest. After that, lot of testing will be needed...
2) The serial file is built around a text file, which has a one-byte readahead buffer for all sorts of reasons. But that means the port gets opened rightaway on starting PC-BASIC, which is probably not correct! I imagine I could just feed a single NUL
char into the readahead buffer to avoid this...
I've applied the self.device_file = f
line in the topic-serial
branch as well - it will be better in the end to refactor to a single buffer held by the device object, but let's first see if we can make it work this way and then take it from there. It seems the only thing that uses the device file for anything else than the communications buffer is the WIDTH "COM1:", x
statement and that's not very important for now.
I have cloned your latest master version of pcbasic, and then merged the changes of the topic-serial branch on it.
There is not too much difference between my serialbrewer library, and the latest pyserial, (only a few carriage returns are sent in my library to detect if the instrument is connected). It should work with both.
But I still cannot connect with the instrument for now using this latest version of pyserial, I'm researching the cause.
Respect the fact of having the self.device_file = f added or not:
By adding some debugging lines in the code...:
def open(self, number, param, filetype, mode, access, lock, reclen, seg, offset, length): """Open a file on COMn: """ if not self.stream: raise error.BASICError(error.DEVICE_UNAVAILABLE) logging.debug("Opening a file on COM port, as file number %s", str(number)) logging.debug("Before open, stream: %s", str(self.stream)) logging.debug("Before open, self.device_file: %s", str(self.device_file))
# PE setting not implemented
speed, parity, bytesize, stop, rs, cs, ds, cd, lf, _ =
self.get_params(param)
if self.stream.is_open:
raise error.BASICError(error.FILE_ALREADY_OPEN)
else:
try:
self.stream.open(rs, cs, ds, cd)
except EnvironmentError as e:
# device timeout
logging.debug("Serial exception: %s", e)
raise error.BASICError(error.DEVICE_TIMEOUT)
try:
self.stream.set_params(speed, parity, bytesize, stop)
except Exception:
self.stream.close()
raise
f = COMFile(self.stream, self.field, self.input_methods, lf,
self.serial_in_size)
f.width = self.device_file.width
f.col = self.device_file.col
self.device_file = f
logging.debug("After open, stream: %s", str(self.stream))
logging.debug("After open, self.device_file: %s", str(self.device_file))
logging.debug("After open, COMFile: %s", str(f))
time.sleep(0.5)
return f
I can obtain:
My version, without self.device_file = f line included: The software receive something from the com port, but seems that it cannot handle it properly
23:54:28.0576 WARNING: Smooth scaling not available: SDL_GFX extension not found. 23:54:28.0828 DEBUG: Initializating the GWBASIC Com Port 1, with serial_in_size=256 23:54:28.0828 DEBUG: ports.py, COMDevice, init, Initialize the COM port: COM14 23:54:28.0828 DEBUG: ports.py, COMDevice, init, self.device_file= <pcbasic.basic.ports.COMFile object at 0x000000000709AD68> 23:54:28.0828 DEBUG: Initializating the GWBASIC Com Port 2, with serial_in_size=256 23:54:28.0828 DEBUG: ports.py, COMDevice, init, Initialize the COM port: 23:54:28.0828 DEBUG: Aborted, None port to attach to. 23:54:28.0832 DEBUG: Loading prgram C:\PCBasic_Brewer_Repo\brw#185\Program\main.asc 23:54:30.0894 INFO: files.py, open, loading file:init.rtn as file number0 23:54:30.0970 INFO: files.py, open, loading file:scrn: as file number4 23:54:30.0992 INFO: files.py, open, loading file:op_st.fil as file number8 23:54:31.0016 INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 23:54:31.0020 INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 23:54:31.0022 INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 23:54:31.0023 INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 23:54:31.0023 INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 23:54:31.0025 INFO: files.py, open, loading file:d:\185\uvr26104.185 as file number8 23:54:31.0068 INFO: files.py, open, loading file:d:\D31217.185 as file number4 23:54:31.0073 INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 23:54:31.0086 INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 23:54:31.0121 INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 23:54:31.0125 INFO: files.py, open, loading file:d:\185\dcf140~1.CUB as file number8 23:54:31.0127 INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 23:54:31.0127 DEBUG: Opening a file on COM port, as file number 7 23:54:31.0127 DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709AC88> 23:54:31.0127 DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000709AD68> 23:54:31.0127 DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it -> Here a new COMFile is generated. 23:54:31.0127 INFO: Using SerialBrewer module for oppening communications 23:54:31.0128 INFO: Trying communication (1200), attempt #1 -> 23:54:32.0128 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:54:32.0130 INFO: Test Successful 23:54:33.0631 INFO: **** Connection with Brewer Successful!(1200)
23:54:33.0631 DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709AC88> 23:54:33.0631 DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000709AD68> (Here we can see how self.device_file is not being updated with the latest generated COMFile)
23:54:33.0631 DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000006946F28> 23:54:34.0138 WARNING: SHELL statement disabled. 23:54:34.0150 INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 23:54:34.0151 INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 23:54:34.0171 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:54:34.0171 DEBUG: ports.py, COMFile, write, writting string to com port: F,0,2:V,120,1
23:54:34.0395 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:54:34.0397 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:54:34.0750 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:54:49.0357 INFO: files.py, open, loading file:d:\B31217.185 as file number1 23:54:49.0357 INFO: files.py, open, loading file:d:\B31217.185 as file number1 23:54:49.0950 INFO: files.py, open, loading file:re.rtn as file number0 23:54:50.0066 INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 23:54:50.0066 DEBUG: Opening a file on COM port, as file number 7 23:54:50.0066 DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709AC88> 23:54:50.0066 DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000709AD68> 23:54:50.0066 DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it 23:54:50.0066 INFO: Using SerialBrewer module for oppening communications 23:54:50.0066 INFO: Trying communication (1200), attempt #1 -> 23:54:51.0069 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:54:51.0069 INFO: Test Successful 23:54:52.0571 INFO: **** Connection with Brewer Successful!(1200)
23:54:52.0572 DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709AC88> 23:54:52.0572 DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000709AD68> 23:54:52.0572 DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000006924E80>
(It continues in loop trying to receive the proper key from the instrument for continuing...but it never arrives, as ti would be waiting for a new char the wrong COMFile.)
My version, with self.device_file = f line included: The program can communicate and continue sending and receiving data through the com port:
23:55:36.0763 WARNING: Smooth scaling not available: SDL_GFX extension not found. 23:55:37.0003 DEBUG: Initializating the GWBASIC Com Port 1, with serial_in_size=256 23:55:37.0003 DEBUG: ports.py, COMDevice, init, Initialize the COM port: COM14 23:55:37.0003 DEBUG: ports.py, COMDevice, init, self.device_file= <pcbasic.basic.ports.COMFile object at 0x000000000709BD68> 23:55:37.0005 DEBUG: Initializating the GWBASIC Com Port 2, with serial_in_size=256 23:55:37.0005 DEBUG: ports.py, COMDevice, init, Initialize the COM port: 23:55:37.0005 DEBUG: Aborted, None port to attach to. 23:55:37.0006 DEBUG: Loading prgram C:\PCBasic_Brewer_Repo\brw#185\Program\main.asc 23:55:39.0049 INFO: files.py, open, loading file:init.rtn as file number0 23:55:39.0118 INFO: files.py, open, loading file:scrn: as file number4 23:55:39.0138 INFO: files.py, open, loading file:op_st.fil as file number8 23:55:39.0170 INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 23:55:39.0174 INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 23:55:39.0176 INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 23:55:39.0177 INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 23:55:39.0177 INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 23:55:39.0178 INFO: files.py, open, loading file:d:\185\uvr26104.185 as file number8 23:55:39.0216 INFO: files.py, open, loading file:d:\D31217.185 as file number4 23:55:39.0224 INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 23:55:39.0243 INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 23:55:39.0270 INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 23:55:39.0279 INFO: files.py, open, loading file:d:\185\dcf140~1.CUB as file number8 23:55:39.0282 INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 23:55:39.0282 DEBUG: Opening a file on COM port, as file number 7 23:55:39.0282 DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709BB70> 23:55:39.0282 DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000709BD68> 23:55:39.0282 DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it -> -> Here a new COMFile is generated. 23:55:39.0283 INFO: Using SerialBrewer module for oppening communications 23:55:39.0283 INFO: Trying communication (1200), attempt #1 -> 23:55:40.0283 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:55:40.0285 INFO: Test Successful 23:55:41.0786 INFO: **** Connection with Brewer Successful!(1200)
23:55:41.0786 DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709BB70> 23:55:41.0786 DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000070B4A90> 23:55:41.0786 DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x00000000070B4A90> (Here we can see how self.devicefile is being updated with the latest ComFile generated. 23:55:42.0290 WARNING: SHELL statement disabled. 23:55:42.0302 INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 23:55:42.0305 INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 23:55:42.0328 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:55:42.0328 DEBUG: ports.py, COMFile, write, writting string to com port: F,0,2:V,120,1
23:55:42.0617 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:55:42.0617 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:55:43.0009 DEBUG: ports.py, COMFile, read_raw, read:
-> , space in input buffer=256
23:55:43.0552 INFO: files.py, open, loading file:da_lo.rtn as file number0 23:55:43.0632 INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 23:55:43.0671 DEBUG: ports.py, COMFile, write, writting string to com port: ?MOTOR.CLASS[2]
23:55:44.0025 DEBUG: Serialwin32_brewer.py read function1 has read: TRACKERMOTOR\r\n\x00\x00\x00\x00\x00\x00\r\n\x00\x00\x00\x00\x00\x00-> 23:55:44.0025 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:55:44.0457 DEBUG: ports.py, COMFile, read_raw, read: TRACKERMOTOR
-> , space in input buffer=256
23:55:44.0849 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:55:44.0851 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:55:44.0858 DEBUG: ports.py, COMFile, read_raw, read:
-> , space in input buffer=256
23:55:44.0859 DEBUG: ports.py, COMFile, write, writting string to com port: B,0
...(it continues loading and communicating properly for a long time)...
Your version without the line added: I think there is a more important difference and is that _check_open is oppening the port before it should do it...(I think)
[23:52:19.0861] WARNING: Smooth scaling not available: SDL_GFX extension not found. [23:52:20.0058] DEBUG: ports.py, COMDevice, init, Initialize the COM port: COM14 [23:52:20.0059] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it -> It is oppening the port before it should? [23:52:20.0059] DEBUG: ports.py, COMDevice, init, self.device_file= <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:20.0059] DEBUG: Initializating the GWBASIC Com Port 1, with serial_in_size=256 [23:52:20.0059] DEBUG: ports.py, COMDevice, init, Initialize the COM port: [23:52:20.0059] DEBUG: Aborted, None port to attach to. [23:52:20.0059] DEBUG: Initializating the GWBASIC Com Port 2, with serial_in_size=256 [23:52:22.0144] INFO: files.py, open, loading file:init.rtn as file number0 [23:52:22.0214] INFO: files.py, open, loading file:scrn: as file number4 [23:52:22.0233] INFO: files.py, open, loading file:op_st.fil as file number8 [23:52:22.0266] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:52:22.0269] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:52:22.0272] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:52:22.0273] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:52:22.0275] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:52:22.0276] INFO: files.py, open, loading file:d:\185\uvr26104.185 as file number8 [23:52:22.0318] INFO: files.py, open, loading file:d:\D31217.185 as file number4 [23:52:22.0323] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:52:22.0339] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:52:22.0375] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:52:22.0380] INFO: files.py, open, loading file:d:\185\dcf140~1.CUB as file number8 [23:52:22.0381] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:52:22.0381] DEBUG: Opening a file on COM port, as file number 7 [23:52:22.0381] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:22.0381] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> -> After that point something happens in which is created a new COMFile. [23:52:22.0381] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:22.0381] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> (Here we can see how self.device_file is not being updated with the latest generated COMFile)> [23:52:22.0381] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000007134470> [23:52:22.0882] WARNING: SHELL statement disabled. [23:52:22.0891] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:52:22.0894] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:52:22.0913] DEBUG: ports.py, COMFile, write, writting string to com port: F,0,2:V,120,1
[23:52:24.0904] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:52:24.0904] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:52:25.0453] INFO: files.py, open, loading file:re.rtn as file number0 [23:52:25.0561] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:52:25.0561] DEBUG: Opening a file on COM port, as file number 7 [23:52:25.0561] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:25.0561] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:25.0561] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it [23:52:25.0562] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:25.0562] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:25.0562] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000007115F28>
(It continues in loop trying to receive the proper key from the instrument for continuing...but it never arrives, as ti would be waiting for a new char the wrong COMFile.)
Your version with the line added:
[23:53:13.0224] WARNING: Smooth scaling not available: SDL_GFX extension not found. [23:53:13.0444] DEBUG: ports.py, COMDevice, init, Initialize the COM port: COM14 [23:53:13.0444] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it -> It is oppening the port before it should? [23:53:13.0444] DEBUG: ports.py, COMDevice, init, self.device_file= <pcbasic.basic.ports.COMFile object at 0x00000000074302E8> [23:53:13.0444] DEBUG: Initializating the GWBASIC Com Port 1, with serial_in_size=256 [23:53:13.0444] DEBUG: ports.py, COMDevice, init, Initialize the COM port: [23:53:13.0444] DEBUG: Aborted, None port to attach to. [23:53:13.0444] DEBUG: Initializating the GWBASIC Com Port 2, with serial_in_size=256 [23:53:15.0497] INFO: files.py, open, loading file:init.rtn as file number0 [23:53:15.0569] INFO: files.py, open, loading file:scrn: as file number4 [23:53:15.0589] INFO: files.py, open, loading file:op_st.fil as file number8 [23:53:15.0625] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:53:15.0638] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:53:15.0640] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:53:15.0641] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:53:15.0641] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:53:15.0642] INFO: files.py, open, loading file:d:\185\uvr26104.185 as file number8 [23:53:15.0671] INFO: files.py, open, loading file:d:\D31217.185 as file number4 [23:53:15.0677] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:53:15.0696] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:53:15.0723] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:53:15.0730] INFO: files.py, open, loading file:d:\185\dcf140~1.CUB as file number8 [23:53:15.0733] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:53:15.0733] DEBUG: Opening a file on COM port, as file number 7 [23:53:15.0733] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:15.0733] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000074302E8> -> After that point something happens in which is created a new COMFile. [23:53:15.0733] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:15.0733] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000745D7F0> [23:53:15.0733] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x000000000745D7F0> (Here we can see how self.devicefile is being updated with the latest ComFile generated. [23:53:16.0233] WARNING: SHELL statement disabled. [23:53:16.0244] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:53:16.0253] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:53:16.0299] DEBUG: ports.py, COMFile, write, writting string to com port: F,0,2:V,120,1
[23:53:18.0308] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:53:18.0308] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:53:18.0904] INFO: files.py, open, loading file:re.rtn as file number0 [23:53:19.0023] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:53:19.0023] DEBUG: Opening a file on COM port, as file number 7 [23:53:19.0023] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:19.0023] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000745D7F0> [23:53:19.0023] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it [23:53:19.0023] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:19.0023] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x0000000006D14F60> [23:53:19.0023] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000006D14F60>
(It continues in loop trying to receive the proper key from the instrument for continuing...but it never arrives, as ti would be waiting for a new char the wrong COMFile.)
I would say the line is necessary.
I think the reason of the port being opened before it should in your version, is that in ports.py, class COMDevice, init, the last line:
self.device_file = COMFile(self.stream, self.field, self.input_methods, False, serial_in_size)
is trying to read something in the file by default. And in the ports.py, class SerialStream, read function, you have a self._check_open() that is oppening the port before it should. (I have disabled this _check_open in my version, but I tried to do it in yours and cannot receive anything through the com port yet... I have to check now the com ports events.)
Here the log files if you need to compare them.
Regards
2018-01-14 18:20 GMT+00:00 Rob Hagemans notifications@github.com:
I've applied the self.device_file = f line in the topic-serial branch as well - it will be better in the end to refactor to a single buffer held by the device object, but let's first see if we can make it work this way and then take it from there. It seems the only thing that uses the device file for anything else than the communications buffer is the WIDTH "COM1:", x statement and that's not very important for now.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Danitegue/PCBasic_Brewer_Repo/issues/1#issuecomment-357530745, or mute the thread https://github.com/notifications/unsubscribe-auth/AYutGA0Tn05qy0denm4U0qDc-gizCWltks5tKkVUgaJpZM4RdKub .
--
Daniel Santana Díaz, Danitegue@gmail.com
[23:53:13.0224] WARNING: Smooth scaling not available: SDL_GFX extension not found. [23:53:13.0444] DEBUG: ports.py, COMDevice, init, Initialize the COM port: COM14 [23:53:13.0444] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it [23:53:13.0444] DEBUG: ports.py, COMDevice, init, self.device_file= <pcbasic.basic.ports.COMFile object at 0x00000000074302E8> [23:53:13.0444] DEBUG: Initializating the GWBASIC Com Port 1, with serial_in_size=256 [23:53:13.0444] DEBUG: ports.py, COMDevice, init, Initialize the COM port: [23:53:13.0444] DEBUG: Aborted, None port to attach to. [23:53:13.0444] DEBUG: Initializating the GWBASIC Com Port 2, with serial_in_size=256 [23:53:15.0497] INFO: files.py, open, loading file:init.rtn as file number0 [23:53:15.0569] INFO: files.py, open, loading file:scrn: as file number4 [23:53:15.0589] INFO: files.py, open, loading file:op_st.fil as file number8 [23:53:15.0625] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:53:15.0638] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:53:15.0640] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:53:15.0641] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:53:15.0641] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:53:15.0642] INFO: files.py, open, loading file:d:\185\uvr26104.185 as file number8 [23:53:15.0671] INFO: files.py, open, loading file:d:\D31217.185 as file number4 [23:53:15.0677] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:53:15.0696] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:53:15.0723] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:53:15.0730] INFO: files.py, open, loading file:d:\185\dcf140~1.CUB as file number8 [23:53:15.0733] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:53:15.0733] DEBUG: Opening a file on COM port, as file number 7 [23:53:15.0733] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:15.0733] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000074302E8> [23:53:15.0733] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:15.0733] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000745D7F0> [23:53:15.0733] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x000000000745D7F0> [23:53:16.0233] WARNING: SHELL statement disabled. [23:53:16.0244] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:53:16.0253] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:53:16.0299] DEBUG: ports.py, COMFile, write, writting string to com port: F,0,2:V,120,1
[23:53:18.0308] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:53:18.0308] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:53:18.0904] INFO: files.py, open, loading file:re.rtn as file number0 [23:53:19.0023] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:53:19.0023] DEBUG: Opening a file on COM port, as file number 7 [23:53:19.0023] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:19.0023] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000745D7F0> [23:53:19.0023] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it [23:53:19.0023] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000061C59E8> [23:53:19.0023] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x0000000006D14F60> [23:53:19.0023] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000006D14F60>
[23:52:19.0861] WARNING: Smooth scaling not available: SDL_GFX extension not found. [23:52:20.0058] DEBUG: ports.py, COMDevice, init, Initialize the COM port: COM14 [23:52:20.0059] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it [23:52:20.0059] DEBUG: ports.py, COMDevice, init, self.device_file= <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:20.0059] DEBUG: Initializating the GWBASIC Com Port 1, with serial_in_size=256 [23:52:20.0059] DEBUG: ports.py, COMDevice, init, Initialize the COM port: [23:52:20.0059] DEBUG: Aborted, None port to attach to. [23:52:20.0059] DEBUG: Initializating the GWBASIC Com Port 2, with serial_in_size=256 [23:52:22.0144] INFO: files.py, open, loading file:init.rtn as file number0 [23:52:22.0214] INFO: files.py, open, loading file:scrn: as file number4 [23:52:22.0233] INFO: files.py, open, loading file:op_st.fil as file number8 [23:52:22.0266] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:52:22.0269] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:52:22.0272] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:52:22.0273] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:52:22.0275] INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 [23:52:22.0276] INFO: files.py, open, loading file:d:\185\uvr26104.185 as file number8 [23:52:22.0318] INFO: files.py, open, loading file:d:\D31217.185 as file number4 [23:52:22.0323] INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 [23:52:22.0339] INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 [23:52:22.0375] INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 [23:52:22.0380] INFO: files.py, open, loading file:d:\185\dcf140~1.CUB as file number8 [23:52:22.0381] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:52:22.0381] DEBUG: Opening a file on COM port, as file number 7 [23:52:22.0381] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:22.0381] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:22.0381] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:22.0381] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:22.0381] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000007134470> [23:52:22.0882] WARNING: SHELL statement disabled. [23:52:22.0891] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:52:22.0894] INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 [23:52:22.0913] DEBUG: ports.py, COMFile, write, writting string to com port: F,0,2:V,120,1
[23:52:24.0904] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:52:24.0904] INFO: files.py, open, loading file:d:\B31217.185 as file number1 [23:52:25.0453] INFO: files.py, open, loading file:re.rtn as file number0 [23:52:25.0561] INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 [23:52:25.0561] DEBUG: Opening a file on COM port, as file number 7 [23:52:25.0561] DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:25.0561] DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:25.0561] DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it [23:52:25.0562] DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x00000000065369E8> [23:52:25.0562] DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000078492E8> [23:52:25.0562] DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x0000000007115F28>
23:55:36.0763 WARNING: Smooth scaling not available: SDL_GFX extension not found. 23:55:37.0003 DEBUG: Initializating the GWBASIC Com Port 1, with serial_in_size=256 23:55:37.0003 DEBUG: ports.py, COMDevice, init, Initialize the COM port: COM14 23:55:37.0003 DEBUG: ports.py, COMDevice, init, self.device_file= <pcbasic.basic.ports.COMFile object at 0x000000000709BD68> 23:55:37.0005 DEBUG: Initializating the GWBASIC Com Port 2, with serial_in_size=256 23:55:37.0005 DEBUG: ports.py, COMDevice, init, Initialize the COM port: 23:55:37.0005 DEBUG: Aborted, None port to attach to. 23:55:37.0006 DEBUG: Loading prgram C:\PCBasic_Brewer_Repo\brw#185\Program\main.asc 23:55:39.0049 INFO: files.py, open, loading file:init.rtn as file number0 23:55:39.0118 INFO: files.py, open, loading file:scrn: as file number4 23:55:39.0138 INFO: files.py, open, loading file:op_st.fil as file number8 23:55:39.0170 INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 23:55:39.0174 INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 23:55:39.0176 INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 23:55:39.0177 INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 23:55:39.0177 INFO: files.py, open, loading file:d:\185\op_st.185 as file number8 23:55:39.0178 INFO: files.py, open, loading file:d:\185\uvr26104.185 as file number8 23:55:39.0216 INFO: files.py, open, loading file:d:\D31217.185 as file number4 23:55:39.0224 INFO: files.py, open, loading file:d:\185\icf06617.185 as file number8 23:55:39.0243 INFO: files.py, open, loading file:d:\185\dcf14013.185 as file number8 23:55:39.0270 INFO: files.py, open, loading file:d:\185\zsf17802.185 as file number8 23:55:39.0279 INFO: files.py, open, loading file:d:\185\dcf140~1.CUB as file number8 23:55:39.0282 INFO: files.py, open, loading file:com1:1200,n,8,1,rs,ds,cs,cd as file number7 23:55:39.0282 DEBUG: Opening a file on COM port, as file number 7 23:55:39.0282 DEBUG: Before open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709BB70> 23:55:39.0282 DEBUG: Before open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x000000000709BD68> 23:55:39.0282 DEBUG: ports.py, SerialStream, _check_open, Seems that the port is not opened, oppening it 23:55:39.0283 INFO: Using SerialBrewer module for oppening communications 23:55:39.0283 INFO: Trying communication (1200), attempt #1 -> 23:55:40.0283 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:55:40.0285 INFO: Test Successful 23:55:41.0786 INFO: **** Connection with Brewer Successful!(1200)
23:55:41.0786 DEBUG: After open, stream: <pcbasic.basic.ports.SerialStream object at 0x000000000709BB70> 23:55:41.0786 DEBUG: After open, self.device_file: <pcbasic.basic.ports.COMFile object at 0x00000000070B4A90> 23:55:41.0786 DEBUG: After open, COMFile: <pcbasic.basic.ports.COMFile object at 0x00000000070B4A90> 23:55:42.0290 WARNING: SHELL statement disabled. 23:55:42.0302 INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 23:55:42.0305 INFO: files.py, open, loading file:d:\TODAY.TMP as file number1 23:55:42.0328 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:55:42.0328 DEBUG: ports.py, COMFile, write, writting string to com port: F,0,2:V,120,1
23:55:42.0617 DEBUG: Serialwin32_brewer.py read function1 has read: \r\n\x00\x00\x00\x00\x00\x00-> 23:55:42.0617 DEBUG: ports.py, COMFile, _check_read: Checking char waiting to be read in com buffer... 23:55:43.0009 DEBUG: ports.py, COMFile, read_raw, read:
Hey @Danitegue,
I was looking through the two brewer libraries and wondered about the modified serial library. This seems to be a fork of the https://pythonhosted.org/pyserial/ package adapted to the Brewer spectrophotometer.
I was wondering what makes this modified library necessary - does it replace some DOS/Windows XP drivers supplied with the Brewer or is it needed to work around incompatibilities in PC-BASIC?
If it's the latter, we could try to find out what causes the incompatibility and merge the fixes back into PC-BASIC (preferably without having to maintain a fork of
pyserial
...) Caveat is that I don't have much (any) experience with RS-232 though, and haven't got any serial ports beyond a cheap USB one from ebay that I've never tried.Cheers, Rob