parent
cf0116ea74
commit
ec921eb53b
|
|
@ -0,0 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
// Register map for MMU
|
||||
enum class Register : uint8_t
|
||||
{
|
||||
Project_Major = 0x00,
|
||||
Project_Minor = 0x01,
|
||||
Project_Revision = 0x02,
|
||||
Project_Build_Number = 0x03,
|
||||
MMU_Errors = 0x04,
|
||||
Current_Progress_Code = 0x05,
|
||||
Current_Error_Code = 0x06,
|
||||
Filament_State = 0x07,
|
||||
FINDA_State = 0x08,
|
||||
FSensor_State = 0x09,
|
||||
Motor_Mode = 0x0A,
|
||||
Extra_Load_Distance = 0x0B,
|
||||
FSensor_Unload_Check_Distance = 0xC,
|
||||
Pulley_Unload_Feedrate = 0x0D,
|
||||
Pulley_Acceleration = 0x0E,
|
||||
Selector_Acceleration = 0x0F,
|
||||
Idler_Acceleration = 0x10,
|
||||
Pulley_Load_Feedrate = 0x11,
|
||||
Selector_Nominal_Feedrate = 0x12,
|
||||
Idler_Nominal_Feedrate = 0x13,
|
||||
Pulley_Slow_Feedrate = 0x14,
|
||||
Selector_Homing_Feedrate = 0x15,
|
||||
Idler_Homing_Feedrate = 0x16,
|
||||
Pulley_sg_thrs_R = 0x17,
|
||||
Selector_sg_thrs_R = 0x18,
|
||||
Idler_sg_thrs_R = 0x19,
|
||||
Get_Pulley_Position = 0x1A,
|
||||
Set_Get_Selector_Slot = 0x1B,
|
||||
Set_Get_Idler_Slot = 0x1C,
|
||||
Set_Get_Selector_Cut_iRun = 0x1D,
|
||||
Set_Get_Pulley_iRun = 0x1E,
|
||||
Set_Get_Selector_iRun = 0x1F,
|
||||
Set_Get_Idler_iRun = 0x20,
|
||||
Reserved = 0x21,
|
||||
};
|
||||
|
|
@ -26,20 +26,20 @@ namespace MMU2 {
|
|||
/// To save space a "dumb" solution was chosen + a few static_assert checks in errors_list.h preventing the code from compiling when the string doesn't match.
|
||||
static constexpr uint8_t supportedMmuFWVersion[3] PROGMEM = { mmuVersionMajor, mmuVersionMinor, mmuVersionPatch };
|
||||
|
||||
const uint8_t ProtocolLogic::regs8Addrs[ProtocolLogic::regs8Count] PROGMEM = {
|
||||
8, // FINDA state
|
||||
0x1b, // Selector slot
|
||||
0x1c, // Idler slot
|
||||
const Register ProtocolLogic::regs8Addrs[ProtocolLogic::regs8Count] PROGMEM = {
|
||||
Register::FINDA_State, // FINDA state
|
||||
Register::Set_Get_Selector_Slot, // Selector slot
|
||||
Register::Set_Get_Idler_Slot, // Idler slot
|
||||
};
|
||||
|
||||
const uint8_t ProtocolLogic::regs16Addrs[ProtocolLogic::regs16Count] PROGMEM = {
|
||||
4, // MMU errors - aka statistics
|
||||
0x1a, // Pulley position [mm]
|
||||
const Register ProtocolLogic::regs16Addrs[ProtocolLogic::regs16Count] PROGMEM = {
|
||||
Register::MMU_Errors, // MMU errors - aka statistics
|
||||
Register::Get_Pulley_Position, // Pulley position [mm]
|
||||
};
|
||||
|
||||
const uint8_t ProtocolLogic::initRegs8Addrs[ProtocolLogic::initRegs8Count] PROGMEM = {
|
||||
0x0b, // extra load distance [mm]
|
||||
0x14, // pulley slow feedrate [mm/s]
|
||||
const Register ProtocolLogic::initRegs8Addrs[ProtocolLogic::initRegs8Count] PROGMEM = {
|
||||
Register::Extra_Load_Distance, // extra load distance [mm]
|
||||
Register::Pulley_Slow_Feedrate, // pulley slow feedrate [mm/s]
|
||||
};
|
||||
|
||||
void ProtocolLogic::CheckAndReportAsyncEvents() {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "mmu2/error_codes.h"
|
||||
#include "mmu2/progress_codes.h"
|
||||
#include "mmu2/buttons.h"
|
||||
#include "mmu2/registers.h"
|
||||
#include "mmu2_protocol.h"
|
||||
|
||||
// #include <array> std array is not available on AVR ... we need to "fake" it
|
||||
|
|
@ -372,19 +373,19 @@ private:
|
|||
// 8bit registers
|
||||
static constexpr uint8_t regs8Count = 3;
|
||||
static_assert(regs8Count > 0); // code is not ready for empty lists of registers
|
||||
static const uint8_t regs8Addrs[regs8Count] PROGMEM;
|
||||
static const Register regs8Addrs[regs8Count] PROGMEM;
|
||||
uint8_t regs8[regs8Count] = { 0, 0, 0 };
|
||||
|
||||
// 16bit registers
|
||||
static constexpr uint8_t regs16Count = 2;
|
||||
static_assert(regs16Count > 0); // code is not ready for empty lists of registers
|
||||
static const uint8_t regs16Addrs[regs16Count] PROGMEM;
|
||||
static const Register regs16Addrs[regs16Count] PROGMEM;
|
||||
uint16_t regs16[regs16Count] = { 0, 0 };
|
||||
|
||||
// 8bit init values to be sent to the MMU after line up
|
||||
static constexpr uint8_t initRegs8Count = 2;
|
||||
static_assert(initRegs8Count > 0); // code is not ready for empty lists of registers
|
||||
static const uint8_t initRegs8Addrs[initRegs8Count] PROGMEM;
|
||||
static const Register initRegs8Addrs[initRegs8Count] PROGMEM;
|
||||
uint8_t initRegs8[initRegs8Count];
|
||||
|
||||
uint8_t regIndex;
|
||||
|
|
|
|||
Loading…
Reference in New Issue