Skip to content

Commit

Permalink
Improved valve handling (disabling temp loop on valve set and vice ve…
Browse files Browse the repository at this point in the history
…rsa)
  • Loading branch information
Adam Mayer authored and Adam Mayer committed Apr 28, 2010
1 parent 98514f9 commit 695bd7e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions v2/src/Extruder/Host.cc
Expand Up @@ -124,6 +124,7 @@ bool processQueryPacket(const InPacket& from_host, OutPacket& to_host) {
to_host.append16(board.getPlatformHeater().get_current_temperature());
return true;
case SLAVE_CMD_SET_PLATFORM_TEMP:
board.setUsingPlatform(true);
board.getPlatformHeater().set_target_temperature(from_host.read16(2));
to_host.append8(RC_OK);
return true;
Expand Down
4 changes: 3 additions & 1 deletion v2/src/Extruder/TemperatureThread.cc
Expand Up @@ -21,5 +21,7 @@
void runTempSlice() {
ExtruderBoard& board = ExtruderBoard::getBoard();
board.getExtruderHeater().manage_temperature();
board.getPlatformHeater().manage_temperature();
if (board.isUsingPlatform()) {
board.getPlatformHeater().manage_temperature();
}
}
11 changes: 8 additions & 3 deletions v2/src/Extruder/boards/ecv22/ExtruderBoard.cc
Expand Up @@ -35,7 +35,8 @@ ExtruderBoard::ExtruderBoard() :
extruder_thermistor(THERMISTOR_PIN,0),
platform_thermistor(PLATFORM_PIN,1),
extruder_heater(extruder_thermistor,extruder_element),
platform_heater(platform_thermistor,platform_element)
platform_heater(platform_thermistor,platform_element),
using_platform(true)
{
}

Expand Down Expand Up @@ -112,13 +113,19 @@ void ExtruderBoard::setFan(bool on) {
}

void ExtruderBoard::setValve(bool on) {
setUsingPlatform(false);
pwmAOn(false);
channel_a.setValue(on);
}

void ExtruderBoard::indicateError(int errorCode) {
DEBUG_LED.setValue(errorCode != 0);
}

void ExtruderBoard::setUsingPlatform(bool is_using) {
using_platform = is_using;
}

/// Timer one comparator match interrupt
ISR(TIMER1_COMPA_vect) {
ExtruderBoard::getBoard().doInterrupt();
Expand All @@ -139,8 +146,6 @@ void ExtruderHeatingElement::setHeatingElement(uint8_t value) {
}
}



void BuildPlatformHeatingElement::setHeatingElement(uint8_t value) {
// This is a bit of a hack to get the temperatures right until we fix our
// PWM'd PID implementation. We reduce the MV to one bit, essentially.
Expand Down
3 changes: 3 additions & 0 deletions v2/src/Extruder/boards/ecv22/ExtruderBoard.hh
Expand Up @@ -55,13 +55,16 @@ public:
void doInterrupt();
/// Indicate an error by manipulating the debug LED.
void indicateError(int errorCode);
bool isUsingPlatform() { return using_platform; }
void setUsingPlatform(bool is_using);
private:
Thermistor extruder_thermistor;
Thermistor platform_thermistor;
ExtruderHeatingElement extruder_element;
BuildPlatformHeatingElement platform_element;
Heater extruder_heater;
Heater platform_heater;
bool using_platform;
/// Microseconds since board initialization
volatile micros_t micros;
ExtruderBoard();
Expand Down

0 comments on commit 695bd7e

Please sign in to comment.