Remove io_atmega2560.h and some more macros
This commit is contained in:
parent
eb007c35d2
commit
c3abd4ffe6
12 changed files with 79 additions and 452 deletions
Firmware
|
@ -13,8 +13,9 @@
|
|||
#include "sound.h"
|
||||
#include "printers.h"
|
||||
#include <avr/pgmspace.h>
|
||||
#include "io_atmega2560.h"
|
||||
#include "AutoDeplete.h"
|
||||
#include "fastio.h"
|
||||
#include "pins.h"
|
||||
//-//
|
||||
#include "util.h"
|
||||
|
||||
|
@ -28,9 +29,6 @@
|
|||
#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds
|
||||
#define MMU_MAX_RESEND_ATTEMPTS 2
|
||||
|
||||
#ifdef MMU_HWRESET
|
||||
#define MMU_RST_PIN 76
|
||||
#endif //MMU_HWRESET
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -156,8 +154,8 @@ void mmu_init(void)
|
|||
_delay_ms(10); //wait 10ms for sure
|
||||
mmu_reset(); //reset mmu (HW or SW), do not wait for response
|
||||
mmu_state = S::Init;
|
||||
PIN_INP(IR_SENSOR_PIN); //input mode
|
||||
PIN_SET(IR_SENSOR_PIN); //pullup
|
||||
SET_INPUT(IR_SENSOR_PIN); //input mode
|
||||
WRITE(IR_SENSOR_PIN, 1); //pullup
|
||||
}
|
||||
|
||||
//if IR_SENSOR defined, always returns true
|
||||
|
@ -170,7 +168,7 @@ bool check_for_ir_sensor()
|
|||
|
||||
bool detected = false;
|
||||
//if IR_SENSOR_PIN input is low and pat9125sensor is not present we detected idler sensor
|
||||
if ((PIN_GET(IR_SENSOR_PIN) == 0)
|
||||
if ((READ(IR_SENSOR_PIN) == 0)
|
||||
#ifdef PAT9125
|
||||
&& fsensor_not_responding
|
||||
#endif //PAT9125
|
||||
|
@ -363,7 +361,7 @@ void mmu_loop(void)
|
|||
case S::GetFinda: //response to command P0
|
||||
if (mmu_idl_sens)
|
||||
{
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
if (READ(IR_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
{
|
||||
#ifdef MMU_DEBUG
|
||||
printf_P(PSTR("MMU <= 'A'\n"));
|
||||
|
@ -406,7 +404,7 @@ void mmu_loop(void)
|
|||
case S::WaitCmd: //response to mmu commands
|
||||
if (mmu_idl_sens)
|
||||
{
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
if (READ(IR_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
{
|
||||
DEBUG_PRINTF_P(PSTR("MMU <= 'A'\n"));
|
||||
mmu_puts_P(PSTR("A\n")); //send 'abort' request
|
||||
|
@ -596,10 +594,10 @@ bool mmu_get_response(uint8_t move)
|
|||
mmu_loading_flag = true;
|
||||
if (can_extrude()) mmu_load_step();
|
||||
//don't rely on "ok" signal from mmu unit; if filament detected by idler sensor during loading stop loading movements to prevent infinite loading
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) move = MMU_NO_MOVE;
|
||||
if (READ(IR_SENSOR_PIN) == 0) move = MMU_NO_MOVE;
|
||||
break;
|
||||
case MMU_UNLOAD_MOVE:
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) //filament is still detected by idler sensor, printer helps with unlading
|
||||
if (READ(IR_SENSOR_PIN) == 0) //filament is still detected by idler sensor, printer helps with unlading
|
||||
{
|
||||
if (can_extrude())
|
||||
{
|
||||
|
@ -617,7 +615,7 @@ bool mmu_get_response(uint8_t move)
|
|||
}
|
||||
break;
|
||||
case MMU_TCODE_MOVE: //first do unload and then continue with infinite loading movements
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) //filament detected by idler sensor, we must unload first
|
||||
if (READ(IR_SENSOR_PIN) == 0) //filament detected by idler sensor, we must unload first
|
||||
{
|
||||
if (can_extrude())
|
||||
{
|
||||
|
@ -1460,7 +1458,7 @@ static bool can_load()
|
|||
current_position[E_AXIS] -= e_increment;
|
||||
plan_buffer_line_curposXYZE(MMU_LOAD_FEEDRATE);
|
||||
st_synchronize();
|
||||
if(0 == PIN_GET(IR_SENSOR_PIN))
|
||||
if(0 == READ(IR_SENSOR_PIN))
|
||||
{
|
||||
++filament_detected_count;
|
||||
DEBUG_PUTCHAR('O');
|
||||
|
@ -1491,7 +1489,7 @@ static bool load_more()
|
|||
{
|
||||
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++)
|
||||
{
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) return true;
|
||||
if (READ(IR_SENSOR_PIN) == 0) return true;
|
||||
DEBUG_PRINTF_P(PSTR("Additional load attempt nr. %d\n"), i);
|
||||
mmu_command(MmuCmd::C0);
|
||||
manage_response(true, true, MMU_LOAD_MOVE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue