Caterina upload works
This commit is contained in:
parent
a27334c768
commit
ccfaf34129
|
@ -138,10 +138,9 @@ class ASBuilder {
|
|||
logOut.writeData("Opening \(port) at 1200 baud\n".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!)
|
||||
}
|
||||
if let dummyConnection = ASSerial.openPort(port, withSpeed: 1200) {
|
||||
ASSerial.restorePort(dummyConnection.fileDescriptor)
|
||||
dummyConnection.closeFile()
|
||||
sleep(5)
|
||||
for (var retry=0; retry < 10; ++retry) {
|
||||
close(dummyConnection.fileDescriptor)
|
||||
for (var retry=0; retry < 40; ++retry) {
|
||||
usleep(250000)
|
||||
if (NSFileManager.defaultManager().fileExistsAtPath(port)) {
|
||||
if verbosity > 0 {
|
||||
logOut.writeData("Found port \(port) after \(retry) attempts.\n".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!)
|
||||
|
|
|
@ -474,7 +474,9 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
|||
ASSerialWin.portAvailableAfterUpload(self.port)
|
||||
})
|
||||
}
|
||||
self.builder.uploadProject(self.board, programmer:self.programmer, port:ASSerial.fileNameForPort(self.port))
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
self.builder.uploadProject(self.board, programmer:self.programmer, port:ASSerial.fileNameForPort(self.port))
|
||||
})
|
||||
}
|
||||
buildProject(sender)
|
||||
}
|
||||
|
|
|
@ -58,9 +58,10 @@ NSString * kASSerialPortsChanged = @"PortsChanged";
|
|||
newAttr = origAttr;
|
||||
cfmakeraw(&newAttr);
|
||||
cfsetspeed(&newAttr, speed);
|
||||
newAttr.c_cflag |= CS8 | CCTS_OFLOW | CRTS_IFLOW;
|
||||
newAttr.c_cflag &= ~(PARENB);
|
||||
newAttr.c_cflag &= ~(PARENB | CSIZE | CSTOPB | CRTSCTS);
|
||||
newAttr.c_cflag |= CS8;
|
||||
tcsetattr(fd, TCSANOW, &newAttr);
|
||||
tcsetattr(fd, TCSAFLUSH, &newAttr);
|
||||
if (!savedAttrs) {
|
||||
savedAttrs = [NSMutableDictionary dictionary];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user