Heated bed zones
Hello there,
I'm building a 3D-printer which has 4 heated bed zones because of it's size.
I'm using the Arduino Due with the RADDS board.
It's connected via I2C with an Arduino Mini which is only for the bed temperature control.
So I made a little custom event in the firmware:
#ifndef CustomEventsImpl_H #define CustomEventsImpl_H #include <Wire.h> String temps; char data[32]; bool Custom_MCode(GCode *com){ switch(com->M){ case 140: if(com->hasA() && com->hasB() && com->hasC() && com->hasD()){ temps = String(com->A) + "," + String(com->B) + "," + String(com->C) + "," + String(com->D); temps.toCharArray(data, 32); Wire.begin(); Wire.beginTransmission(98); Wire.write(data); Wire.endTransmission(); float highestTemp = 0; if(com->A > highestTemp){ highestTemp = com->A; } if(com->B > highestTemp){ highestTemp = com->B; } if(com->C > highestTemp){ highestTemp = com->C; } if(com->D > highestTemp){ highestTemp = com->D; } heatedBedController.setTargetTemperature(highestTemp); Com::print(heatedBedController.currentTemperatureC); Com::print("-----Heizbett-----\n"); Com::print("Zone 1: "); Com::print(com->A); Com::print("°C\n"); Com::print("Zone 2: "); Com::print(com->B); Com::print("°C\n"); Com::print("Zone 3: "); Com::print(com->C); Com::print("°C\n"); Com::print("Zone 4: "); Com::print(com->D); Com::print("°C\n"); } else{ Com::print("-----Heizbett-----\n"); Com::printErrorFLN("Fehlerhafter Heizbettbefehl."); Com::print("Format muss wie folgt aussehen: "); Com::print("M140 A000 B000 C000 D000\n"); Commands::emergencyStop; } return true; break; } } #endif
It overrides the standard M140. Mine has 4 parameters now (A, B, C, D). If it gets a correct M code it sends the temperatures to the Arduino Mini which takes care of the rest.
But now I don't know how to ask the slave device repeatedly for the current temperature. I assume that I have to fiddle with the TemperatureController.
I dont know if its important but here is the customEvents.h
#ifndef CustomEvents_H #define CustomEvents_H //G and M code replacements and /or additional #undef EVENT_UNHANDLED_M_CODE(c) #define EVENT_UNHANDLED_M_CODE(c) Custom_MCode(c) extern bool Custom_MCode(GCode *com); #endif
So if someone could assist me with my problem I would be very glad.
Thank you in advance, Luca.
Comments