Permalink
Browse files

version 3.1 branch

  • Loading branch information...
1 parent a884097 commit ca8787943a57da96ca4c9d4fdb8d695b0b8084c5 @FarMcKon FarMcKon committed Sep 30, 2011
View
@@ -1 +1 @@
-3.00
+3.2
View
@@ -99,11 +99,15 @@ bool processQueryPacket(const InPacket& from_host, OutPacket& to_host) {
to_host.append8(RC_OK);
return true;
case SLAVE_CMD_GET_TEMP:
+ {
to_host.append8(RC_OK);
- to_host.append16(board.getExtruderHeater().get_current_temperature());
+ to_host.append16(board.get_current_temperature());
+ //was board.ExtruderHeater().get_current_temperature(););
return true;
+ }
case SLAVE_CMD_SET_TEMP:
- board.getExtruderHeater().set_target_temperature(from_host.read16(2));
+ board.set_target_temperature(from_host.read16(2));
+ //getExtruderHeater().set_target_temperature(from_host.read16(2));
to_host.append8(RC_OK);
return true;
case SLAVE_CMD_READ_FROM_EEPROM:
@@ -133,7 +137,7 @@ bool processQueryPacket(const InPacket& from_host, OutPacket& to_host) {
to_host.append8(RC_OK);
return true;
case SLAVE_CMD_TOGGLE_FAN:
- board.setFan((from_host.read8(2) & 0x01) != 0);
+ board.toggleFan((from_host.read8(2) & 0x01) != 0);
to_host.append8(RC_OK);
return true;
case SLAVE_CMD_TOGGLE_VALVE:
@@ -230,6 +234,10 @@ bool processQueryPacket(const InPacket& from_host, OutPacket& to_host) {
to_host.append8(RC_OK);
board.lightIndicatorLED();
return true;
+ case SLAVE_CMD_TOGGLE_ABP:
+ board.toggleAutomatedBuildPlatform((from_host.read8(2) & 0x01) != 0);
+ to_host.append8(RC_OK);
+
}
}
return false;
@@ -190,6 +190,17 @@ void ExtruderBoard::runExtruderSlice() {
}
}
+int ExtruderBoard::get_current_temperature()
+{
+ return extruder_heater.get_current_temperature();
+}
+
+void ExtruderBoard::set_target_temperature(int temp )
+{
+ return extruder_heater.set_target_temperature(temp);
+}
+
+
void ExtruderBoard::setMotorSpeed(int16_t speed) {
setExtruderMotor(speed);
}
@@ -260,8 +271,13 @@ void setChannel(ChannelChoice c, uint8_t value, bool binary) {
}
}
-void ExtruderBoard::setFan(bool on) {
- setChannel(abp_channel,on?255:0,true);
+void ExtruderBoard::toggleFan(bool state)
+{ // The Goggles, they do nothing!
+ // on these board, there is no toggle fan. This is vestigle
+}
+
+void ExtruderBoard::toggleAutomatedBuildPlatform(bool state) {
+ setChannel(abp_channel,state?255:0,true);
}
// When using as a valve driver, always use channel A, regardless of
@@ -85,6 +85,9 @@ public:
uint8_t getResetFlags();
+ int get_current_temperature();
+ void set_target_temperature(int);
+
Heater& getExtruderHeater() { return extruder_heater; }
Heater& getPlatformHeater() { return platform_heater; }
@@ -97,7 +100,8 @@ public:
// Stops/starts the motor while holding torque
void setMotorOn(bool on);
#endif
- void setFan(bool on);
+ void toggleFan(bool state);
+ void toggleAutomatedBuildPlatform(bool state);
void setValve(bool on);
UART& getHostUART() { return UART::getHostUART(); }
@@ -162,6 +162,19 @@ void ExtruderBoard::runExtruderSlice() {
coolingFan.manageCoolingFan();
}
+int ExtruderBoard::get_current_temperature()
+{
+ coolingFan.manageCoolingFan();
+ return extruder_heater.get_current_temperature();
+}
+
+void ExtruderBoard::set_target_temperature(int temp )
+{
+ coolingFan.manageCoolingFan();
+ return extruder_heater.set_target_temperature(temp);
+}
+
+
void ExtruderBoard::setMotorSpeed(int16_t speed) {
// Since the motor and regulated cooling fan share an output, only one can be enabled at a time.
// Therefore, we should override the motor speed command if the cooling fan is activated.
@@ -230,12 +243,19 @@ void ExtruderBoard::doInterrupt() {
}
}
-void ExtruderBoard::setFan(bool on) {
+//runs the AutoBuildPlatform (connected to 'Extra' screw terms on ECv3.x )
+void ExtruderBoard::toggleAutomatedBuildPlatform(bool state)
+{
+ CHANNEL_A.setValue(state);
+}
+
+//runs the Extruder Cooling Fan (connected to 'A1/B1' screw term on ECv3.x)
+void ExtruderBoard::toggleFan(bool state) {
//CHANNEL_A.setValue(on);
MOTOR_DIR_PIN.setDirection(true);
MOTOR_DIR_PIN.setValue(true);
MOTOR_ENABLE_PIN.setDirection(true);
- MOTOR_ENABLE_PIN.setValue(on);
+ MOTOR_ENABLE_PIN.setValue(state);
}
void ExtruderBoard::setValve(bool on) {
@@ -81,13 +81,16 @@ private:
public:
void reset(uint8_t resetFlags);
- void runExtruderSlice();
+ void runExtruderSlice();
// Return the processor's reset status flags. These are useful
// for diagnosing what might have triggered the last processor
// reset.
uint8_t getResetFlags();
+ int get_current_temperature();
+ void set_target_temperature(int);
+
Heater& getExtruderHeater() { return extruder_heater; }
Heater& getPlatformHeater() { return platform_heater; }
@@ -96,7 +99,13 @@ public:
void setMotorSpeed(int16_t speed);
void setMotorSpeedRPM(uint32_t speed, bool direction) {} // Unsupported on 3.4
- void setFan(bool on);
+ /// Enable/Disable the extruder cooling fan
+ void toggleFan(bool state);
+
+ /// Enable/Disable the automatic build platform motor
+ void toggleAutomatedBuildPlatform(bool state);
+
+
void setValve(bool on);
UART& getHostUART() { return UART::getHostUART(); }
View
@@ -170,16 +170,16 @@ bool void handleVersion2(uint16 host_driver_version) {
// puts fw version into a reply packet, and send it back
inline void handleVersion(const InPacket& from_host, OutPacket& to_host) {
- // Case to give an error on Replicator G versions older than 0025. See footnote 1
- if(from_host.read16(1) <= 25 ) {
+ // Case to give an error on Replicator G versions older than 0027.
+ // See footnote 1, footnote 2
+ if(from_host.read16(1) <= 26 ) {
to_host.append8(RC_OK);
to_host.append16(0x0000);
}
else {
to_host.append8(RC_OK);
to_host.append16(firmware_version);
}
-
}
inline void handleGetBuildName(const InPacket& from_host, OutPacket& to_host) {
@@ -587,3 +587,8 @@ void stopBuild() {
* lie, and reply with firmware 0.00 to case ReplicatorG to display a 'null version' error
* so users will know to upgrade.
*/
+/* footnote 2: due to an overlap in control between Automated Build Platform, and
+ * fan control, firmware 3.01 and newer only works with replicatorG 0027 or newer.
+ * Long story short, some fw 2.8 -> fw 3.0 refactoring did not work as expected, and
+ * broke running ABP and Mk6/Mk7 extruder Fan on the same machine
+ */
@@ -23,8 +23,8 @@
// TODO: Make this a class.
/// Functions in the host namespace deal with communications to the host
-/// computer. The host also implents a simple state machine, because it is
-/// also responsable for handling prints from SD card.
+/// computer. The host also implements a simple state machine, because it is
+/// also responsible for handling prints from SD card.
namespace host {
const int MAX_MACHINE_NAME_LEN = 32;
@@ -34,7 +34,7 @@ const int MAX_FILE_LEN = MAX_PACKET_PAYLOAD-1;
enum HostState {
HOST_STATE_READY = 0,
HOST_STATE_BUILDING = 1,
- HOST_STATE_BUILDING_FROM_SD = 2,
+ HOST_STATE_BUILDING_FROM_SD = 2,
HOST_STATE_ERROR = 3
};
@@ -135,6 +135,7 @@
#define SLAVE_CMD_ABORT 24
#define SLAVE_CMD_READ_FROM_EEPROM 25
#define SLAVE_CMD_WRITE_TO_EEPROM 26
+#define SLAVE_CMD_TOGGLE_ABP 27
#define SLAVE_CMD_GET_PLATFORM_TEMP 30
#define SLAVE_CMD_SET_PLATFORM_TEMP 31
@@ -3,8 +3,9 @@
//#include "ExtruderMotor.hh"
#include "Eeprom.hh"
#include "EepromMap.hh"
+
#ifdef IS_EXTRUDER_BOARD
-#include "ExtruderBoard.hh"
+ #include "ExtruderBoard.hh"
#endif
#define FAN_ENABLED 1
@@ -49,34 +50,28 @@ void CoolingFan::enable() {
void CoolingFan::disable() {
enabled = false;
- disableFan();
+ toggleFan(false);
}
void CoolingFan::manageCoolingFan() {
// TODO: only change the state if necessary
if (enabled) {
if (heater.get_current_temperature() > setPoint) {
- enableFan();
+ toggleFan(true);
}
else {
- disableFan();
+ toggleFan(false);
}
}
}
-void CoolingFan::enableFan() {
+void CoolingFan::toggleFan(bool state)
+{
#ifdef IS_EXTRUDER_BOARD
- ExtruderBoard::getBoard().setFan(true);
+ ExtruderBoard::getBoard().toggleFan(state);
#else
#warning cooling fan feature disabled
#endif
}
-void CoolingFan::disableFan() {
-#ifdef IS_EXTRUDER_BOARD
-//#warning cooling fan feature disabled
- ExtruderBoard::getBoard().setFan(false);
-#else
- #warning cooling fan feature disabled
-#endif
-}
+
@@ -34,11 +34,9 @@
/// \ingroup SoftwareLibraries
class CoolingFan {
private:
- /// Enable the cooling fan, setting it to run at full speed.
- void enableFan();
- /// Disable the cooling fan, halting it immediately.
- void disableFan();
+ /// Enable/Disable the cooling fan, setting it to run at full speed.
+ void toggleFan(bool state);
Heater& heater; ///< Heater module to read the current temperature from.

0 comments on commit ca87879

Please sign in to comment.