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