void MTWLEDLogic() // called from main loop
{
  patterncode pattern = MTWLED_lastpattern;
  int swing;
  
  if(MTWLED_control==1 || MTWLED_control==255) return;

  if(MTWLEDEndstop(false)) return;
  
  if(pattern.value==mtwled_nochange) return;
  if(MTWLED_timer > millis()) return;

  if(MTWLED_control==-1) { // if this is first time display endstop status before clearing to ready
     MTWLEDEndstop(true);
     MTWLED_control=0;
     return;
  }

  if((degTargetHotend(0) == 0)) {
    if((degHotend(0) > MTWLED_cool)) // heater is off but still warm
      pattern.value=MTWLEDConvert(mtwled_heateroff);
    else
      pattern.value=MTWLEDConvert(mtwled_ready);
    MTWLEDUpdate(pattern);
  } else {
    swing=abs(degTargetHotend(0) - degHotend(0)); // how far off from target temp we are
    if(swing < MTWLED_swing*2) {                  // if within double the swing threshold
      if(isHeatingHotend(0)) pattern.value=MTWLEDConvert(mtwled_templow);    // heater is on so temp must be low
      if(isCoolingHotend(0)) pattern.value=MTWLEDConvert(mtwled_temphigh);   // heater is off so temp must be high
      if(swing < MTWLED_swing) pattern.value=MTWLEDConvert(mtwled_temphit);  // close to target temp, so consider us 'at temp'
      MTWLEDUpdate(pattern);
    } 
  }
}
Exemplo n.º 2
0
static void lcd_fd()
{
if (fil_temp == 200)
{
setTargetHotend0(plaPreheatHotendTemp);
}
if (fil_temp == 230)
{
setTargetHotend0(absPreheatHotendTemp);
}
setWatch(); // heater sanity check timer
if (!isHeatingHotend(0)&&(filament_seq == 0))
{
filament_seq = 1;
}
if ((filament_seq == 0)&&(pausa_display == 0))
{
pausa_display = 1;
}
if (filament_seq == 1)
{   
if (st_message == 0)  
    {
	lcdDrawUpdate = 2;  
	lcd_implementation_message0(PSTR(""));
    lcd_implementation_message1(PSTR("Se puede sacar"));
	lcd_implementation_message2(PSTR("el filamento.."));
	lcd_implementation_message3(PSTR(""));
	}
}
else
    {
    lcd_implementation_message4(PSTR(" Calentando..."));
    _draw_heater_status(6, 0);
	lcdDrawUpdate = 1;
	u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
	
	}
	
if ((LCD_CLICKED) || (degTargetHotend(0) == 0)  || (currentMenu == lcd_status_screen))
	{
 	filament_seq = 0;
	st_message = 0;
	pausa_display = 0;
	encoder_zero = 0;
	setTargetHotend0(0);
	lcd_return_to_status();
    }
}
Exemplo n.º 3
0
void MTWLEDLogic() // called from main loop
{
  patterncode pattern = MTWLED_lastpattern;
  
  if(MTWLED_control==1 || MTWLED_control==255) return;
  if(MTWLEDEndstop(false)) return;
//  if(pattern.value==mtwled_nochange) return;
  if(MTWLED_timer > millis()) return;
  if(MTWLED_control==-1) { // if this is first time display endstop status before clearing to ready
     MTWLEDEndstop(true);
     MTWLED_control=0;
     return;
  }

  if((degTargetHotend(active_extruder) == 0)) { // assume not printing since target temp is zero
    if((degHotend(active_extruder) > MTWLED_cool)) // heater is off but still warm
      pattern.value=MTWLEDConvert(mtwled_heateroff);
    else {
      pattern.value=MTWLEDConvert(mtwled_ready);
      MTWLED_heated=false;
    }
    MTWLEDUpdate(pattern);
  } else {
    if(MTWLED_heated)
      switch(MTWLED_mode) {
//        case 2: // display XYZ position colors separately needs pattern 8 implemented in controller
//          MTWLEDUpdate(8,(current_position[X_AXIS]/X_MAX_POS)*50+5,(current_position[Z_AXIS]/Z_MAX_POS)*100+5,(current_position[Y_AXIS]/Y_MAX_POS)*50+5,1);
//          break;
        case 1: // XYZ position used as RBG
          MTWLEDUpdate(10,(current_position[X_AXIS]/X_MAX_POS)*50+5,(current_position[Z_AXIS]/Z_MAX_POS)*100+5,(current_position[Y_AXIS]/Y_MAX_POS)*50+5,1);
          break;
        case 0:
        default: // show solid color based on XYZ=RGB color values
          if(abs(degTargetHotend(active_extruder) - degHotend(active_extruder)) > MTWLED_swing) {              // temp is not close to target
            if(isHeatingHotend(active_extruder)) pattern.value=MTWLEDConvert(mtwled_templow);    // heater is on so temp must be low
            if(isCoolingHotend(active_extruder)) pattern.value=MTWLEDConvert(mtwled_temphigh);   // heater is off so temp must be high
          } else {                                                                 // temp is close to target
            pattern.value=MTWLEDConvert(mtwled_temphit);                           // close to target temp, so consider us 'at temp'
          }
          MTWLEDUpdate(pattern);
          break;
      }
    }
}
Exemplo n.º 4
0
static void lcd_fc()
{
if (fil_temp == 200)
{
setTargetHotend0(plaPreheatHotendTemp);
}
if (fil_temp == 230)
{
setTargetHotend0(absPreheatHotendTemp);
}
setWatch(); // heater sanity check timer
if (!isHeatingHotend(0)&&(filament_seq == 0))
{
filament_seq = 1;
}
if ((filament_seq == 0)&&(pausa_display == 0))
{
pausa_display = 1;
}
if (filament_seq == 1)
{   
if (st_message == 0)  
    {
	lcdDrawUpdate = 2;  
	lcd_implementation_message0(PSTR("Introducir el nuevo"));
    lcd_implementation_message1(PSTR("filamento y girar el  "));
	lcd_implementation_message2(PSTR("boton hasta que"));
	lcd_implementation_message3(PSTR("salga el filamento"));
	if (encoder_zero == 0)
	{
	encoderPosition = 0;
	encoder_zero = 1;
	}
	}
    if (encoderPosition != 0)
    {
	    move_menu_scale = 1.0;
        current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
        encoderPosition = 0;
		 #ifdef DELTA
        calculate_delta(current_position);
        plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
        #else
        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
        #endif
        lcdDrawUpdate = 2;
		st_message = 1;
    }
	
    if ((lcdDrawUpdate) && (st_message == 1))
    {
	lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
    }

}
else
    {
    lcd_implementation_message4(PSTR(" Calentando..."));
    _draw_heater_status(6, 0);
	lcdDrawUpdate = 1;
	u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
	
	}
	
if ((LCD_CLICKED) || (degTargetHotend(0) == 0)  || (currentMenu == lcd_status_screen))
	{
 	filament_seq = 0;
	st_message = 0;
	pausa_display = 0;
	encoder_zero = 0;
	setTargetHotend0(0);
	lcd_return_to_status();
    }
}