Skip to content

Commit

Permalink
Merge pull request #10 from donovan6000/devel
Browse files Browse the repository at this point in the history
Converts Z value in EEPROM when switching between M3D and iMe firmwares
  • Loading branch information
donovan6000 committed Jun 2, 2016
2 parents 3645033 + 03d23a6 commit 689a9eb
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 129 deletions.
Binary file modified M3D Manager/M3D Manager Linux.zip
Binary file not shown.
Binary file modified M3D Manager/M3D Manager OS X.zip
Binary file not shown.
Binary file modified M3D Manager/M3D Manager Windows.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion M3D Manager/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Target platform options: WINDOWS32, WINDOWS64, OSX32, OSX64, LINUX32, LINUX64
PROGRAM_NAME = M3D\ Manager
VERSION = 0.04
VERSION = 0.05
TARGET_PLATFORM = LINUX64
USE_GUI = TRUE
IME_ROM_VERSION_STRING = 1900000009
Expand Down
23 changes: 13 additions & 10 deletions M3D Manager/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ void MyFrame::switchToMode(wxCommandEvent& event) {
else

// Return message
return {static_cast<string>("Printer has been successfully switched into ") + (newOperatingMode == FIRMWARE ? "firmware" : "bootloader") + " mode and is connected at " + printer.getCurrentSerialPort(), wxOK | wxICON_INFORMATION | wxCENTRE};
return {static_cast<string>("Printer has been successfully switched into ") + (newOperatingMode == FIRMWARE ? "firmware" : "bootloader") + " mode and is connected at " + printer.getCurrentSerialPort() + " running at a baud rate of " TOSTRING(PRINTER_BAUD_RATE), wxOK | wxICON_INFORMATION | wxCENTRE};
});

// Append thread complete callback to queue
Expand Down Expand Up @@ -1723,18 +1723,18 @@ ThreadTaskResponse MyFrame::installFirmware(const string &firmwareLocation) {

// Otherwise
else {

// Check if firmware ROM name is valid
uint8_t endOfNumbers = 0;
if(firmwareLocation.find_last_of('.') != string::npos)
endOfNumbers = firmwareLocation.find_last_of('.') - 1;
else
endOfNumbers = firmwareLocation.length() - 1;

int8_t beginningOfNumbers = endOfNumbers;
for(; beginningOfNumbers >= 0 && isdigit(firmwareLocation[beginningOfNumbers]); beginningOfNumbers--);

uint8_t beginningOfNumbers = endOfNumbers - 10;
for(; beginningOfNumbers && endOfNumbers > beginningOfNumbers && isdigit(firmwareLocation[endOfNumbers]); endOfNumbers--);

if(endOfNumbers != beginningOfNumbers)
if(beginningOfNumbers != endOfNumbers - 10)

// Return message
return {"Invalid firmware name", wxOK | wxICON_ERROR | wxCENTRE};
Expand Down Expand Up @@ -1798,11 +1798,14 @@ void MyFrame::sendCommand(const string &command, function<void()> threadStartCal
// Log error
logToConsole("Sending command failed");

// Otherwise
else {
// Otherwise check if not changing modes
else if(!changedMode) {

// Initialize response
string response;

// Wait until command receives a response
for(string response; !changedMode && response.substr(0, 2) != "ok" && response.substr(0, 2) != "rs" && response.substr(0, 4) != "skip" && response.substr(0, 5) != "Error";) {
do {

// Get response
do {
Expand Down Expand Up @@ -1837,7 +1840,7 @@ void MyFrame::sendCommand(const string &command, function<void()> threadStartCal

// Break
break;
}
} while(response.substr(0, 2) != "ok" && response.substr(0, 2) != "rs" && response.substr(0, 4) != "skip" && response.substr(0, 5) != "Error");
}

// Return empty response
Expand Down
12 changes: 6 additions & 6 deletions M3D Manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool installFirmware(const string &firmwareLocation, const string &serialPort);
#endif

// Create and show window
MyFrame *frame = new MyFrame("M3D Manager", wxDefaultPosition, wxSize(1118, 446), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));
MyFrame *frame = new MyFrame("M3D Manager", wxDefaultPosition, wxSize(559, 446), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));
frame->Center();
frame->Show(true);

Expand Down Expand Up @@ -566,18 +566,18 @@ void breakHandler(int signal) {
// Return false
return false;
}

// Check if firmware ROM name is valid
uint8_t endOfNumbers = 0;
if(firmwareLocation.find_last_of('.') != string::npos)
endOfNumbers = firmwareLocation.find_last_of('.') - 1;
else
endOfNumbers = firmwareLocation.length() - 1;

int8_t beginningOfNumbers = endOfNumbers;
for(; beginningOfNumbers >= 0 && isdigit(firmwareLocation[beginningOfNumbers]); beginningOfNumbers--);

uint8_t beginningOfNumbers = endOfNumbers - 10;
for(; beginningOfNumbers && endOfNumbers > beginningOfNumbers && isdigit(firmwareLocation[endOfNumbers]); endOfNumbers--);

if(endOfNumbers != beginningOfNumbers) {
if(beginningOfNumbers != endOfNumbers - 10)

// Display error
cout << "Invalid firmware ROM name" << endl;
Expand Down
Loading

0 comments on commit 689a9eb

Please sign in to comment.