A lot of changes for 2.10 (see README.md)

This commit is contained in:
Technik Gegg
2020-08-24 14:13:24 +02:00
parent 1a5b789349
commit 027761288f
65 changed files with 5496 additions and 2786 deletions

View File

@@ -1,8 +1 @@
# Sample Configuration Files
Copy one of these files as "SMUFF.CFG" onto the SMuFFs SD-Card before you start it up.
The \*_Duet.CFG defines all settings needed if you're running the SMuFF with a Duet3D controller board.
The \*_PMMU.CFG defines all settings needed if you're running the SMuFF in Prusa MMU emulation mode.
Configuration files with *Servo* in the name were needed if you've built the SMuFF servo version.
# Please use the SKR_mini config files

View File

@@ -1,74 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": true,
"EmulatePrusa": false,
"UnloadCommand": "",
"ServoMinPwm": 550,
"ServoMaxPwm": 2400,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": false,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": false,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,74 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": false,
"EmulatePrusa": true,
"UnloadCommand": "",
"ServoMinPwm": 550,
"ServoMaxPwm": 2400,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": true,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": false,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,74 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": false,
"EmulatePrusa": true,
"UnloadCommand": "",
"ServoMinPwm": 550,
"ServoMaxPwm": 2400,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": true,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": true,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,74 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": true,
"EmulatePrusa": false,
"UnloadCommand": "",
"ServoMinPwm": 550,
"ServoMaxPwm": 2400,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": false,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": true,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -0,0 +1,105 @@
{
"Serial0Baudrate": 57600,
"Serial1Baudrate": 57600,
"Serial2Baudrate": 57600,
"Serial3Baudrate": 57600,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"PowerSaveTimeout": 300,
"SendActionCmds": false,
"EmulatePrusa": true,
"UnloadCommand": "",
"ServoMinPwm": 800,
"ServoMaxPwm": 2400,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"HasPanelDue": 0,
"EncoderTicks": false,
"SendPeriodicalStats": true,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10,
"Mode": 1,
"Power": 700,
"RSense": 0.11,
"Microsteps": 16,
"Stall": 0,
"CoolStepMin": 5,
"CoolStepMax": 2,
"CoolStepDown": 1,
"DriverAddress": 0
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": true,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": true,
"ServoOffPos": 30,
"ServoOnPos": 90,
"Power": 700,
"Mode": 1,
"RSense": 0.11,
"Microsteps": 16,
"Stall": 0,
"CoolStepMin": 5,
"CoolStepMax": 2,
"CoolStepDown": 1,
"DriverAddress": 0
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false,
"SharedStepper": false,
"Mode": 1,
"Power": 700,
"RSense": 0.11,
"Microsteps": 16,
"Stall": 0,
"CoolStepMin": 5,
"CoolStepMax": 2,
"CoolStepDown": 1,
"DriverAddress": 0
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,75 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": true,
"EmulatePrusa": false,
"UnloadCommand": "",
"ServoMinPwm": 1000,
"ServoMaxPwm": 2000,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": false,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": false,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,76 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": false,
"EmulatePrusa": true,
"UnloadCommand": "",
"ServoMinPwm": 1000,
"ServoMaxPwm": 2000,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": true,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": false,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,76 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": false,
"EmulatePrusa": true,
"UnloadCommand": "",
"ServoMinPwm": 1000,
"ServoMaxPwm": 2000,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": true,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": true,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,75 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": true,
"EmulatePrusa": false,
"UnloadCommand": "",
"ServoMinPwm": 1000,
"ServoMaxPwm": 2000,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 12000,
"MaxSpeed": 2000,
"MaxSpeedHS": 2500,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 10
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": false,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": true,
"ServoOffPos": 30,
"ServoOnPos": 90
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 20000,
"MaxSpeed": 1400,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 3,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,3 +1 @@
# Sample Configuration Files
Copy one of these files as "SMUFF.CFG" onto the SMuFFs SD-Card before you start it up.
# Please use the SKR_mini config files

View File

@@ -1,75 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": false,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 30,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": false,
"EmulatePrusa": true,
"UnloadCommand": "",
"ServoMinPwm": 1000,
"ServoMaxPwm": 2000,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 10000,
"MaxSpeed": 2200,
"MaxSpeedHS": 2000,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 0
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 1000,
"ResetBeforeFeed": true,
"HomeAfterFeed": true,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 0,
"Wiggle": false,
"UseServo": true,
"ServoOffPos": 30,
"ServoOnPos": 90,
"ServoCycles": 0
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 10000,
"MaxSpeed": 1000,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 0,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,75 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"HasPanelDue": true,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 30,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": true,
"EmulatePrusa": false,
"UnloadCommand": "",
"ServoMinPwm": 1000,
"ServoMaxPwm": 2000,
"WipeSequence": "S200 I140 J160 P90 R20",
"BacklightColor": 4,
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 10000,
"MaxSpeed": 2200,
"MaxSpeedHS": 2000,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 0
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 22000,
"MaxSpeed": 10000,
"ResetBeforeFeed": true,
"HomeAfterFeed": false,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 5,
"Wiggle": false,
"UseServo": true,
"ServoOffPos": 30,
"ServoOnPos": 90,
"ServoCycles": 0
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 10000,
"MaxSpeed": 1000,
"InsertSpeed": 20000,
"ReinforceLength": 0,
"UnloadRetract": 0,
"UnloadPushback": 0,
"PushbackDelay": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 0,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5
},
"Materials": {
"T0": "PLA Green",
"T1": "PLA White",
"T2": "PLA Red",
"T3": "PLA Black",
"T4": "PLA Silver"
}
}

View File

@@ -1,7 +1,8 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"Serial0Baudrate": 57600,
"Serial1Baudrate": 57600,
"Serial2Baudrate": 57600,
"Serial3Baudrate": 57600,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
@@ -9,7 +10,6 @@
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": false,
"EmulatePrusa": true,

View File

@@ -1,56 +0,0 @@
{
"Serial1Baudrate": 56700,
"Serial2Baudrate": 56700,
"SerialDueBaudrate": 56700,
"ToolCount": 5,
"BowdenLength": 620.0,
"SelectorDist": 34.0,
"LCDContrast": 190,
"I2CAddress": 136,
"MenuAutoClose": 20,
"FanSpeed": 50,
"DelayBetweenPulses": false,
"PowerSaveTimeout": 300,
"Duet3DDirect": true,
"EmulatePrusa": false,
"UnloadCommand": "",
"Selector": {
"Offset": 0.5,
"Spacing": 21.0,
"StepsPerMillimeter": 80,
"Acceleration": 900,
"MaxSpeed": 100,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 20
},
"Revolver": {
"StepsPerRevolution": 9600,
"Offset": 1275,
"Acceleration": 6000,
"MaxSpeed": 1000,
"ResetBeforeFeed": true,
"HomeAfterFeed": false,
"InvertDir": false,
"EndstopTrigger": 1,
"StepDelay": 20,
"Wiggle": false
},
"Feeder": {
"ExternalControl": true,
"StepsPerMillimeter": 410,
"Acceleration": 1000,
"MaxSpeed": 1,
"InsertSpeed": 1000,
"ReinforceLength": 2.0,
"InvertDir": true,
"EndstopTrigger": 1,
"StepDelay": 20,
"EnableChunks": false,
"FeedChunks": 20,
"InsertLength": 5,
"DuetLaser": false
}
}

View File

@@ -17,7 +17,7 @@ The basic configuration (SMuFF.cfg) must to be located on the SD-Card. Thus, cha
From version 1.6 on, the firmware has been enhanced in order to enable you making changes directly from the UI, which means: No more fiddling in the JSON file.
Also new in the 1.6 version is the option to run GCode scripts from the SD-Card for testing purposes. In the **test** folder you'll find some sample scripts. Copy those to your SD-Card and pick one from within the menu to start the test run. Once started, the test will run infinitelly and can be stopped by clicking the encoder button.
For further information head over to the [Wiki pages](https://github.com/technik-gegg/SMuFF-1.1/wiki).
For more information head over to [the SMuFF website](https://sites.google.com/view/the-smuff/).
## What else?
@@ -26,6 +26,31 @@ If you like this project and find it useful, feel free to place a donation via P
## Recent changes
**2.10** - A lot of changes, such as TMC driver support; **Please read on**
+ finished the implementation of the Duet3D Laser Sensor (V2) which can be used as the Feeder endstop and is able to monitor filament jams.
+ added GCode **M412** which will switch on/off runout/jam detection or report its status, when using a Duet3D Laser Sensor.
+ removed configuration file variants. There's only one general config file left.
+ renamed configuration file from **.CFG** to **.CFG.json**. This makes it easier for some after market *VS-Code extensions* to validate and format its content. **Please notice:** This file is meant as a template for your initial configuration. Make sure you rename the template file to "**SMuFF.CFG**" after you've copied it onto the SMuFF's SD-Card.
+ added GCode **M17** which enables you to switch a relay in order to switch from external stepper (3D-Printer) to internal stepper (SMuFF). The parameter must either be **E** for the **external** or **I** for the **internal** stepper. The relay is controlled over the **RELAIS_PIN** in Pins.h. Read more about this [new feature here](https://sites.google.com/view/the-smuff/work-in-progress?authuser=0#h.qbpb6pvlq20x).
+ overhauled Settings Menu (moved additional settings into Options menu).
+ added **Serial0Baudrate** (for USB port) to config files, renamed **SerialDueBaudrate** to **Serial3Baudrate**.
+ fixed a bug for the old Revolver version where it refused to home correctly.
+ added defines for SERVO_LID and SERVO_WIPER for better code readability.
+ changed the behavior of boolean inputs (YES/NO and HI/LO) in the menus (they're single click now).
+ changed the increments on all stepper speeds (they'll now increment/decrement by 50).
+ moved some of the most common build flags (i.e. USE_xxx_DISPLAY) to the top of [platformio.ini](https://sites.google.com/view/the-smuff/how-to/tutorials/compile-the-firmware?authuser=0#h.3e6724efr6vl).
+ moved all initializing functions into **SetupInit.cpp**. SMuFF.cpp and setup() got much more streamlined now.
+ moved all periodical functions into **Periodicals.cpp**.
+ periodicals are now called from within **loop()**, which makes them more stable when handling serial I/O.
+ added the [SKR mini E3 V1.2](https://www.biqu.equipment/products/bigtreetech-skr-mini-e3-control-board-32-bit-integrated-tmc2209-uart-for-ender-4) and [SKR mini E3 DIP V1.1](https://www.biqu.equipment/products/bigtreetech-skr-e3-dip-v1-0-motherboard-for-ender-3) to the collection of usable boards.
+ rewrote the timers code. Encoder, Servos and Fans are now being served by one general purpose timer only. Servos are far more stable now.
+ added TMC-Stepper library for being able to support TMC2209 stepper drivers.
+ added TMC-Params to the stepper menus. You'll need those settings at least on the SKR mini **E3**, on the SKR mini **E3DIP** when using TMC2209s.
+ added GCodes **M122**, **M350**, **M569**, **M906** and **M914** for handling TMC stepper driver settings (see Marlin GCode what they're used for).
+ got the USB port working on E3 and E3 DIP on Windows.
+ added a couple of more parameters supported by the [M205 GCode](https://sites.google.com/view/the-smuff/tips-hints/talk-to-the-smuff?authuser=0#h.g5l7kws0923c) command.
**2.09** - Bugfix for PMMU mode
+ fixed the bug which didn't realize the **A**(bort) command comming from Marlins MMU code

View File

@@ -0,0 +1,202 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Connector_Generic_Conn_02x05_Odd_Even
#
DEF Connector_Generic_Conn_02x05_Odd_Even J 0 40 Y N 1 F N
F0 "J" 50 300 50 H V C CNN
F1 "Connector_Generic_Conn_02x05_Odd_Even" 50 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_2x??_*
$ENDFPLIST
DRAW
S -50 -195 0 -205 1 1 6 N
S -50 -95 0 -105 1 1 6 N
S -50 5 0 -5 1 1 6 N
S -50 105 0 95 1 1 6 N
S -50 205 0 195 1 1 6 N
S -50 250 150 -250 1 1 10 f
S 150 -195 100 -205 1 1 6 N
S 150 -95 100 -105 1 1 6 N
S 150 5 100 -5 1 1 6 N
S 150 105 100 95 1 1 6 N
S 150 205 100 195 1 1 6 N
X Pin_1 1 -200 200 150 R 50 50 1 1 P
X Pin_10 10 300 -200 150 L 50 50 1 1 P
X Pin_2 2 300 200 150 L 50 50 1 1 P
X Pin_3 3 -200 100 150 R 50 50 1 1 P
X Pin_4 4 300 100 150 L 50 50 1 1 P
X Pin_5 5 -200 0 150 R 50 50 1 1 P
X Pin_6 6 300 0 150 L 50 50 1 1 P
X Pin_7 7 -200 -100 150 R 50 50 1 1 P
X Pin_8 8 300 -100 150 L 50 50 1 1 P
X Pin_9 9 -200 -200 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Buzzer
#
DEF Device_Buzzer BZ 0 1 Y N 1 F N
F0 "BZ" 150 50 50 H V L CNN
F1 "Device_Buzzer" 150 -50 50 H V L CNN
F2 "" -25 100 50 V I C CNN
F3 "" -25 100 50 V I C CNN
$FPLIST
*Buzzer*
$ENDFPLIST
DRAW
A 0 0 125 -899 899 0 1 0 N 0 -125 0 125
P 2 0 1 0 -65 75 -45 75 N
P 2 0 1 0 -55 85 -55 65 N
P 2 0 1 0 0 125 0 -125 N
X - 1 -100 100 100 R 50 50 1 1 P
X + 2 -100 -100 100 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R
#
DEF Device_R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "Device_R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Rotary_Encoder_Switch
#
DEF Device_Rotary_Encoder_Switch SW 0 10 Y N 1 F N
F0 "SW" 0 260 50 H V C CNN
F1 "Device_Rotary_Encoder_Switch" 0 -260 50 H V C CNN
F2 "" -150 160 50 H I C CNN
F3 "" 0 260 50 H I C CNN
$FPLIST
RotaryEncoder*Switch*
$ENDFPLIST
DRAW
A -15 -2 108 -899 899 0 1 10 N -15 -110 -15 105
C -150 0 10 0 1 0 F
C -15 0 75 0 1 10 N
C 170 -40 5 0 1 10 N
C 170 40 5 0 1 10 N
S -200 200 200 -200 0 1 10 f
P 2 0 1 10 -25 -70 -25 70 N
P 2 0 1 10 -15 -70 -15 70 N
P 2 0 1 10 -5 70 -5 -70 N
P 2 0 1 10 150 0 135 0 N
P 2 0 1 10 150 40 150 -40 N
P 3 0 1 0 -200 -100 -150 -100 -150 -80 N
P 3 0 1 0 -200 100 -150 100 -150 80 N
P 3 0 1 10 10 -120 -20 -110 5 -95 N
P 3 0 1 10 10 115 -20 105 5 90 N
P 3 0 1 10 200 -100 170 -100 170 -40 N
P 3 0 1 10 200 100 170 100 170 40 N
P 4 0 1 0 -200 0 -150 0 -150 -40 -130 -80 N
P 4 0 1 0 -170 0 -150 0 -150 40 -130 80 N
X A A -300 100 100 R 50 50 1 1 P
X B B -300 -100 100 R 50 50 1 1 P
X C C -300 0 100 R 50 50 1 1 P
X S1 S1 300 100 100 L 50 50 1 1 P
X S2 S2 300 -100 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32
#
DEF SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32 U 0 40 Y Y 1 F N
F0 "U" -600 600 60 H V R TNN
F1 "SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32" -1350 600 60 H V L TNN
F2 "" 0 0 60 H I C CNN
F3 "" 0 0 60 H I C CNN
DRAW
S -1400 650 -450 100 0 1 0 N
X VCC 1 -1250 0 100 U 50 50 1 1 I
X VSS 2 -1050 0 100 U 50 50 1 1 O
X SCL 3 -850 0 100 U 50 50 1 1 I
X SDA 4 -650 0 100 U 50 50 1 1 I
ENDDRAW
ENDDEF
#
# Switch_SW_DIP_x01
#
DEF Switch_SW_DIP_x01 SW 0 0 Y N 1 F N
F0 "SW" 0 150 50 H V C CNN
F1 "Switch_SW_DIP_x01" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
SW?DIP?x1*
$ENDFPLIST
DRAW
C -80 0 20 0 0 0 N
C 80 0 20 0 0 0 N
S -150 100 150 -100 0 1 10 f
P 2 0 0 0 -60 5 93 46 N
X ~ 1 -300 0 200 R 50 50 1 1 P
X ~ 2 300 0 200 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Transistor_BJT_BC547
#
DEF Transistor_BJT_BC547 Q 0 0 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "Transistor_BJT_BC547" 200 0 50 H V L CNN
F2 "Package_TO_SOT_THT:TO-92_Inline" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
ALIAS BC546 BC548 BC549 BC550 BC337 BC338
$FPLIST
TO?92*
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 0 0 25 0 N
P 2 0 1 0 25 25 100 100 N
P 3 0 1 0 25 -25 100 -100 100 -100 N
P 3 0 1 20 25 75 25 -75 25 -75 N
P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F
X C 1 100 200 100 D 50 50 1 1 P
X B 2 -200 0 200 R 50 50 1 1 I
X E 3 100 -200 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# power_+5V
#
DEF power_+5V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_+5V" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +5V 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_GND
#
DEF power_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "power_GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
#End Library

View File

@@ -0,0 +1,43 @@
update=15.08.2020 07:20:00
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]
[schematic_editor]
version=1
PageLayoutDescrFile=
PlotDirectoryName=D:/Data/PlatformIO/SMuFF/Schematics/SKR mini E3 (DIP) LCD board/
SubpartIdSeparator=0
SubpartFirstId=65
NetFmtName=
SpiceAjustPassiveValues=0
LabSize=50
ERC_TestSimilarLabels=1

View File

@@ -0,0 +1,315 @@
EESchema Schematic File Version 4
LIBS:SKR mini LCD board-cache
EELAYER 29 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title "SKR Mini E3 (DIP) LCD board"
Date "2020-08-15"
Rev "1"
Comp "Technik Gegg"
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L SKR-mini-LCD-board-rescue:SSD1306-SSD1306_OLED-0.91-128x32 U1
U 1 1 5D888A8E
P 3150 3550
F 0 "U1" V 1563 3867 60 0000 C CNN
F 1 "SSD1306 0.96\" OLED" V 1669 3867 60 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical" H 3150 3550 60 0001 C CNN
F 3 "" H 3150 3550 60 0001 C CNN
1 3150 3550
0 -1 1 0
$EndComp
$Comp
L Device:Rotary_Encoder_Switch ENC1
U 1 1 5D88B3FF
P 5000 5500
F 0 "ENC1" H 5000 5867 50 0000 C CNN
F 1 "Rotary Encoder" H 5000 5776 50 0000 C CNN
F 2 "Rotary_Encoder:RotaryEncoder_Alps_EC11E-Switch_Vertical_H20mm_CircularMountingHoles" H 4850 5660 50 0001 C CNN
F 3 "~" H 5000 5760 50 0001 C CNN
1 5000 5500
1 0 0 -1
$EndComp
$Comp
L Connector_Generic:Conn_02x05_Odd_Even J1
U 1 1 5D88D2F1
P 5850 4400
F 0 "J1" H 5900 4817 50 0000 C CNN
F 1 "Connector 5x2" H 5900 4726 50 0000 C CNN
F 2 "Connector_PinSocket_2.54mm:PinSocket_2x05_P2.54mm_Vertical" H 5850 4400 50 0001 C CNN
F 3 "~" H 5850 4400 50 0001 C CNN
1 5850 4400
1 0 0 -1
$EndComp
$Comp
L Device:R R1
U 1 1 5D8937B1
P 3850 5400
F 0 "R1" V 4057 5400 50 0000 C CNN
F 1 "10K" V 3966 5400 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 3780 5400 50 0001 C CNN
F 3 "~" H 3850 5400 50 0001 C CNN
1 3850 5400
0 -1 -1 0
$EndComp
$Comp
L Device:Buzzer BZ1
U 1 1 5D893D6F
P 7400 4100
F 0 "BZ1" H 7600 4150 50 0000 L CNN
F 1 "Buzzer" H 7600 4050 50 0000 L CNN
F 2 "Buzzer_Beeper:Buzzer_12x9.5RM7.6" V 7375 4200 50 0001 C CNN
F 3 "~" V 7375 4200 50 0001 C CNN
1 7400 4100
1 0 0 -1
$EndComp
$Comp
L Switch:SW_DIP_x01 SW1
U 1 1 5D894E2A
P 3750 4500
F 0 "SW1" H 3750 4767 50 0000 C CNN
F 1 "Reset" H 3750 4676 50 0000 C CNN
F 2 "Button_Switch_THT:SW_PUSH_6mm_H7.3mm" H 3750 4500 50 0001 C CNN
F 3 "~" H 3750 4500 50 0001 C CNN
1 3750 4500
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR0101
U 1 1 5D89576B
P 3400 5400
F 0 "#PWR0101" H 3400 5250 50 0001 C CNN
F 1 "+5V" V 3415 5528 50 0000 L CNN
F 2 "" H 3400 5400 50 0001 C CNN
F 3 "" H 3400 5400 50 0001 C CNN
1 3400 5400
0 -1 -1 0
$EndComp
$Comp
L power:+5V #PWR0102
U 1 1 5D896CC4
P 5450 3800
F 0 "#PWR0102" H 5450 3650 50 0001 C CNN
F 1 "+5V" H 5465 3973 50 0000 C CNN
F 2 "" H 5450 3800 50 0001 C CNN
F 3 "" H 5450 3800 50 0001 C CNN
1 5450 3800
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR0103
U 1 1 5D89755D
P 3500 2100
F 0 "#PWR0103" H 3500 1950 50 0001 C CNN
F 1 "+5V" H 3515 2273 50 0000 C CNN
F 2 "" H 3500 2100 50 0001 C CNN
F 3 "" H 3500 2100 50 0001 C CNN
1 3500 2100
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0104
U 1 1 5D897F1D
P 3300 4750
F 0 "#PWR0104" H 3300 4500 50 0001 C CNN
F 1 "GND" H 3305 4577 50 0000 C CNN
F 2 "" H 3300 4750 50 0001 C CNN
F 3 "" H 3300 4750 50 0001 C CNN
1 3300 4750
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0105
U 1 1 5D898A40
P 3550 2500
F 0 "#PWR0105" H 3550 2250 50 0001 C CNN
F 1 "GND" H 3555 2327 50 0000 C CNN
F 2 "" H 3550 2500 50 0001 C CNN
F 3 "" H 3550 2500 50 0001 C CNN
1 3550 2500
0 -1 -1 0
$EndComp
$Comp
L power:GND #PWR0106
U 1 1 5D899BAF
P 5650 5700
F 0 "#PWR0106" H 5650 5450 50 0001 C CNN
F 1 "GND" H 5655 5527 50 0000 C CNN
F 2 "" H 5650 5700 50 0001 C CNN
F 3 "" H 5650 5700 50 0001 C CNN
1 5650 5700
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0107
U 1 1 5D89A417
P 7300 4900
F 0 "#PWR0107" H 7300 4650 50 0001 C CNN
F 1 "GND" H 7305 4727 50 0000 C CNN
F 2 "" H 7300 4900 50 0001 C CNN
F 3 "" H 7300 4900 50 0001 C CNN
1 7300 4900
1 0 0 -1
$EndComp
Wire Wire Line
5650 4200 5450 4200
Wire Wire Line
5450 4200 5450 3800
Wire Wire Line
3150 2300 3500 2300
Wire Wire Line
3500 2300 3500 2100
Wire Wire Line
3150 2500 3550 2500
Wire Wire Line
3450 4500 3300 4500
Wire Wire Line
3300 4500 3300 4750
Wire Wire Line
7300 4800 7300 4900
$Comp
L power:GND #PWR0108
U 1 1 5D89B98C
P 6250 3800
F 0 "#PWR0108" H 6250 3550 50 0001 C CNN
F 1 "GND" H 6255 3627 50 0000 C CNN
F 2 "" H 6250 3800 50 0001 C CNN
F 3 "" H 6250 3800 50 0001 C CNN
1 6250 3800
-1 0 0 1
$EndComp
Wire Wire Line
6150 4200 6250 4200
Wire Wire Line
4700 5500 4400 5500
Wire Wire Line
5300 5600 5650 5600
Wire Wire Line
5650 5600 5650 5700
$Comp
L Device:R R2
U 1 1 5D892B67
P 3850 5950
F 0 "R2" V 4057 5950 50 0000 C CNN
F 1 "10K" V 3966 5950 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 3780 5950 50 0001 C CNN
F 3 "~" H 3850 5950 50 0001 C CNN
1 3850 5950
0 -1 -1 0
$EndComp
Wire Wire Line
4000 5950 4300 5950
Wire Wire Line
4300 5600 4300 5950
$Comp
L power:GND #PWR0109
U 1 1 5D8A9A64
P 4400 5500
F 0 "#PWR0109" H 4400 5250 50 0001 C CNN
F 1 "GND" V 4405 5372 50 0000 R CNN
F 2 "" H 4400 5500 50 0001 C CNN
F 3 "" H 4400 5500 50 0001 C CNN
1 4400 5500
0 1 1 0
$EndComp
Wire Wire Line
3150 2700 4700 2700
Wire Wire Line
4500 2900 3150 2900
Wire Wire Line
3550 5400 3700 5400
Wire Wire Line
3550 5950 3700 5950
Wire Wire Line
4300 5600 4700 5600
Connection ~ 4300 5950
Wire Wire Line
6250 3800 6250 4200
Wire Wire Line
3400 5400 3550 5400
Connection ~ 3550 5400
Wire Wire Line
3550 5400 3550 5950
$Comp
L power:+5V #PWR?
U 1 1 5F377DF5
P 7300 3850
F 0 "#PWR?" H 7300 3700 50 0001 C CNN
F 1 "+5V" H 7315 4023 50 0000 C CNN
F 2 "" H 7300 3850 50 0001 C CNN
F 3 "" H 7300 3850 50 0001 C CNN
1 7300 3850
1 0 0 -1
$EndComp
Wire Wire Line
7300 3850 7300 4000
$Comp
L Device:R R3
U 1 1 5F3793FA
P 6750 4600
F 0 "R3" V 6750 4600 50 0000 C CNN
F 1 "1K" V 6650 4600 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 6680 4600 50 0001 C CNN
F 3 "~" H 6750 4600 50 0001 C CNN
1 6750 4600
0 -1 -1 0
$EndComp
$Comp
L Transistor_BJT:BC547 Q1
U 1 1 5F37DDBD
P 7200 4600
F 0 "Q1" H 7391 4646 50 0000 L CNN
F 1 "BC547" H 7391 4555 50 0000 L CNN
F 2 "Package_TO_SOT_THT:TO-92_Inline" H 7400 4525 50 0001 L CIN
F 3 "http://www.fairchildsemi.com/ds/BC/BC547.pdf" H 7200 4600 50 0001 L CNN
1 7200 4600
1 0 0 -1
$EndComp
Wire Wire Line
7300 4200 7300 4400
Wire Wire Line
6900 4600 7000 4600
Wire Wire Line
6150 4300 6250 4300
Wire Wire Line
6250 4300 6250 5400
Wire Wire Line
5300 5400 6250 5400
Wire Wire Line
4000 5400 4300 5400
Wire Wire Line
5650 4300 4500 4300
Wire Wire Line
4500 4300 4500 2900
Wire Wire Line
4700 4600 4700 2700
Wire Wire Line
4700 4600 5650 4600
Wire Wire Line
5650 4500 4050 4500
Wire Wire Line
6150 4400 6200 4400
Wire Wire Line
6200 4400 6200 5000
Wire Wire Line
6200 5000 4300 5000
Wire Wire Line
4300 5000 4300 5400
Connection ~ 4300 5400
Wire Wire Line
4300 5400 4700 5400
Wire Wire Line
6300 4500 6300 5950
Wire Wire Line
4300 5950 6300 5950
Wire Wire Line
6300 4500 6150 4500
Wire Wire Line
6150 4600 6600 4600
$EndSCHEMATC

View File

@@ -1,205 +1,202 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Connector_Generic_Conn_02x05_Odd_Even
#
DEF Connector_Generic_Conn_02x05_Odd_Even J 0 40 Y N 1 F N
F0 "J" 50 300 50 H V C CNN
F1 "Connector_Generic_Conn_02x05_Odd_Even" 50 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_2x??_*
$ENDFPLIST
DRAW
S -50 -195 0 -205 1 1 6 N
S -50 -95 0 -105 1 1 6 N
S -50 5 0 -5 1 1 6 N
S -50 105 0 95 1 1 6 N
S -50 205 0 195 1 1 6 N
S -50 250 150 -250 1 1 10 f
S 150 -195 100 -205 1 1 6 N
S 150 -95 100 -105 1 1 6 N
S 150 5 100 -5 1 1 6 N
S 150 105 100 95 1 1 6 N
S 150 205 100 195 1 1 6 N
X Pin_1 1 -200 200 150 R 50 50 1 1 P
X Pin_10 10 300 -200 150 L 50 50 1 1 P
X Pin_2 2 300 200 150 L 50 50 1 1 P
X Pin_3 3 -200 100 150 R 50 50 1 1 P
X Pin_4 4 300 100 150 L 50 50 1 1 P
X Pin_5 5 -200 0 150 R 50 50 1 1 P
X Pin_6 6 300 0 150 L 50 50 1 1 P
X Pin_7 7 -200 -100 150 R 50 50 1 1 P
X Pin_8 8 300 -100 150 L 50 50 1 1 P
X Pin_9 9 -200 -200 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Buzzer
#
DEF Device_Buzzer BZ 0 1 Y N 1 F N
F0 "BZ" 150 50 50 H V L CNN
F1 "Device_Buzzer" 150 -50 50 H V L CNN
F2 "" -25 100 50 V I C CNN
F3 "" -25 100 50 V I C CNN
$FPLIST
*Buzzer*
$ENDFPLIST
DRAW
A 0 0 125 -899 899 0 1 0 N 0 -125 0 125
P 2 0 1 0 -65 75 -45 75 N
P 2 0 1 0 -55 85 -55 65 N
P 2 0 1 0 0 125 0 -125 N
X - 1 -100 100 100 R 50 50 1 1 P
X + 2 -100 -100 100 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R
#
DEF Device_R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "Device_R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Rotary_Encoder_Switch
#
DEF Device_Rotary_Encoder_Switch SW 0 10 Y N 1 F N
F0 "SW" 0 260 50 H V C CNN
F1 "Device_Rotary_Encoder_Switch" 0 -260 50 H V C CNN
F2 "" -150 160 50 H I C CNN
F3 "" 0 260 50 H I C CNN
$FPLIST
RotaryEncoder*Switch*
$ENDFPLIST
DRAW
A -15 -2 108 -899 899 0 1 10 N -15 -110 -15 105
C -150 0 10 0 1 0 F
C -15 0 75 0 1 10 N
C 170 -40 5 0 1 10 N
C 170 40 5 0 1 10 N
S -200 200 200 -200 0 1 10 f
P 2 0 1 10 -25 -70 -25 70 N
P 2 0 1 10 -15 -70 -15 70 N
P 2 0 1 10 -5 70 -5 -70 N
P 2 0 1 10 150 0 135 0 N
P 2 0 1 10 150 40 150 -40 N
P 3 0 1 0 -200 -100 -150 -100 -150 -80 N
P 3 0 1 0 -200 100 -150 100 -150 80 N
P 3 0 1 10 10 -120 -20 -110 5 -95 N
P 3 0 1 10 10 115 -20 105 5 90 N
P 3 0 1 10 200 -100 170 -100 170 -40 N
P 3 0 1 10 200 100 170 100 170 40 N
P 4 0 1 0 -200 0 -150 0 -150 -40 -130 -80 N
P 4 0 1 0 -170 0 -150 0 -150 40 -130 80 N
X A A -300 100 100 R 50 50 1 1 P
X B B -300 -100 100 R 50 50 1 1 P
X C C -300 0 100 R 50 50 1 1 P
X S1 S1 300 100 100 L 50 50 1 1 P
X S2 S2 300 -100 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# LED_WS2812B
#
DEF LED_WS2812B D 0 10 Y Y 1 F N
F0 "D" 200 225 50 H V R BNN
F1 "LED_WS2812B" 50 -225 50 H V L TNN
F2 "LED_SMD:LED_WS2812B_PLCC4_5.0x5.0mm_P3.2mm" 50 -300 50 H I L TNN
F3 "" 100 -375 50 H I L TNN
$FPLIST
LED*WS2812*PLCC*5.0x5.0mm*P3.2mm*
$ENDFPLIST
DRAW
T 0 90 -165 30 0 0 0 RGB Normal 0 C C
S 200 200 -200 -200 0 1 10 f
P 2 0 1 0 50 -140 70 -140 N
P 2 0 1 0 50 -100 70 -100 N
P 2 0 1 0 185 -140 105 -140 N
P 3 0 1 0 90 -100 50 -140 50 -120 N
P 3 0 1 0 90 -60 50 -100 50 -80 N
P 3 0 1 0 145 -40 145 -140 145 -160 N
P 4 0 1 0 185 -60 105 -60 145 -140 185 -60 N
X VDD 1 0 300 100 D 50 50 1 1 W
X DOUT 2 300 0 100 L 50 50 1 1 O
X VSS 3 0 -300 100 U 50 50 1 1 W
X DIN 4 -300 0 100 R 50 50 1 1 I
ENDDRAW
ENDDEF
#
# SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32
#
DEF SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32 U 0 40 Y Y 1 F N
F0 "U" -600 600 60 H V R TNN
F1 "SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32" -1350 600 60 H V L TNN
F2 "" 0 0 60 H I C CNN
F3 "" 0 0 60 H I C CNN
DRAW
S -1400 650 -450 100 0 1 0 N
X VCC 1 -1250 0 100 U 50 50 1 1 I
X VSS 2 -1050 0 100 U 50 50 1 1 O
X SCL 3 -850 0 100 U 50 50 1 1 I
X SDA 4 -650 0 100 U 50 50 1 1 I
ENDDRAW
ENDDEF
#
# Switch_SW_DIP_x01
#
DEF Switch_SW_DIP_x01 SW 0 0 Y N 1 F N
F0 "SW" 0 150 50 H V C CNN
F1 "Switch_SW_DIP_x01" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
SW?DIP?x1*
$ENDFPLIST
DRAW
C -80 0 20 0 0 0 N
C 80 0 20 0 0 0 N
S -150 100 150 -100 0 1 10 f
P 2 0 0 0 -60 5 93 46 N
X ~ 1 -300 0 200 R 50 50 1 1 P
X ~ 2 300 0 200 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# power_+5V
#
DEF power_+5V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_+5V" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +5V 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_GND
#
DEF power_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "power_GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
#End Library
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Connector_Generic_Conn_02x05_Odd_Even
#
DEF Connector_Generic_Conn_02x05_Odd_Even J 0 40 Y N 1 F N
F0 "J" 50 300 50 H V C CNN
F1 "Connector_Generic_Conn_02x05_Odd_Even" 50 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_2x??_*
$ENDFPLIST
DRAW
S -50 -195 0 -205 1 1 6 N
S -50 -95 0 -105 1 1 6 N
S -50 5 0 -5 1 1 6 N
S -50 105 0 95 1 1 6 N
S -50 205 0 195 1 1 6 N
S -50 250 150 -250 1 1 10 f
S 150 -195 100 -205 1 1 6 N
S 150 -95 100 -105 1 1 6 N
S 150 5 100 -5 1 1 6 N
S 150 105 100 95 1 1 6 N
S 150 205 100 195 1 1 6 N
X Pin_1 1 -200 200 150 R 50 50 1 1 P
X Pin_10 10 300 -200 150 L 50 50 1 1 P
X Pin_2 2 300 200 150 L 50 50 1 1 P
X Pin_3 3 -200 100 150 R 50 50 1 1 P
X Pin_4 4 300 100 150 L 50 50 1 1 P
X Pin_5 5 -200 0 150 R 50 50 1 1 P
X Pin_6 6 300 0 150 L 50 50 1 1 P
X Pin_7 7 -200 -100 150 R 50 50 1 1 P
X Pin_8 8 300 -100 150 L 50 50 1 1 P
X Pin_9 9 -200 -200 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Buzzer
#
DEF Device_Buzzer BZ 0 1 Y N 1 F N
F0 "BZ" 150 50 50 H V L CNN
F1 "Device_Buzzer" 150 -50 50 H V L CNN
F2 "" -25 100 50 V I C CNN
F3 "" -25 100 50 V I C CNN
$FPLIST
*Buzzer*
$ENDFPLIST
DRAW
A 0 0 125 -899 899 0 1 0 N 0 -125 0 125
P 2 0 1 0 -65 75 -45 75 N
P 2 0 1 0 -55 85 -55 65 N
P 2 0 1 0 0 125 0 -125 N
X - 1 -100 100 100 R 50 50 1 1 P
X + 2 -100 -100 100 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R
#
DEF Device_R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "Device_R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Rotary_Encoder_Switch
#
DEF Device_Rotary_Encoder_Switch SW 0 10 Y N 1 F N
F0 "SW" 0 260 50 H V C CNN
F1 "Device_Rotary_Encoder_Switch" 0 -260 50 H V C CNN
F2 "" -150 160 50 H I C CNN
F3 "" 0 260 50 H I C CNN
$FPLIST
RotaryEncoder*Switch*
$ENDFPLIST
DRAW
A -15 -2 108 -899 899 0 1 10 N -15 -110 -15 105
C -150 0 10 0 1 0 F
C -15 0 75 0 1 10 N
C 170 -40 5 0 1 10 N
C 170 40 5 0 1 10 N
S -200 200 200 -200 0 1 10 f
P 2 0 1 10 -25 -70 -25 70 N
P 2 0 1 10 -15 -70 -15 70 N
P 2 0 1 10 -5 70 -5 -70 N
P 2 0 1 10 150 0 135 0 N
P 2 0 1 10 150 40 150 -40 N
P 3 0 1 0 -200 -100 -150 -100 -150 -80 N
P 3 0 1 0 -200 100 -150 100 -150 80 N
P 3 0 1 10 10 -120 -20 -110 5 -95 N
P 3 0 1 10 10 115 -20 105 5 90 N
P 3 0 1 10 200 -100 170 -100 170 -40 N
P 3 0 1 10 200 100 170 100 170 40 N
P 4 0 1 0 -200 0 -150 0 -150 -40 -130 -80 N
P 4 0 1 0 -170 0 -150 0 -150 40 -130 80 N
X A A -300 100 100 R 50 50 1 1 P
X B B -300 -100 100 R 50 50 1 1 P
X C C -300 0 100 R 50 50 1 1 P
X S1 S1 300 100 100 L 50 50 1 1 P
X S2 S2 300 -100 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32
#
DEF SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32 U 0 40 Y Y 1 F N
F0 "U" -600 600 60 H V R TNN
F1 "SKR-mini-LCD-board-rescue_SSD1306-SSD1306_OLED-0.91-128x32" -1350 600 60 H V L TNN
F2 "" 0 0 60 H I C CNN
F3 "" 0 0 60 H I C CNN
DRAW
S -1400 650 -450 100 0 1 0 N
X VCC 1 -1250 0 100 U 50 50 1 1 I
X VSS 2 -1050 0 100 U 50 50 1 1 O
X SCL 3 -850 0 100 U 50 50 1 1 I
X SDA 4 -650 0 100 U 50 50 1 1 I
ENDDRAW
ENDDEF
#
# Switch_SW_DIP_x01
#
DEF Switch_SW_DIP_x01 SW 0 0 Y N 1 F N
F0 "SW" 0 150 50 H V C CNN
F1 "Switch_SW_DIP_x01" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
SW?DIP?x1*
$ENDFPLIST
DRAW
C -80 0 20 0 0 0 N
C 80 0 20 0 0 0 N
S -150 100 150 -100 0 1 10 f
P 2 0 0 0 -60 5 93 46 N
X ~ 1 -300 0 200 R 50 50 1 1 P
X ~ 2 300 0 200 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Transistor_BJT_BC547
#
DEF Transistor_BJT_BC547 Q 0 0 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "Transistor_BJT_BC547" 200 0 50 H V L CNN
F2 "Package_TO_SOT_THT:TO-92_Inline" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
ALIAS BC546 BC548 BC549 BC550 BC337 BC338
$FPLIST
TO?92*
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 0 0 25 0 N
P 2 0 1 0 25 25 100 100 N
P 3 0 1 0 25 -25 100 -100 100 -100 N
P 3 0 1 20 25 75 25 -75 25 -75 N
P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F
X C 1 100 200 100 D 50 50 1 1 P
X B 2 -200 0 200 R 50 50 1 1 I
X E 3 100 -200 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# power_+5V
#
DEF power_+5V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_+5V" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +5V 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_GND
#
DEF power_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "power_GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
#End Library

View File

@@ -1,43 +1,43 @@
update=14.12.2019 09:44:36
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]
[schematic_editor]
version=1
PageLayoutDescrFile=
PlotDirectoryName=D:/Data/PlatformIO/SMuFF/Schematics/SKR mini LCD board/
SubpartIdSeparator=0
SubpartFirstId=65
NetFmtName=
SpiceAjustPassiveValues=0
LabSize=50
ERC_TestSimilarLabels=1
update=15.08.2020 07:08:57
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]
[schematic_editor]
version=1
PageLayoutDescrFile=
PlotDirectoryName=D:/Data/PlatformIO/SMuFF/Schematics/SKR mini LCD board/
SubpartIdSeparator=0
SubpartFirstId=65
NetFmtName=
SpiceAjustPassiveValues=0
LabSize=50
ERC_TestSimilarLabels=1

View File

@@ -1,333 +1,334 @@
EESchema Schematic File Version 4
LIBS:SKR mini LCD board-cache
EELAYER 29 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title "SKR Mini V1.1 LCD board"
Date "2019-09-23"
Rev "1"
Comp "Technik Gegg"
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L SKR-mini-LCD-board-rescue:SSD1306-SSD1306_OLED-0.91-128x32 U1
U 1 1 5D888A8E
P 3150 3550
F 0 "U1" V 1563 3867 60 0000 C CNN
F 1 "SSD1306 0.96\" OLED" V 1669 3867 60 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical" H 3150 3550 60 0001 C CNN
F 3 "" H 3150 3550 60 0001 C CNN
1 3150 3550
0 -1 1 0
$EndComp
$Comp
L Device:Rotary_Encoder_Switch ENC1
U 1 1 5D88B3FF
P 5000 5500
F 0 "ENC1" H 5000 5867 50 0000 C CNN
F 1 "Rotary Encoder" H 5000 5776 50 0000 C CNN
F 2 "Rotary_Encoder:RotaryEncoder_Alps_EC11E-Switch_Vertical_H20mm_CircularMountingHoles" H 4850 5660 50 0001 C CNN
F 3 "~" H 5000 5760 50 0001 C CNN
1 5000 5500
1 0 0 -1
$EndComp
$Comp
L Connector_Generic:Conn_02x05_Odd_Even J1
U 1 1 5D88D2F1
P 5850 4400
F 0 "J1" H 5900 4817 50 0000 C CNN
F 1 "Connector 5x2" H 5900 4726 50 0000 C CNN
F 2 "Connector_PinSocket_2.54mm:PinSocket_2x05_P2.54mm_Vertical" H 5850 4400 50 0001 C CNN
F 3 "~" H 5850 4400 50 0001 C CNN
1 5850 4400
1 0 0 -1
$EndComp
$Comp
L Device:R R1
U 1 1 5D8937B1
P 3850 5400
F 0 "R1" V 4057 5400 50 0000 C CNN
F 1 "10K" V 3966 5400 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 3780 5400 50 0001 C CNN
F 3 "~" H 3850 5400 50 0001 C CNN
1 3850 5400
0 -1 -1 0
$EndComp
$Comp
L Device:Buzzer BZ1
U 1 1 5D893D6F
P 6300 4950
F 0 "BZ1" H 6200 4750 50 0000 L CNN
F 1 "Buzzer" H 6200 4650 50 0000 L CNN
F 2 "Buzzer_Beeper:Buzzer_12x9.5RM7.6" V 6275 5050 50 0001 C CNN
F 3 "~" V 6275 5050 50 0001 C CNN
1 6300 4950
1 0 0 -1
$EndComp
$Comp
L Switch:SW_DIP_x01 SW1
U 1 1 5D894E2A
P 5050 1600
F 0 "SW1" H 5050 1867 50 0000 C CNN
F 1 "Reset" H 5050 1776 50 0000 C CNN
F 2 "Button_Switch_THT:SW_PUSH_6mm_H7.3mm" H 5050 1600 50 0001 C CNN
F 3 "~" H 5050 1600 50 0001 C CNN
1 5050 1600
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR0101
U 1 1 5D89576B
P 3400 5400
F 0 "#PWR0101" H 3400 5250 50 0001 C CNN
F 1 "+5V" V 3415 5528 50 0000 L CNN
F 2 "" H 3400 5400 50 0001 C CNN
F 3 "" H 3400 5400 50 0001 C CNN
1 3400 5400
0 -1 -1 0
$EndComp
$Comp
L power:+5V #PWR0102
U 1 1 5D896CC4
P 5450 3800
F 0 "#PWR0102" H 5450 3650 50 0001 C CNN
F 1 "+5V" H 5465 3973 50 0000 C CNN
F 2 "" H 5450 3800 50 0001 C CNN
F 3 "" H 5450 3800 50 0001 C CNN
1 5450 3800
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR0103
U 1 1 5D89755D
P 3500 2100
F 0 "#PWR0103" H 3500 1950 50 0001 C CNN
F 1 "+5V" H 3515 2273 50 0000 C CNN
F 2 "" H 3500 2100 50 0001 C CNN
F 3 "" H 3500 2100 50 0001 C CNN
1 3500 2100
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0104
U 1 1 5D897F1D
P 4600 1850
F 0 "#PWR0104" H 4600 1600 50 0001 C CNN
F 1 "GND" H 4605 1677 50 0000 C CNN
F 2 "" H 4600 1850 50 0001 C CNN
F 3 "" H 4600 1850 50 0001 C CNN
1 4600 1850
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0105
U 1 1 5D898A40
P 3550 2500
F 0 "#PWR0105" H 3550 2250 50 0001 C CNN
F 1 "GND" H 3555 2327 50 0000 C CNN
F 2 "" H 3550 2500 50 0001 C CNN
F 3 "" H 3550 2500 50 0001 C CNN
1 3550 2500
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0106
U 1 1 5D899BAF
P 5650 5700
F 0 "#PWR0106" H 5650 5450 50 0001 C CNN
F 1 "GND" H 5655 5527 50 0000 C CNN
F 2 "" H 5650 5700 50 0001 C CNN
F 3 "" H 5650 5700 50 0001 C CNN
1 5650 5700
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0107
U 1 1 5D89A417
P 5950 5150
F 0 "#PWR0107" H 5950 4900 50 0001 C CNN
F 1 "GND" H 5955 4977 50 0000 C CNN
F 2 "" H 5950 5150 50 0001 C CNN
F 3 "" H 5950 5150 50 0001 C CNN
1 5950 5150
1 0 0 -1
$EndComp
Wire Wire Line
5650 4200 5450 4200
Wire Wire Line
5450 4200 5450 3800
Wire Wire Line
3150 2300 3500 2300
Wire Wire Line
3500 2300 3500 2100
Wire Wire Line
3150 2500 3550 2500
Wire Wire Line
4750 1600 4600 1600
Wire Wire Line
4600 1600 4600 1850
Wire Wire Line
6200 5050 5950 5050
Wire Wire Line
5950 5050 5950 5150
$Comp
L power:GND #PWR0108
U 1 1 5D89B98C
P 6250 3800
F 0 "#PWR0108" H 6250 3550 50 0001 C CNN
F 1 "GND" H 6255 3627 50 0000 C CNN
F 2 "" H 6250 3800 50 0001 C CNN
F 3 "" H 6250 3800 50 0001 C CNN
1 6250 3800
-1 0 0 1
$EndComp
Wire Wire Line
6150 4200 6250 4200
Wire Wire Line
4700 5500 4400 5500
Wire Wire Line
4700 5400 4300 5400
Wire Wire Line
5300 5600 5650 5600
Wire Wire Line
5650 5600 5650 5700
Wire Wire Line
5650 4600 5600 4600
Wire Wire Line
5600 4600 5600 5400
Wire Wire Line
5600 5400 5300 5400
Wire Wire Line
5650 4300 4300 4300
Wire Wire Line
4300 4300 4300 5400
Connection ~ 4300 5400
Wire Wire Line
4300 5400 4000 5400
Wire Wire Line
6150 4300 6500 4300
Wire Wire Line
5650 4400 4500 4400
Wire Wire Line
6400 4500 6150 4500
$Comp
L Device:R R2
U 1 1 5D892B67
P 3850 5950
F 0 "R2" V 4057 5950 50 0000 C CNN
F 1 "10K" V 3966 5950 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 3780 5950 50 0001 C CNN
F 3 "~" H 3850 5950 50 0001 C CNN
1 3850 5950
0 -1 -1 0
$EndComp
Wire Wire Line
6500 4300 6500 5950
Wire Wire Line
4000 5950 4300 5950
Wire Wire Line
4300 5600 4300 5950
Wire Wire Line
6150 4850 6200 4850
Wire Wire Line
6150 4600 6150 4850
$Comp
L power:GND #PWR0109
U 1 1 5D8A9A64
P 4400 5500
F 0 "#PWR0109" H 4400 5250 50 0001 C CNN
F 1 "GND" V 4405 5372 50 0000 R CNN
F 2 "" H 4400 5500 50 0001 C CNN
F 3 "" H 4400 5500 50 0001 C CNN
1 4400 5500
0 1 1 0
$EndComp
$Comp
L Connector_Generic:Conn_02x05_Odd_Even #EXT2
U 1 1 5D8AB540
P 6250 1700
F 0 "#EXT2" H 6300 2117 50 0000 C CNN
F 1 "Connector on Controller" H 6300 2026 50 0000 C CNN
F 2 "" H 6250 1700 50 0001 C CNN
F 3 "~" H 6250 1700 50 0001 C CNN
1 6250 1700
1 0 0 -1
$EndComp
Wire Wire Line
5350 1600 6050 1600
Text Notes 5250 2200 0 50 ~ 0
Optional\n
Wire Notes Line width 20
6950 2350 6950 1000
Wire Notes Line width 20
6950 1000 4450 1000
Wire Notes Line width 20
4450 1000 4450 2350
Wire Notes Line width 20
6950 2350 4450 2350
Wire Wire Line
6400 2700 6400 4500
Wire Wire Line
3150 2700 6400 2700
Wire Wire Line
4500 4400 4500 2900
Wire Wire Line
4500 2900 3150 2900
Wire Wire Line
3550 5400 3700 5400
Wire Wire Line
3550 5950 3700 5950
Wire Wire Line
4300 5600 4700 5600
Connection ~ 4300 5950
Wire Wire Line
4300 5950 6500 5950
Wire Wire Line
6250 3800 6250 4200
$Comp
L LED:WS2812B D1
U 1 1 5D8C3DC4
P 3550 4500
F 0 "D1" H 3206 4454 50 0000 R CNN
F 1 "WS2812B" H 3206 4545 50 0000 R CNN
F 2 "LED_SMD:LED_WS2812B_PLCC4_5.0x5.0mm_P3.2mm" H 3600 4200 50 0001 L TNN
F 3 "https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf" H 3650 4125 50 0001 L TNN
1 3550 4500
-1 0 0 1
$EndComp
Wire Wire Line
3850 4500 5650 4500
$Comp
L power:GND #PWR0110
U 1 1 5D8C682F
P 3550 4200
F 0 "#PWR0110" H 3550 3950 50 0001 C CNN
F 1 "GND" H 3555 4027 50 0000 C CNN
F 2 "" H 3550 4200 50 0001 C CNN
F 3 "" H 3550 4200 50 0001 C CNN
1 3550 4200
-1 0 0 1
$EndComp
Wire Wire Line
3400 5400 3550 5400
Connection ~ 3550 5400
Wire Wire Line
3550 4800 3550 5400
Wire Wire Line
3550 5400 3550 5950
Wire Notes Line width 12
2950 3850 4250 3850
Wire Notes Line width 12
4250 3850 4250 5000
Wire Notes Line width 12
4250 5000 2950 5000
Wire Notes Line width 12
2950 5000 2950 3850
Text Notes 3050 4950 0 50 ~ 0
Optional
$EndSCHEMATC
EESchema Schematic File Version 4
LIBS:SKR mini LCD board-cache
EELAYER 29 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title "SKR Mini V1.1 LCD board"
Date "2020-08-15"
Rev "2"
Comp "Technik Gegg"
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L SKR-mini-LCD-board-rescue:SSD1306-SSD1306_OLED-0.91-128x32 U1
U 1 1 5D888A8E
P 3150 3550
F 0 "U1" V 1563 3867 60 0000 C CNN
F 1 "SSD1306 0.96\" OLED" V 1669 3867 60 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical" H 3150 3550 60 0001 C CNN
F 3 "" H 3150 3550 60 0001 C CNN
1 3150 3550
0 -1 1 0
$EndComp
$Comp
L Device:Rotary_Encoder_Switch ENC1
U 1 1 5D88B3FF
P 5000 5500
F 0 "ENC1" H 5000 5867 50 0000 C CNN
F 1 "Rotary Encoder" H 5000 5776 50 0000 C CNN
F 2 "Rotary_Encoder:RotaryEncoder_Alps_EC11E-Switch_Vertical_H20mm_CircularMountingHoles" H 4850 5660 50 0001 C CNN
F 3 "~" H 5000 5760 50 0001 C CNN
1 5000 5500
1 0 0 -1
$EndComp
$Comp
L Connector_Generic:Conn_02x05_Odd_Even J1
U 1 1 5D88D2F1
P 5850 4400
F 0 "J1" H 5900 4817 50 0000 C CNN
F 1 "Connector 5x2" H 5900 4726 50 0000 C CNN
F 2 "Connector_PinSocket_2.54mm:PinSocket_2x05_P2.54mm_Vertical" H 5850 4400 50 0001 C CNN
F 3 "~" H 5850 4400 50 0001 C CNN
1 5850 4400
1 0 0 -1
$EndComp
$Comp
L Device:R R1
U 1 1 5D8937B1
P 3850 5400
F 0 "R1" V 4057 5400 50 0000 C CNN
F 1 "10K" V 3966 5400 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 3780 5400 50 0001 C CNN
F 3 "~" H 3850 5400 50 0001 C CNN
1 3850 5400
0 -1 -1 0
$EndComp
$Comp
L Device:Buzzer BZ1
U 1 1 5D893D6F
P 7200 4550
F 0 "BZ1" H 7400 4600 50 0000 L CNN
F 1 "Buzzer" H 7400 4500 50 0000 L CNN
F 2 "Buzzer_Beeper:Buzzer_12x9.5RM7.6" V 7175 4650 50 0001 C CNN
F 3 "~" V 7175 4650 50 0001 C CNN
1 7200 4550
1 0 0 -1
$EndComp
$Comp
L Switch:SW_DIP_x01 SW1
U 1 1 5D894E2A
P 5050 1600
F 0 "SW1" H 5050 1867 50 0000 C CNN
F 1 "Reset" H 5050 1776 50 0000 C CNN
F 2 "Button_Switch_THT:SW_PUSH_6mm_H7.3mm" H 5050 1600 50 0001 C CNN
F 3 "~" H 5050 1600 50 0001 C CNN
1 5050 1600
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR0101
U 1 1 5D89576B
P 3400 5400
F 0 "#PWR0101" H 3400 5250 50 0001 C CNN
F 1 "+5V" V 3415 5528 50 0000 L CNN
F 2 "" H 3400 5400 50 0001 C CNN
F 3 "" H 3400 5400 50 0001 C CNN
1 3400 5400
0 -1 -1 0
$EndComp
$Comp
L power:+5V #PWR0102
U 1 1 5D896CC4
P 5450 3800
F 0 "#PWR0102" H 5450 3650 50 0001 C CNN
F 1 "+5V" H 5465 3973 50 0000 C CNN
F 2 "" H 5450 3800 50 0001 C CNN
F 3 "" H 5450 3800 50 0001 C CNN
1 5450 3800
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR0103
U 1 1 5D89755D
P 3500 2100
F 0 "#PWR0103" H 3500 1950 50 0001 C CNN
F 1 "+5V" H 3515 2273 50 0000 C CNN
F 2 "" H 3500 2100 50 0001 C CNN
F 3 "" H 3500 2100 50 0001 C CNN
1 3500 2100
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0104
U 1 1 5D897F1D
P 4600 1850
F 0 "#PWR0104" H 4600 1600 50 0001 C CNN
F 1 "GND" H 4605 1677 50 0000 C CNN
F 2 "" H 4600 1850 50 0001 C CNN
F 3 "" H 4600 1850 50 0001 C CNN
1 4600 1850
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0105
U 1 1 5D898A40
P 3550 2500
F 0 "#PWR0105" H 3550 2250 50 0001 C CNN
F 1 "GND" H 3555 2327 50 0000 C CNN
F 2 "" H 3550 2500 50 0001 C CNN
F 3 "" H 3550 2500 50 0001 C CNN
1 3550 2500
0 -1 -1 0
$EndComp
$Comp
L power:GND #PWR0106
U 1 1 5D899BAF
P 5650 5700
F 0 "#PWR0106" H 5650 5450 50 0001 C CNN
F 1 "GND" H 5655 5527 50 0000 C CNN
F 2 "" H 5650 5700 50 0001 C CNN
F 3 "" H 5650 5700 50 0001 C CNN
1 5650 5700
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR0107
U 1 1 5D89A417
P 7100 5350
F 0 "#PWR0107" H 7100 5100 50 0001 C CNN
F 1 "GND" H 7105 5177 50 0000 C CNN
F 2 "" H 7100 5350 50 0001 C CNN
F 3 "" H 7100 5350 50 0001 C CNN
1 7100 5350
1 0 0 -1
$EndComp
Wire Wire Line
5650 4200 5450 4200
Wire Wire Line
5450 4200 5450 3800
Wire Wire Line
3150 2300 3500 2300
Wire Wire Line
3500 2300 3500 2100
Wire Wire Line
3150 2500 3550 2500
Wire Wire Line
4750 1600 4600 1600
Wire Wire Line
4600 1600 4600 1850
Wire Wire Line
7100 5250 7100 5350
$Comp
L power:GND #PWR0108
U 1 1 5D89B98C
P 6250 3800
F 0 "#PWR0108" H 6250 3550 50 0001 C CNN
F 1 "GND" H 6255 3627 50 0000 C CNN
F 2 "" H 6250 3800 50 0001 C CNN
F 3 "" H 6250 3800 50 0001 C CNN
1 6250 3800
-1 0 0 1
$EndComp
Wire Wire Line
6150 4200 6250 4200
Wire Wire Line
4700 5500 4400 5500
Wire Wire Line
4700 5400 4300 5400
Wire Wire Line
5300 5600 5650 5600
Wire Wire Line
5650 5600 5650 5700
Wire Wire Line
5650 4600 5600 4600
Wire Wire Line
5600 4600 5600 5400
Wire Wire Line
5600 5400 5300 5400
Wire Wire Line
5650 4300 4300 4300
Wire Wire Line
4300 4300 4300 5400
Connection ~ 4300 5400
Wire Wire Line
4300 5400 4000 5400
Wire Wire Line
5650 4400 4500 4400
Wire Wire Line
6400 4500 6150 4500
$Comp
L Device:R R2
U 1 1 5D892B67
P 3850 5950
F 0 "R2" V 4057 5950 50 0000 C CNN
F 1 "10K" V 3966 5950 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 3780 5950 50 0001 C CNN
F 3 "~" H 3850 5950 50 0001 C CNN
1 3850 5950
0 -1 -1 0
$EndComp
Wire Wire Line
4000 5950 4300 5950
Wire Wire Line
4300 5600 4300 5950
$Comp
L power:GND #PWR0109
U 1 1 5D8A9A64
P 4400 5500
F 0 "#PWR0109" H 4400 5250 50 0001 C CNN
F 1 "GND" V 4405 5372 50 0000 R CNN
F 2 "" H 4400 5500 50 0001 C CNN
F 3 "" H 4400 5500 50 0001 C CNN
1 4400 5500
0 1 1 0
$EndComp
$Comp
L Connector_Generic:Conn_02x05_Odd_Even #EXT2
U 1 1 5D8AB540
P 6250 1700
F 0 "#EXT2" H 6300 2117 50 0000 C CNN
F 1 "Connector on Controller" H 6300 2026 50 0000 C CNN
F 2 "" H 6250 1700 50 0001 C CNN
F 3 "~" H 6250 1700 50 0001 C CNN
1 6250 1700
1 0 0 -1
$EndComp
Wire Wire Line
5350 1600 6050 1600
Text Notes 5250 2200 0 50 ~ 0
Optional\n
Wire Notes Line width 20
6950 2350 6950 1000
Wire Notes Line width 20
6950 1000 4450 1000
Wire Notes Line width 20
4450 1000 4450 2350
Wire Notes Line width 20
6950 2350 4450 2350
Wire Wire Line
6400 2700 6400 4500
Wire Wire Line
3150 2700 6400 2700
Wire Wire Line
4500 4400 4500 2900
Wire Wire Line
4500 2900 3150 2900
Wire Wire Line
3550 5400 3700 5400
Wire Wire Line
3550 5950 3700 5950
Wire Wire Line
4300 5600 4700 5600
Connection ~ 4300 5950
Wire Wire Line
4300 5950 6250 5950
Wire Wire Line
6250 3800 6250 4200
Wire Wire Line
3400 5400 3550 5400
Connection ~ 3550 5400
Wire Wire Line
3550 5400 3550 5950
$Comp
L power:+5V #PWR?
U 1 1 5F377DF5
P 7100 4300
F 0 "#PWR?" H 7100 4150 50 0001 C CNN
F 1 "+5V" H 7115 4473 50 0000 C CNN
F 2 "" H 7100 4300 50 0001 C CNN
F 3 "" H 7100 4300 50 0001 C CNN
1 7100 4300
1 0 0 -1
$EndComp
Wire Wire Line
7100 4300 7100 4450
$Comp
L Device:R R3
U 1 1 5F3793FA
P 6550 5050
F 0 "R3" V 6550 5050 50 0000 C CNN
F 1 "1K" V 6450 5050 50 0000 C CNN
F 2 "Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 6480 5050 50 0001 C CNN
F 3 "~" H 6550 5050 50 0001 C CNN
1 6550 5050
0 -1 -1 0
$EndComp
$Comp
L Transistor_BJT:BC547 Q1
U 1 1 5F37DDBD
P 7000 5050
F 0 "Q1" H 7191 5096 50 0000 L CNN
F 1 "BC547" H 7191 5005 50 0000 L CNN
F 2 "Package_TO_SOT_THT:TO-92_Inline" H 7200 4975 50 0001 L CIN
F 3 "http://www.fairchildsemi.com/ds/BC/BC547.pdf" H 7000 5050 50 0001 L CNN
1 7000 5050
1 0 0 -1
$EndComp
Wire Wire Line
7100 4650 7100 4850
Wire Wire Line
6700 5050 6800 5050
Wire Wire Line
6150 4300 6250 4300
Wire Wire Line
6250 4300 6250 5950
Wire Wire Line
6150 4600 6400 4600
Wire Wire Line
6400 4600 6400 5050
$EndSCHEMATC

3
docs/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Folder for documentation
tbd.

View File

@@ -68,6 +68,7 @@ private:
volatile uint16_t acceleration = 0;
bool accelerationEnabled;
uint8_t steps = 0;
bool enableSound;
#ifndef WITHOUT_BUTTON
volatile Button button;
@@ -107,6 +108,16 @@ public:
#endif
public:
void setEnableSound(const bool &d)
{
enableSound = d;
}
const bool getEnableSound()
{
return enableSound;
}
void setAccelerationEnabled(const bool &a)
{
accelerationEnabled = a;

View File

@@ -21,12 +21,13 @@
#ifndef _SMUFF_CONFIG_H
#define _SMUFF_CONFIG_H
#define VERSION_STRING "V2.09"
#define VERSION_STRING "V2.10"
#define PMMU_VERSION 106 // Version number for Prusa MMU2 Emulation mode
#define PMMU_BUILD 372 // Build number for Prusa MMU2 Emulation mode
#define VERSION_DATE "2020-07-06"
#define VERSION_DATE "2020-08-24"
#define CONFIG_FILE "SMUFF.CFG"
#define DATASTORE_FILE "EEPROM.DAT"
#define TUNE_FILE "TUNE.DAT"
#if defined(__STM32F1__)
#define MAX_JSON 2048 // 2K of temporary buffer for the JSON data
#elif defined(__ESP32__)
@@ -51,6 +52,10 @@
#define MAX_CONTRAST 250
#define I2C_SLAVE_ADDRESS 0x88
#define I2C_DISPLAY_ADDRESS 0x3c
#define SERVO_WIPER 0
#define SERVO_LID 1
#include "Pins.h" // path is defined in build environment of platformio.ini (-I)
@@ -69,12 +74,21 @@
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#endif
#define LED_BLACK_COLOR 0
#define LED_RED_COLOR 1
#define LED_GREEN_COLOR 2
#define LED_BLUE_COLOR 3
#define LED_CYAN_COLOR 4
#define LED_MAGENTA_COLOR 5
#define LED_YELLOW_COLOR 6
#define LED_WHITE_COLOR 7
#define BASE_FONT u8g2_font_6x12_t_symbols
#define BASE_FONT_BIG u8g2_font_7x14B_tf
#define SMALL_FONT u8g2_font_6x10_mr
#define STATUS_FONT u8g2_font_7x14_tf
#define LOGO_FONT u8g2_font_helvR08_tf
#define ICONIC_FONT u8g2_font_open_iconic_check_2x_t
#define BASE_FONT u8g2_font_6x12_t_symbols
#define BASE_FONT_BIG u8g2_font_7x14B_tf
#define SMALL_FONT u8g2_font_6x10_mr
#define STATUS_FONT u8g2_font_7x14_tf
#define LOGO_FONT u8g2_font_helvR08_tf
#define ICONIC_FONT u8g2_font_open_iconic_check_2x_t
#define SYMBOL_FONT u8g2_font_unifont_t_symbols
#endif

View File

@@ -23,41 +23,76 @@
#ifndef _DUETLASER_H
#define _DUETLASER_H 1
#define STATE_INIT 0x8000
#define STATE_IDLE 0x8001
#define STATE_WAIT_START 0x8002
#define STATE_GOT_START 0x8003
#define STATE_READING_DATA 0x8004
#define STATE_GOT_ALL_BITS 0x8005
#define STATE_PARITY_ERROR 0x8006
#define STATE_PARITY_OK 0x8007
#define STATE_GOT_POSITION 0x8008
#define STATE_GOT_ERROR_MSG 0x8009
#define STATE_GOT_QUALITY_V1 0x800A
#define STATE_GOT_QUALITY_V2 0x800B
#define STATE_INVALID 0x800C
#define E_NONE 0x0
#define E_WRONG_PARITY 0x8000
#define E_INVALID_QUALITY 0x8001
#define E_INVALID_DATA 0x8002
#define E_INVALID_VERSION 0x8003
#define E_SENSOR_VCC 4 // Sensor has reported an VCC error
#define E_SENSOR_INIT 5 // Sensor has reported an init error
#define DIR_EXTRUDE 1
#define DIR_NONE 0
#define DIR_RETRACT -1
class DuetLaserSensor {
public:
DuetLaserSensor() { _pin = -1; };
DuetLaserSensor(int pin) { attach(pin); }
DuetLaserSensor(int pin, bool v1 = false) { attach(pin, v1); }
void attach(int pin);
void attach(int pin, bool v1 = false);
void reset();
void resetPosition();
void service();
unsigned getSwitch() { return _switch; }
bool getSwitch() { return _switch; }
int8_t getDirection() { return _dir; }
double getPositionMM() { return _positionMM; }
unsigned getPosition() { return _position; }
unsigned getBrightness() { return _brightness; }
unsigned getVersion() { return _version; }
unsigned getQuality() { return _quality; }
unsigned getShutter() { return _shutter; }
unsigned getError() { return _error; }
int32_t getPosition() { return _position; }
uint8_t getBrightness() { return _brightness; }
uint8_t getVersion() { return _version; }
uint8_t getQuality() { return _quality; }
uint8_t getShutter() { return _shutter; }
uint16_t getError() { return _error; }
uint8_t getSensorError() { return _sensorError; }
unsigned getState() { return _state; }
bool isValid() { return _isValid; }
String getBits() { return _lastBits; }
String getStuffBits() { return _lastStuff; }
void resetBits() { _lastBits = ""; _lastStuff = ""; }
bool isMoving() { return _hasMoved; }
String getBits() { return _bits; }
String getStuffBits() { return _stuff; }
void resetBits() { _bits = ""; _stuff = ""; }
private:
int _pin = -1;
bool _switch;
bool _isV1;
bool _hasMoved;
int8_t _dir;
double _positionMM;
unsigned _position;
unsigned _version;
unsigned _brightness;
unsigned _quality;
unsigned _shutter;
unsigned _error;
int _lastBit;
int32_t _position;
int32_t _prevpos;
uint8_t _version;
uint8_t _brightness;
uint8_t _quality;
uint8_t _shutter;
uint16_t _error;
uint8_t _sensorError;
unsigned _state;
unsigned _data;
@@ -65,12 +100,10 @@ private:
bool _gotStartbit;
bool _isValid;
int _bitCnt;
uint8_t _pbitCnt;
int _dataCnt;
String _bits;
String _stuff;
String _lastBits;
String _lastStuff;
};
#endif

View File

@@ -48,6 +48,9 @@
#define LED_PIN 2 // IO2
#define DEBUG_PIN -1
#define RELAIS_PIN -1 // Relais for stepper motor switching
#define BEEPER_CHANNEL 1
#define BEEPER_PIN 2 // IO2
@@ -77,6 +80,9 @@
#endif
#define ENCODER_BUTTON_PIN 32 // IO39 (aka SenseVN)
#define CAN_USE_SERIAL1 true
#define CAN_USE_SERIAL2 true
#define CAN_USE_SERIAL3 false
#define TX1_PIN 17 // Serial 1
#define RX1_PIN 16

View File

@@ -56,11 +56,13 @@
#define HEATBED_PIN PC6 // END
#define NEOPIXEL_PIN -1
#define DEBUG_PIN -1
#define RELAIS_PIN -1 // Relais for stepper motor switching
#define SDCS_PIN PA4
#define DSP_CS_PIN PB5
#define DSP_DC_PIN PA15
#define DSP_RESET_PIN PB4
#define DSP_CS_PIN PB5 // DOGLCD-CS
#define DSP_DC_PIN PA15 // DOGLCD-A0
#define DSP_RESET_PIN PB4 // DOGLCD-RST
#define ENCODER1_PIN PC10
#define ENCODER2_PIN PC11
@@ -68,6 +70,10 @@
#define DEBUG_OFF_PIN -1
#define CAN_USE_SERIAL1 true
#define CAN_USE_SERIAL2 false
#define CAN_USE_SERIAL3 true
#define TX3_PIN PB10 // P4-7
#define RX3_PIN PB11 // P4-5

View File

@@ -31,6 +31,7 @@ typedef struct {
extern unsigned int currentLine;
extern bool dummy(const char* msg, String buf, int serial);
extern bool M17(const char* msg, String buf, int serial);
extern bool M18(const char* msg, String buf, int serial);
extern bool M20(const char* msg, String buf, int serial);
extern bool M42(const char* msg, String buf, int serial);
@@ -43,6 +44,7 @@ extern bool M114(const char* msg, String buf, int serial);
extern bool M115(const char* msg, String buf, int serial);
extern bool M117(const char* msg, String buf, int serial);
extern bool M119(const char* msg, String buf, int serial);
extern bool M122(const char* msg, String buf, int serial);
extern bool M150(const char* msg, String buf, int serial);
extern bool M201(const char* msg, String buf, int serial);
extern bool M203(const char* msg, String buf, int serial);
@@ -51,11 +53,16 @@ extern bool M206(const char* msg, String buf, int serial);
extern bool M250(const char* msg, String buf, int serial);
extern bool M280(const char* msg, String buf, int serial);
extern bool M300(const char* msg, String buf, int serial);
extern bool M350(const char* msg, String buf, int serial);
extern bool M412(const char* msg, String buf, int serial);
extern bool M500(const char* msg, String buf, int serial);
extern bool M503(const char* msg, String buf, int serial);
extern bool M569(const char* msg, String buf, int serial);
extern bool M575(const char* msg, String buf, int serial);
extern bool M700(const char* msg, String buf, int serial);
extern bool M701(const char* msg, String buf, int serial);
extern bool M906(const char* msg, String buf, int serial);
extern bool M914(const char* msg, String buf, int serial);
extern bool M999(const char* msg, String buf, int serial);
extern bool M2000(const char* msg, String buf, int serial);
extern bool M2001(const char* msg, String buf, int serial);

View File

@@ -28,8 +28,8 @@ typedef void(*bCallback)(bool val);
void getEncoderButton(int* turn, int* button, bool* isHeld, bool* isClicked);
void drawValue(const char* title, const char* PROGMEM message, String val);
bool showInputDialog(const char* title, const char* PROGMEM message, float* val, float min, float max, fCallback cb = NULL);
bool showInputDialog(const char* title, const char* PROGMEM message, int* val, int min, int max, iCallback cb = NULL);
bool showInputDialog(const char* title, const char* PROGMEM message, float* val, float min, float max, fCallback cb = NULL, float increment = 1.0f);
bool showInputDialog(const char* title, const char* PROGMEM message, int* val, int min, int max, iCallback cb = NULL, int increment = 1);
bool showInputDialog(const char* title, const char* PROGMEM message, bool* val, bCallback cb = NULL);
bool showInputDialog(const char* title, const char* PROGMEM message, unsigned long* val, String list);
bool showInputDialog(const char* title, const char* PROGMEM message, int* val, String list, iCallback cb = NULL, bool valIsIndex = true);

View File

@@ -23,19 +23,27 @@
extern void setupMainMenu(char* menu);
extern void setupToolsMenu(char* menu);
extern void setupOffsetMenu(char* menu);
extern void setupStatusInfoMenu(char* menu);
extern void setupSwapMenu(char* menu);
extern void setupSettingsMenu(char* menu);
extern void setupTestrunMenu(char* menu);
extern void setupOptionsMenu(char* menu);
extern void showMainMenu();
extern void showToolsMenu();
extern void showOffsetsMenu(char* menuTitle);
extern void showStatusInfoMenu(char* menuTitle);
extern void showSwapMenu(char* menuTitle);
extern void showSettingsMenu(char* menuTitle);
extern void showBaudratesMenu(char* menuTitle);
extern void showOptionsMenu(char* menuTitle);
extern void showTestrunMenu(char* menuTitle);
extern void showTMCStatus(int axis);
extern void changeOffset(int index);
extern void drawOffsetPosition(int index);
extern bool selectBaudrate(int port, char* menuTitle);
extern void selectPanelDuePort(char* menuTitle);
extern const char* translateColor(int color);
extern const char* translatePanelDuePort(int port);
extern const char* translateTMCDriverMode(int mode);
#endif

View File

@@ -35,22 +35,23 @@
#define Y_STEP_PIN PB13
#define Y_DIR_PIN PB14
#define Y_ENABLE_PIN PB12
#define Y_END_PIN PC1
#define Y_END_PIN PC1 // Endstop Y-
// FEEDER (E)
// moved from Z to E because of the pins for 2nd Serial port
// moved from Z to E because of the pins for 3rd Serial port,
// so don't get confused by the pin names
#define STEP_HIGH_Z digitalWrite(Z_STEP_PIN, HIGH);
#define STEP_LOW_Z digitalWrite(Z_STEP_PIN, LOW);
#define Z_STEP_PIN PC5
#define Z_DIR_PIN PB0
#define Z_ENABLE_PIN PC4
#define Z_END_PIN PC0
#define Z_END2_PIN PA2
#define Z_END_DUET_PIN PC3 // for testing only
#define Z_END_PIN PC0 // Endstop Z-
#define Z_END2_PIN PA2 // Endstop X+
#define Z_END_DUET_PIN Z_END2_PIN
#define BEEPER_PIN PC10
//#define SERVO1_PIN PB1 // THB - Not usable. See SKR mini schematics
//#define SERVO2_PIN PA0 // TH0 - Not usable. See SKR mini schematics
#define DEBUG_PIN PA1 // Endstop Y+
#define RELAIS_PIN PC1 // Endstop Y- (Relais for stepper motor switching)
#if !defined(SMUFF_V5)
#define SERVO1_PIN PA1 // Endstop Y+
@@ -83,6 +84,9 @@ _DEFPIN_ARM(PB9, 9, B);
#define SDCS_PIN -1 // use default
#define USB_CONNECT_PIN -1 // not avail
#define SD_DETECT_PIN PA3
#define DSP_SCL PB6 // By default we run the SMuFF controller display on TWI (I2C)
#define DSP_SDA PB7
@@ -124,13 +128,28 @@ _DEFPIN_ARM(PB9, 9, B);
#define DEBUG_OFF_PIN PC3 // (PC3) Z+ pin - set to GND to re-enable debugging via STLink
#endif
#define TX3_PIN PB10 // on SKR Mini usually used for Z-Axis STEP
#define RX3_PIN PB11 // on SKR Mini usually used for Z-Axis DIR
// SERIAL1
#define CAN_USE_SERIAL1 true
#define TX1_PIN PA9 // TFT header TX
#define RX1_PIN PA10 // TFT header RX
/*
Those pins cannot be used for serial data transfer because they're
already in use on the SKR Mini V1.1
*/
// SERIAL2
#define CAN_USE_SERIAL2 false
#define TX2_PIN PA2 // on SKR Mini already used for X+ endstop (but might be reconfigured)
#define RX2_PIN PA3 // on SKR Mini already used for SD-Card DATA2
/*
Those pins can be used for serial data transfer if the Z-Axis
is not being used on the SKR Mini V1.1
*/
// SERIAL3
#define CAN_USE_SERIAL3 true
#define TX3_PIN PB10 // on SKR Mini usually used for Z-Axis STEP
#define RX3_PIN PB11 // on SKR Mini usually used for Z-Axis DIR

134
include/SKR_mini_E3/Pins.h Normal file
View File

@@ -0,0 +1,134 @@
/**
* SMuFF Firmware
* Copyright (C) 2019 Technik Gegg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*
* Pins configuration file for SKR mini E3 V1.2 board - NOT E3 DIP!
*/
#pragma once
#define BOARD_INFO "SKR mini E3 V1.2"
// SELECTOR (X)
#define STEP_HIGH_X digitalWrite(X_STEP_PIN, HIGH);
#define STEP_LOW_X digitalWrite(X_STEP_PIN, LOW);
#define X_STEP_PIN PB13
#define X_DIR_PIN PB12
#define X_ENABLE_PIN PB14
#define X_END_PIN PC0 // X-STOP
// REVOLVER (Y)
#define STEP_HIGH_Y digitalWrite(Y_STEP_PIN, HIGH);
#define STEP_LOW_Y digitalWrite(Y_STEP_PIN, LOW);
#define Y_STEP_PIN PB10
#define Y_DIR_PIN PB2
#define Y_ENABLE_PIN PB11
#define Y_END_PIN PC1 // Y-STOP
// FEEDER (Z)
#define STEP_HIGH_Z digitalWrite(Z_STEP_PIN, HIGH);
#define STEP_LOW_Z digitalWrite(Z_STEP_PIN, LOW);
#define Z_STEP_PIN PB0
#define Z_DIR_PIN PC5
#define Z_ENABLE_PIN PB1
#define Z_END_PIN PC2 // Z-STOP
#define Z_END2_PIN PC15 // E0-STOP
#define Z_END_DUET_PIN Z_END2_PIN
// (E) - Not used yet, just in case
#define STEP_HIGH_E digitalWrite(E_STEP_PIN, HIGH);
#define STEP_LOW_E digitalWrite(E_STEP_PIN, LOW);
#define E_STEP_PIN PB3
#define E_DIR_PIN PB4
#define E_ENABLE_PIN PD2
#define E_END_PIN PC15 // E0-STOP
#define BEEPER_PIN PB5 // EXP1.10
#define DEBUG_PIN PB9 // EXP1.5
#define RELAIS_PIN PC14 // PROBE (Relais for stepper motor switching)
#define SERVO1_PIN PC12 // PT-DET
#define SERVO2_PIN PA1 // SERVO
#define FAN_PIN PA8 // FAN0
#define HEATER0_PIN PC8 // HE0
#define HEATBED_PIN PC9 // BED
#define SW_SERIAL_TX_PIN PC7 // NEOPIXEL for testing only
#define SW_SERIAL_RX_PIN PC7 // NEOPIXEL for testing only
#include "FastLED.h"
_DEFPIN_ARM(PC7, 7, C); // needed to compensate "Invalid pin specified" while compiling
#define NEOPIXEL_PIN -1 //PC7 // NEOPIXEL
#define NUM_LEDS 5 // number of Neopixel LEDS
#define BRIGHTNESS 127
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define SDCS_PIN -1 // use default
#define USB_CONNECT_PIN PC13
#define SD_DETECT_PIN PC4
#if defined(USE_CREALITY_DISPLAY)
// LCD_PINS_EN = EXP1.3 = ST9720 DAT
// LCD_PINS_RS = EXP1.4 = ST9720 CS
// LCD_PINS_D4 = EXP1.5 = ST9720 CLK
#define DSP_DATA_PIN PB7 // EXP1.3
#define DSP_CS_PIN PB8 // EXP1.4
#define DSP_DC_PIN PB9 // EXP1.5
#define DSP_RESET_PIN -1
#define ENCODER1_PIN PA9 // EXP1.8
#define ENCODER2_PIN PA10 // EXP1.6
#define ENCODER_BUTTON_PIN PB6 // EXP1.9
#else // USE_TWI_DISPLAY
#define DSP_SCL PB6 // EXP1.9
#define DSP_SDA PB7 // EXP1.3
#define DSP_CS_PIN -1
#define DSP_DC_PIN -1
#define DSP_RESET_PIN -1
#define ENCODER1_PIN PA9 // EXP1.8
#define ENCODER2_PIN PA10 // EXP1.6
#define ENCODER_BUTTON_PIN PB8 // EXP1.4
#endif
#define DEBUG_OFF_PIN -1 // not needed on TWI display
#define X_SERIAL_TX_PIN PB15 // XUART - SPI2 MOSI
#define Y_SERIAL_TX_PIN PC6 // YUART - I2S2_MCK / TIM8_CH1 / SDIO_D6
#define Z_SERIAL_TX_PIN PC10 // ZUART - SERIAL4 TX
#define E_SERIAL_TX_PIN PC11 // EUART - SERIAL4 RX
// SERIAL1 - Cannot be used for serial comm.
#define CAN_USE_SERIAL1 false
#define TX1_PIN PA9 // EXP1.8 - ENCODER1_PIN
#define RX1_PIN PA10 // EXP1.6 - ENCODER2_PIN
// SERIAL2 - Can be used for serial comm.
#define CAN_USE_SERIAL2 true
#define TX2_PIN PA2 // TX on TFT header
#define RX2_PIN PA3 // RX on TFT header
// SERIAL3 - Cannot be used for serial comm. on E3 but can on E3-DIP
#define CAN_USE_SERIAL3 false
#define TX3_PIN PB10 // Y-Axis STEP
#define RX3_PIN PB11 // Y-Axis ENABLE

View File

@@ -0,0 +1,13 @@
import os
Import("env")
STM32_FLASH_SIZE = 256
for define in env['CPPDEFINES']:
if define[0] == "VECT_TAB_ADDR":
env['CPPDEFINES'].remove(define)
if define[0] == "STM32_FLASH_SIZE":
STM32_FLASH_SIZE = define[1]
# Relocate firmware from 0x08000000 to 0x08007000
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))

View File

@@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 256K - 28K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

View File

@@ -0,0 +1,140 @@
/**
* SMuFF Firmware
* Copyright (C) 2019 Technik Gegg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*
* Pins configuration file for SKR mini E3-DIP V1.1 board - NOT E3 1.2
*/
#pragma once
#define BOARD_INFO "SKR mini E3-DIP V1.1"
// SELECTOR (X)
#define STEP_HIGH_X digitalWrite(X_STEP_PIN, HIGH);
#define STEP_LOW_X digitalWrite(X_STEP_PIN, LOW);
#define X_STEP_PIN PC6
#define X_DIR_PIN PB15
#define X_ENABLE_PIN PC7
#define X_END_PIN PC1 // X-STOP
// REVOLVER (Y)
#define STEP_HIGH_Y digitalWrite(Y_STEP_PIN, HIGH);
#define STEP_LOW_Y digitalWrite(Y_STEP_PIN, LOW);
#define Y_STEP_PIN PB13
#define Y_DIR_PIN PB12
#define Y_ENABLE_PIN PB14
#define Y_END_PIN PC0 // Y-STOP
// Feeder (E)
// moved from Z to E because of the pins for 3rd Serial port,
// so don't get confused by the pin names
#define STEP_HIGH_Z digitalWrite(Z_STEP_PIN, HIGH);
#define STEP_LOW_Z digitalWrite(Z_STEP_PIN, LOW);
#define Z_STEP_PIN PB0
#define Z_DIR_PIN PC5
#define Z_ENABLE_PIN PB1
#define Z_END_PIN PC15 // Z-STOP (because E0-STOP is being used for 2nd servo)
#define Z_END2_PIN PC14 // PROBE
#define Z_END_DUET_PIN Z_END2_PIN
// SPI for stepper drivers
#define ST_MISO_PIN PB4 // MISO3
#define ST_MOSI_PIN PB5 // MOSI3
#define ST_SCLK_PIN PB3 // SCK3
#define X_CS_PIN PC10 // doubles as XUART when used in serial mode
#define Y_CS_PIN PC11 // doubles as YUART when used in serial mode
#define Z_CS_PIN PC12 // doubles as ZUART when used in serial mode
#define E_CS_PIN PD2 // doubles as EUART when used in serial mode
#define BEEPER_PIN PA15 // EXP1.10
#define RELAIS_PIN PC14 // PROBE (Relais for stepper motor switching)
#define SERVO1_PIN PC2 // E0-STOP
#define SERVO2_PIN PA1 // SERVO
#define FAN_PIN PA8 // FAN0
#define HEATER0_PIN PC8 // HE0
#define HEATBED_PIN PC9 // BED
#if defined(USE_FASTLED_BACKLIGHT)
#include "FastLED.h"
//_DEFPIN_ARM(PC7, 7, C); // needed to compensate "Invalid pin specified"
// while compiling if NEOXPIXEL_PIN is in use
#endif
#define NEOPIXEL_PIN -1
#define NUM_LEDS 5 // number of Neopixel LEDS
#define BRIGHTNESS 127
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define SDCS_PIN -1 // use default
#define USB_CONNECT_PIN PC13
#define SD_DETECT_PIN PC4
#if defined(USE_CREALITY_DISPLAY)
#define DSP_DATA_PIN PB7 // EXP1.3 = LCD_PINS_EN = ST9720 DAT
#define DSP_CS_PIN PB8 // EXP1.4 = LCD_PINS_RS = ST9720 CS
#define DSP_DC_PIN PB9 // EXP1.5 = LCD_PINS_D4 = ST9720 CLK
#define DSP_RESET_PIN -1
#define ENCODER1_PIN PA9 // EXP1.8
#define ENCODER2_PIN PA10 // EXP1.6
#define ENCODER_BUTTON_PIN PB6 // EXP1.9
#define DEBUG_PIN -1
#else // USE_TWI_DISPLAY
#define DSP_SCL PB6 // EXP1.9
#define DSP_SDA PB7 // EXP1.3
#define DSP_CS_PIN -1
#define DSP_DC_PIN -1
#define DSP_RESET_PIN -1
#define ENCODER1_PIN PA9 // EXP1.8
#define ENCODER2_PIN PA10 // EXP1.6
#define ENCODER_BUTTON_PIN PB8 // EXP1.4
#define DEBUG_PIN PB9 // EXP1.5
#endif
#define DEBUG_OFF_PIN -1 // not needed on TWI display
#define X_SERIAL_TX_PIN PC10 // XUART - UART4 TX
#define Y_SERIAL_TX_PIN PC11 // YUART - UART4 RX
#define Z_SERIAL_TX_PIN PC12 // ZUART - UART5 TX
#define E_SERIAL_TX_PIN PD2 // EUART - UART5 RX
// SERIAL1 - Cannot be used for serial comm.
#define CAN_USE_SERIAL1 false // used for encoder on EXP1
#define TX1_PIN PA9 // EXP1.8 - ENCODER1_PIN
#define RX1_PIN PA10 // EXP1.6 - ENCODER2_PIN
// SERIAL2 - Can be used for serial comm.
#define CAN_USE_SERIAL2 true // TFT header
#define TX2_PIN PA2 // TX on TFT header
#define RX2_PIN PA3 // RX on TFT header
// SERIAL3 - Cannot be used for serial comm. on E3 but can on E3-DIP
#define CAN_USE_SERIAL3 true // if no Z-Axis driver is being used
#define TX3_PIN PB10 // Z-Axis STEP
#define RX3_PIN PB11 // Z-Axis ENABLE

View File

@@ -0,0 +1,13 @@
import os
Import("env")
STM32_FLASH_SIZE = 256
for define in env['CPPDEFINES']:
if define[0] == "VECT_TAB_ADDR":
env['CPPDEFINES'].remove(define)
if define[0] == "STM32_FLASH_SIZE":
STM32_FLASH_SIZE = define[1]
# Relocate firmware from 0x08000000 to 0x08007000
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))

View File

@@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 256K - 28K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

View File

@@ -39,15 +39,34 @@
#include "U8g2lib.h"
#include "MemoryFree.h"
#include "DataStore.h"
#if defined(USE_FASTLED_BACKLIGHT)
#include "FastLED.h"
#endif
#include "ZTimerLib.h"
#include "ZStepperLib.h"
#include "ZServo.h"
#include "ZPortExpander.h"
#include "ZFan.h"
#include "DuetLaserSensor.h"
#include "SoftwareSerial.h"
#include <TMCStepper.h>
#if !defined(USE_FASTLED_BACKLIGHT)
#define CRGB uint32_t
#endif
#if defined (__STM32F1__)
#include <wirish.h>
#include <libmaple/gpio.h>
#include <USBComposite.h>
#undef sprintf_P
#define sprintf_P(s, f, ...) sprintf(s, f, ##__VA_ARGS__)
#define vsnprintf_P vsnprintf
#define cli() nvic_globalirq_disable()
#define sei() nvic_globalirq_enable()
extern USBMassStorage MassStorage;
extern USBCompositeSerial CompositeSerial;
#endif
#if defined(__ESP32__)
@@ -63,6 +82,11 @@
#define PORT_EXPANDER_ADDRESS 0x3F
#define INTERNAL 1
#define EXTERNAL 0
#define ArraySize(arr) (sizeof(arr)/sizeof(arr[0]))
typedef enum {
ABSOLUTE,
RELATIVE
@@ -115,7 +139,19 @@ typedef struct {
float insertLength = 5.0;
unsigned maxSpeedHS_Z = 10;
unsigned accelDistance_Z = 5;
// values for TMC drivers via UART or SPI
int stepperPower[NUM_STEPPERS+1] = { 700, 700, 700, 700 };
int stepperMode[NUM_STEPPERS+1] = { 0, 0, 0, 0 }; // 0 = NONE, 1 = UART, 2 = SPI
float stepperRSense[NUM_STEPPERS+1] = { 0.11, 0.11, 0.11, 0.11 };
int stepperMicrosteps[NUM_STEPPERS+1] = { 16, 16, 16,16 };
int stepperStall[NUM_STEPPERS+1] = { 0, 0, 0, 0 };
int stepperCSmin[NUM_STEPPERS+1] = { 0, 0, 0, 0 };
int stepperCSmax[NUM_STEPPERS+1] = { 0, 0, 0, 0 };
int stepperCSdown[NUM_STEPPERS+1] = { 0, 0, 0, 0 };
int stepperAddr[NUM_STEPPERS+1] = { 0, 0, 0, 0 };
int stepperToff[NUM_STEPPERS+1] = { 2, 2, 2, 2 };
bool stepperSpread[NUM_STEPPERS+1] = { true, true, true, true };
float unloadRetract = -20.0f;
float unloadPushback = 5.0f;
float pushbackDelay = 1.5f;
@@ -126,11 +162,11 @@ typedef struct {
int i2cAddress = 0x58;
int lcdContrast = DSP_CONTRAST;
int menuAutoClose = 20;
bool delayBetweenPulses = false;
unsigned long serial0Baudrate = 57600;
unsigned long serial1Baudrate = 57600;
unsigned long serial2Baudrate = 57600;
unsigned long serialDueBaudrate = 57600;
bool duetDirect = false;
unsigned long serial3Baudrate = 57600;
bool sendActionCmds = false;
int fanSpeed = 0;
char materials[MAX_TOOLS][20];
long powerSaveTimeout = 300;
@@ -138,18 +174,22 @@ typedef struct {
char wipeSequence[30] = { 0 };
bool prusaMMU2 = true;
bool useDuetLaser = false;
bool hasPanelDue = false;
int hasPanelDue = 0; // Serial Port for PanelDue (0=None)
int servoMinPwm = 550;
int servoMaxPwm = 2400;
bool sendPeriodicalStats = true;
int backlightColor = 0x4; // Cyan by default
bool runoutDetection = false;
bool isSharedStepper = false;
bool externalStepper = false;
bool encoderTickSound = false;
} SMuFFConfig;
#ifdef __BRD_I3_MINI
extern U8G2_ST7565_64128N_F_4W_HW_SPI display;
#endif
#ifdef __BRD_SKR_MINI
#if defined(__BRD_SKR_MINI) || defined(__BRD_SKR_MINI_E3) || defined(__BRD_SKR_MINI_E3DIP)
extern "C" uint8_t __wrap_u8x8_byte_arduino_2nd_hw_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
#ifdef USE_TWI_DISPLAY
extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C display;
@@ -158,6 +198,8 @@ extern U8G2_ST7565_64128N_F_4W_HW_SPI display;
// extern U8G2_ST7920_128X64_F_SW_SPI display;
#elif USE_MINI12864_PANEL_V21
extern U8G2_ST7567_JLX12864_F_2ND_4W_HW_SPI display;
#elif USE_CREALITY_DISPLAY
extern U8G2_ST7920_128X64_F_SW_SPI display;
#else
extern U8G2_ST7567_ENH_DG128064_F_2ND_4W_HW_SPI display;
//extern U8G2_UC1701_MINI12864_1_2ND_4W_HW_SPI display;
@@ -169,25 +211,37 @@ extern U8G2_ST7565_64128N_F_4W_HW_SPI display;
#else
extern U8G2_ST7567_ENH_DG128064_F_4W_HW_SPI display;
#endif
extern HardwareSerial Serial3;
#endif
#ifdef __BRD_FYSETC_AIOII
extern U8G2_UC1701_MINI12864_F_4W_HW_SPI display;
#endif
extern ZStepper steppers[];
extern ZTimer stepperTimer;
extern ZTimer gpTimer;
extern ZServo servo;
extern ZServo servoRevolver;
extern ZFan fan;
extern ClickEncoder encoder;
#if defined(USE_FASTLED_BACKLIGHT)
extern CRGB leds[];
#else
#endif
extern SMuFFConfig smuffConfig;
extern GCodeFunctions gCodeFuncsM[];
extern GCodeFunctions gCodeFuncsG[];
extern const char brand[];
extern int swapTools[];
extern volatile byte nextStepperFlag;
extern volatile byte remainingSteppersFlag;
extern volatile unsigned long lastEncoderButtonTime;
extern byte toolSelected;
extern PositionMode positionMode;
extern String serialBuffer0, serialBuffer2, serialBuffer9, traceSerial2;
extern String serialBuffer0, serialBuffer2, serialBuffer9, traceSerial2;
extern String tuneSequence;
extern bool displayingUserMessage;
extern unsigned int userMessageTime;
extern bool testMode;
@@ -199,14 +253,49 @@ extern volatile bool sendingResponse;
extern unsigned long endstopZ2HitCnt;
extern volatile bool showMenu;
extern bool maintainingMode;
extern volatile double lastDuetPos;
extern DuetLaserSensor duetLS;
extern String wirelessHostname;
extern volatile bool enablePeriStat;
extern volatile bool interval20ms;
extern volatile bool interval100ms;
extern volatile bool interval250ms;
extern volatile bool interval500ms;
extern volatile bool interval1s;
extern volatile bool interval2s;
extern volatile bool interval5s;
extern TMC2209Stepper* driverX;
extern TMC2209Stepper* driverY;
extern TMC2209Stepper* driverZ;
extern TMC2209Stepper* driverE;
extern void setupSerial();
extern void setupSwSerial0();
extern void setupDisplay();
extern void setupTimers();
extern void setupSteppers();
extern void setupTMCDrivers();
extern void setupServos();
extern void setupHeaterBed();
extern void setupFan();
extern void setupPortExpander();
extern void setupRelay();
extern void setupI2C();
extern void setupDeviceName();
extern void setupSerialBT();
extern void setupBuzzer();
extern void setupEncoder();
extern void setupBacklight();
extern void setupDuetLaserSensor();
extern void initHwDebug();
extern void initFastLED();
extern void initUSB();
extern void drawLogo();
extern void drawStatus();
extern void drawSelectingMessage();
extern void drawUserMessage(String message);
extern void drawUserMessage(String message, bool smallFont = false, bool center = true, void (*drawCallbackFunc)() = NULL);
extern void drawSDStatus(int stat);
extern void drawFeed();
extern void resetDisplay();
@@ -242,7 +331,8 @@ extern void wireReceiveEvent(int numBytes);
extern void beep(int count);
extern void longBeep(int count);
extern void userBeep();
extern void initBeep();
extern void encoderBeep(int count);
extern void startupBeep();
extern void setSignalPort(int port, bool state);
extern void signalNoTool();
extern void signalLoadFilament();
@@ -254,6 +344,7 @@ extern bool setServoMS(int servoNum, int microseconds);
extern void setServoMinPwm(int servoNum, int pwm);
extern void setServoMaxPwm(int servoNum, int pwm);
extern void getStoredData();
extern void readTune();
extern void readConfig();
extern bool writeConfig(Print* dumpTo = NULL);
extern bool checkAutoClose();
@@ -278,6 +369,31 @@ extern bool checkStopMenu(unsigned startTime);
extern void drawTestrunMessage(unsigned long loop, char* msg);
extern bool getFiles(const char* rootFolder, const char* pattern, int maxFiles, bool cutExtension, char* files);
extern void testRun(String fname);
extern void moveFeeder(float distanceMM);
extern void overrideStepX();
extern void overrideStepY();
extern void overrideStepZ();
extern bool stallCheckX();
extern bool stallCheckY();
extern bool stallCheckZ();
extern void endstopEventY();
extern void endstopEventZ();
extern void endstopEventZ2();
extern bool checkDuetEndstop();
extern void setToneTimerChannel(uint8_t ntimer, uint8_t channel);
extern void isrStepperHandler();
extern void isrGPTimerHandler();
extern void refreshStatus(bool withLogo, bool feedOnly);
extern void every10ms();
extern void every20ms();
extern void every50ms();
extern void every100ms();
extern void every250ms();
extern void every500ms();
extern void every1s();
extern void every2s();
extern void every5s();
extern void blinkLED();
extern void printEndstopState(int serial);
extern void printPos(int index, int serial);
@@ -298,6 +414,7 @@ extern bool parse_PMMU2(char cmd, const String& buf, int serial);
extern bool parse_Action(const String& buf, int serial);
extern int getParam(String buf, char* token);
extern long getParamL(String buf, char* token);
extern float getParamF(String buf, char* token);
extern int hasParam(String buf, char* token);
extern bool getParamString(String buf, char* token, char* dest, int bufLen);
extern void prepStepping(int index, long param, bool Millimeter = true, bool ignoreEndstop = false);
@@ -308,6 +425,7 @@ extern void printResponseP(const char* response, int serial);
extern void printOffsets(int serial);
extern void maintainTool();
extern void printPeriodicalState(int serial);
extern void playSequence(const char* sequence);
extern void showLed(int mode, int count);
extern void setBacklightIndex(int color);
@@ -318,4 +436,9 @@ extern void setFastLED(int index, CRGB color);
extern void setFastLEDIndex(int index, int color);
extern void setFastLEDIntensity(int intensity);
extern void testFastLED();
extern void showDuetLS();
extern void switchFeederStepper(int stepper);
extern void removeFirmwareBin();
#endif

View File

@@ -30,15 +30,17 @@
#if defined (__STM32F1__) || defined (__ESP32__)
const char P_MenuItemBack [] PROGMEM = { "\u25c0 BACK\n" };
const char P_MenuItemSeparator [] PROGMEM = { "\u25ab\u25ab\u25ab\u25ab\u25ab\n"};
#if defined(SMUFF_V5)
const char P_MenuItems [] PROGMEM = { "Home All\nMotors %s\nServo %s\nTool Maint. %s\nReset Feeder Jam\nSwap Tools \u25b8\nLoad Filament\nUnload Filament\n%s%s%s" };
const char P_MenuItemsDefault[] PROGMEM = { "Settings \u25b8\n%sTestrun \u25b8" };
#else
const char P_MenuItems [] PROGMEM = { "Home All\nMotors %s\nReset Feeder Jam\nSwap Tools \u25b8\nLoad Filament\nUnload Filament\n%s%s%s" };
const char P_MenuItemSeparator [] PROGMEM = { "\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\u00ad\n"};
const char P_MenuItems [] PROGMEM = { "Home All\nMotors %s\n%sTool Maint. %s\nReset Feeder Jam\nLoad Filament\nUnload Filament\n%s%s" };
const char P_MenuItemsDefault[] PROGMEM = { "%sSwap Tools \u25b8\nStatus Info \u25b8\n%sSettings \u25b8\n%sTestrun \u25b8" };
#if !defined(SMUFF_V5)
const char P_MenuItemsDefault[] PROGMEM = { "Settings \u25b8\n%sTestrun \u25b8" };
#endif
const char P_OfsMenuItems [] PROGMEM = { "Selector %4s\nRevolver %5s" };
const char P_StatusInfoMenuItems [] PROGMEM = { "Duet Laser Sensor \u25b8%s%s%s" };
const char P_StatusInfoMenuItemsX [] PROGMEM= { "\nTMC Driver X \u25b8" };
const char P_StatusInfoMenuItemsY [] PROGMEM= { "\nTMC Driver Y \u25b8" };
const char P_StatusInfoMenuItemsZ [] PROGMEM= { "\nTMC Driver Z \u25b8" };
#else
const char P_MenuItemBack [] PROGMEM = { "< BACK\n" };
const char P_MenuItemSeparator [] PROGMEM = { "-----\n"};
@@ -47,6 +49,7 @@ const char P_MenuItems [] PROGMEM = { "Home All\nMotors %s\nReset Feed
const char P_MenuItemsDefault[] PROGMEM = { "Settings >" };
const char P_OfsMenuItems [] PROGMEM = { "Selector %4s\nRevolver %5s" };
#endif
const char P_MenuItemsServo [] PROGMEM = { "%s Servo\n" };
const char P_MenuItemsPMMU [] PROGMEM = { "Load To Nozzle\n" };
const char P_OkButtonOnly [] PROGMEM = { " Ok " };
const char P_CancelButtonOnly [] PROGMEM = { " Cancel " };
@@ -80,18 +83,23 @@ const char P_Busy[] PROGMEM = { "busy..." };
const char P_Ready[] PROGMEM = { "ready." };
const char P_Pemu[] PROGMEM = { "PMMU2" };
#if defined (__STM32F1__) || defined (__ESP32__)
const char P_SettingsMenuItems[] PROGMEM = { "Tool Count %5s\nBowden Length %5s\nSelector Dist. %5s\nMenu Auto Close %4s\nFan Speed %5s\nPrusa MMU2 Emul. %4s\nSend Status Info %4s\nBaudrates %4s\nOffsets %4s\nSteppers/Servo %4s\nDisplay %4s\n%s\u25b9 SAVE TO SD-CARD \u25c3" };
const char P_SettingsMenuItems[] PROGMEM = { "Tool Count %5s\nBowden Length %5s\nSelector Dist. %5s\n%sOptions %4s\nBaudrates %4s\nSteppers/Servo %4s\nDisplay %4s\n%s\u25b9 SAVE TO SD-CARD \u25c3" };
#else
const char P_SettingsMenuItems[] PROGMEM = { "Tool Count %5s\nBowden Length %5s\nSelector Dist. %5s\nMenu Auto Close %4s\nFan Speed %5s\nPower Save Time %5s\nPrusa MMU2 Emul. %4S\nBaudrates %s\nOffsets %s\nSteppers %s\n%S> SAVE TO SD-CARD <" };
const char P_SettingsMenuItems[] PROGMEM = { "Tool Count %5s\nBowden Length %5s\nSelector Dist. %5s\n%sOptions %4S\nBaudrates %s\nSteppers %s\n%S> SAVE TO SD-CARD <" };
#endif
const char P_Off[] PROGMEM = { "OFF" };
const char P_On[] PROGMEM = { "ON" };
const char P_Yes[] PROGMEM = { "Yes" };
const char P_No[] PROGMEM = { "No" };
const char P_High[] PROGMEM = { "HI" };
const char P_Low[] PROGMEM = { "LO" };
const char P_No_[] PROGMEM = { " " };
const char P_Unknown[] PROGMEM = { "---" };
const char P_High[] PROGMEM = { "HIGH" };
const char P_Low[] PROGMEM = { "LOW" };
const char P_Open[] PROGMEM = { "OPEN" };
const char P_Close[] PROGMEM = { "CLOSE" };
const char P_None[] PROGMEM = { "None" };
const char P_Stealth[] PROGMEM = { "Stealth" };
const char P_Spread[] PROGMEM = { "Spread" };
const char P_ToolCount[] PROGMEM = { "# of tools:" };
const char P_InMillimeter[] PROGMEM = { "in mm:" };
@@ -99,8 +107,8 @@ const char P_InSeconds[] PROGMEM = { "in seconds:" };
const char P_InPercent[] PROGMEM = { "in percent:" };
const char P_InValue[] PROGMEM = { "as value:" };
const char P_YesNo[] PROGMEM = { "yes / no:" };
const char P_Baud[] PROGMEM = { "Baudrate:" };
const char P_Color[] PROGMEM = { "Color:" };
const char P_Baud[] PROGMEM = { "baudrate:" };
const char P_Color[] PROGMEM = { "color:" };
const char P_InMicroseconds[] PROGMEM = { "in uS:" };
const char P_InTicks[] PROGMEM = { "in ticks:" };
const char P_InSteps[] PROGMEM = { "in steps:" };
@@ -109,24 +117,32 @@ const char P_OpenPos[] PROGMEM = { "open @:" };
const char P_ClosedPos[] PROGMEM = { "closed @:" };
const char P_ServoCycles[] PROGMEM = { "cycles:" };
const char P_NoOfChunks[] PROGMEM = { "# of chunks:" };
const char P_BaudMenuItems[] PROGMEM = { "USB-Serial %6s\n2nd Serial %6s" };
const char P_DriverMode[] PROGMEM = { "drvr. mode:" };
const char P_InMilliAmpere[] PROGMEM = { "in mA:" };
const char P_InOhm[] PROGMEM = { "in ohm:" };
const char P_Threshold[] PROGMEM = { "threshold:" };
const char P_Min[] PROGMEM = { "min.:" };
const char P_Max[] PROGMEM = { "max.:" };
const char P_Down[] PROGMEM = { "down:" };
const char P_Address[] PROGMEM = { "address:" };
const char P_Microsteps[] PROGMEM = { "microsteps:" };
const char P_Value[] PROGMEM = { "value:" };
const char P_MicrostepItems[] PROGMEM = { "1\n2\n4\n8\n16\n32\n64\n128" };
const char P_TMCModeItems[] PROGMEM = { "OFF\nUART\nSPI" };
const char P_BaudMenuItems[] PROGMEM = { "USB-Serial %6s\n1st Serial %6s\n2nd Serial %6s\n3rd Serial %6s" };
const char P_Baudrates[] PROGMEM = { "4800\n9600\n19200\n38400\n56700\n115200\n230400" };
const char P_Colors[] PROGMEM = { "Black\nRed\nGreen\nBlue\nCyan\nMagenta\nYellow\nWhite" };
const char P_PanelDueOptions[] PROGMEM = { "None\nSer.2\nSer.3" };
#if defined (__STM32F1__) || defined (__ESP32__)
#if defined(SMUFF_V5)
const char P_SteppersMenuItems[] PROGMEM = { "Selector %2s\nFeeder %2s\nServo %2s" };
#else
const char P_SteppersMenuItems[] PROGMEM = { "Selector %2s\nFeeder %2s\nRevolver %2s" };
#endif
const char P_AllSteppersMenuItems[] PROGMEM = { "Invert DIR %4s\nEndstop Trigger %4s\nStep Delay %4s\nMax. Speed %5s\nMax. Speed HS %5s\nAcceleration %5s" };
#if defined(SMUFF_V5)
const char P_RevolverMenuItems[] PROGMEM = { "Home After Feed %4s\nReset Bef. Feed %4s\nUse Servo 2 %4s\nServo 2 opened %5s\nServo 2 closed %5s\nServo 1 cycles %5s\nServo 2 cycles %5s" };
#else
const char P_RevolverMenuItems[] PROGMEM = { "\nSteps per Rev. %5s\nHome After Feed %4s\nReset Bef. Feed %4s\nWiggle %4s\nUse Servo %4s\nServo 2 opened %5s\nServo 2 closed %5s\nServo 1 cycles %5s\nServo 2 cycles %5s" };
#endif
const char P_FeederMenuItems[] PROGMEM = { "\nSteps per MM %5s\nEnable Chunks %4s\nFeed Chunks %4s\nInsert Length %5s\nInsert Speed %5s\nReinforce Len. %5s" };
const char P_SelectorMenuItems[] PROGMEM = { "\nSteps per MM %5s" };
const char P_DisplayMenuItems[] PROGMEM = { "Screen Timeout %4s\nLCD Contrast %4s\nBacklight %8s" };
const char P_SteppersMenuItems[] PROGMEM = { "Selector %2s\nFeeder %2s\n%-8s %2s" };
const char P_AllSteppersMenuItems[] PROGMEM = { "TMC Settings %4s\u25b8\nInvert DIR %4s\nEndstop Trigger %4s\nStep Delay %4s\nMax. Speed %5s\nMax. Speed HS %5s\nAcceleration %5s" };
const char P_RevolverMenuItems[] PROGMEM = { "\n1st Tool Offset %5s\nSteps per Rev. %5s\nHome After Feed %4s\nReset Bef. Feed %4s\nWiggle %4s\nUse Lid Servo %4s\nLid Servo open %5s" };
const char P_FeederMenuItems[] PROGMEM = { "\nSteps per mm %5s\nEnable Chunks %4s\nFeed Chunks %4s\nInsert Length %5s\nInsert Speed %5s\nReinforce Len. %5s\nExternal Ctrl. %4s\nIs Shared %4s" };
const char P_SelectorMenuItems[] PROGMEM = { "\n1st Tool Offset %5s\nSteps per mm %5s" };
const char P_ServoMenuItems[] PROGMEM = { "Home After Feed %4s\nReset Bef. Feed %4s\nUse Lid Servo %4s\nLid Servo Open %5s\nLid Servo Close %5s\nWiper Servo Cycles%3s\nLid Servo Cycles %3s" };
const char P_TMCMenuItems[] PROGMEM = { "Mode %4s\nPower %4s\nR-Sense %4s\nMicrosteps %4s\nStall Thrs. %5s\nCoolStep min. %4s\nCoolStep max. %4s\nCoolStep down %4s\nDriver Address %4s\nTOff %4s" };
const char P_DisplayMenuItems[] PROGMEM = { "Screen Timeout %4s\nLCD Contrast %4s\nBacklight %8s\nEncoder Ticks %4s" };
#else
const char P_SteppersMenuItems[] PROGMEM = { "Selector >\nRevolver >\nFeeder >" };
const char P_AllSteppersMenuItems[] PROGMEM = { "Invert DIR %4S\nEndstop Trigger %4S\nStep Delay %4s\nMax. Speed %5s\nMax. Speed HS %5s\nAcceleration %5s" };
@@ -134,6 +150,12 @@ const char P_RevolverMenuItems[] PROGMEM = { "\nSteps per Rev. %5s\nHome Aft
const char P_FeederMenuItems[] PROGMEM = { "\nSteps per MM %5s\nEnable Chunks %4S\nFeed Chunks %4s\nInsert Length %5s\nInsert Speed %5s\nReinforce Len. %5s" };
const char P_SelectorMenuItems[] PROGMEM = { "\nSteps per MM %5s" };
#endif
#if defined (__STM32F1__) || defined (__ESP32__)
const char P_OptionsMenuItems[] PROGMEM = { "Menu Auto Close %4s\nFan Speed %5s\nPrusa MMU2 Emul. %4s\nSend Status Info %4s\nUse Laser Sensor %4s\nPanelDue Port %5s" };
#else
const char P_OptionsMenuItems[] PROGMEM = { "Menu Auto Close %4s\nFan Speed %5s\nPower Save Time %5s\nPrusa MMU2 Emul. %4S\n" };
#endif
const char P_ConfigWriteSuccess[] PROGMEM = { "Config success-\nfully written." };
const char P_ConfigWriteFail[] PROGMEM = { "Config write failed!\nPlease check SD-Card." };
@@ -145,6 +167,10 @@ const char P_ToolChanges[] PROGMEM = { "Tool change: %5ld" };
const char P_TestTime[] PROGMEM = { "Elapsed: %3d:%02d:%02d" };
const char P_FeederErrors[] PROGMEM = { "Feed errors: %5ld" };
const char P_ButtonToStop[] PROGMEM = { "Press Button To Stop" };
const char P_DuetLSStat[] PROGMEM = { "Duet3D LS Status" };
const char P_DuetLSDisabled[] PROGMEM = { "Duet3D LaserSensor\nnot enabled!" };
const char P_DuetLSData[] PROGMEM = { "Position:%s%6smm\nQ/B/S: %3d/%3d/%3d\nSwitch: %3s\nError: %4s\nVersion: %3d" };
const char P_PanelDuePort[] PROGMEM = { "Use Port:" };
const char P_SD_ReadingConfig[] PROGMEM = { "Reading config..." };
const char P_SD_InitError[] PROGMEM = { "SD-Card not ready!" };
@@ -155,6 +181,8 @@ const char P_Start[] PROGMEM = { "start\n" };
const char P_Error[] PROGMEM = { "error: %s\n" };
const char P_Echo[] PROGMEM = { "echo: %s\n" };
const char P_UnknownCmd[] PROGMEM = { "Unknown command: %s" };
const char P_UnknownParam[] PROGMEM = { "Unknown parameter '%s'\n" };
const char P_NoValue[] PROGMEM = { "Value ('Sn') missing for parameter '%s'\n" };
const char P_AlreadySaved[] PROGMEM = { "Already saved.\n" };
const char P_GVersion[] PROGMEM = { "FIRMWARE_NAME: Smart.Multi.Filament.Feeder (SMuFF) FIRMWARE_VERSION: %s ELECTRONICS: %s DATE: %s MODE: %s\n" };
const char P_TResponse[] PROGMEM = { "T%d\n" };
@@ -168,11 +196,13 @@ const char P_FeederPos[] PROGMEM = { "Feeder position = %ld\n" };
const char P_ToolSelected[] PROGMEM = { "Tool selected = %d\n" };
const char P_Contrast[] PROGMEM = { "Display contrast = %d\n" };
const char P_ToolsConfig[] PROGMEM = { "Tools configured = %d\n" };
const char P_AccelSpeed[] PROGMEM = { "X (Selector):\t%s, D:%s\nY (Revolver):\t%s, D:%s\nZ (Feeder):\t%s, D:%s\n" };
const char P_AccelSpeed[] PROGMEM = { "X (Selector):\t%s, D:%s\nY (Revolver):\t%s, D:%s\nZ (Feeder):\t%s%s, D:%s\n" };
const char P_Positions[] PROGMEM = { "X (Selector): %s, Y (Revolver): %s, Z (Feeder): %s\n" };
const char P_CurrentTool[] PROGMEM = {"Tool " };
const char P_Feed[] PROGMEM = {"Feed " };
const char P_External[] PROGMEM = {"EXT." };
const char P_Internal[] PROGMEM = {"INT." };
const char P_NoTool [] PROGMEM = { "No tool set.\n" };
const char P_Aborting [] PROGMEM = { "Aborting..."};
@@ -180,14 +210,51 @@ const char P_FeederJammed [] PROGMEM = { "Feeder is jammed.\n" };
const char P_JamCleared [] PROGMEM = { "Feeder Jam has\nbeen reset." };
const char P_ToolAlreadySet [] PROGMEM= { "Tool already set." };
const char P_WrongTool [] PROGMEM = { "Tool index %d invalid." };
const char P_ActionMsg [] PROGMEM = { "Controller says:\n%s" };
const char P_WrongFormat [] PROGMEM = { "Wrong format. Use Bdd:dd:dd...\n" };
const char P_NoPrusa [] PROGMEM = { "Prusa MMU2 mode was not configured." };
const char P_NoPrusa [] PROGMEM = { "Prusa MMU2 mode is not configured." };
const char P_PMMU_Title [] PROGMEM = { "Waiting..." };
const char P_PMMU_Wait [] PROGMEM = { "Please click the" };
const char P_PMMU_WaitAdd [] PROGMEM = { "encoder button" };
const char P_StepperMode [] PROGMEM = { "%s: %s" };
const char P_StepperNotCfg [] PROGMEM = { "Driver not in use!" };
const char P_StepperUART [] PROGMEM = { "UART" };
const char P_StepperPDN [] PROGMEM = { "PDN" };
const char P_TMC_Setup00[] PROGMEM = { " -X- -Y- -Z- -E-\n" };
const char P_TMC_Setup01[] PROGMEM = { "IC Version " };
const char P_TMC_Setup02[] PROGMEM = { "Enabled " };
const char P_TMC_Setup03[] PROGMEM = { "Current Config. " };
const char P_TMC_Setup03a[] PROGMEM = { "RMS Current " };
const char P_TMC_Setup04[] PROGMEM = { "Microsteps " };
const char P_TMC_Setup05[] PROGMEM = { "Off Time " };
const char P_TMC_Setup06[] PROGMEM = { "Blank Time " };
const char P_TMC_Setup07[] PROGMEM = { "UART Mode " };
const char P_TMC_Setup08[] PROGMEM = { "MS2 / MS1 " };
const char P_TMC_Setup09[] PROGMEM = { "Diag " };
const char P_TMC_Setup10[] PROGMEM = { "StallGuard THRS " };
const char P_TMC_Setup11[] PROGMEM = { "StallGuard Result " };
const char P_TMC_Setup12[] PROGMEM = { "CoolStep Min. " };
const char P_TMC_Setup13[] PROGMEM = { "CoolStep Max. " };
const char P_TMC_Setup14[] PROGMEM = { "CoolStep Down " };
const char P_TMC_Setup15[] PROGMEM = { "CoolStep THRS " };
const char P_TMC_Status00[] PROGMEM = { " -------------= STATUS =-------------\n" };
const char P_TMC_Status01[] PROGMEM = { "Mode "};
const char P_TMC_Status02[] PROGMEM = { "Stand Still "};
const char P_TMC_Status03[] PROGMEM = { "Ph. A open "};
const char P_TMC_Status04[] PROGMEM = { "Ph. B open "};
const char P_TMC_Status05[] PROGMEM = { "Ph. A short "};
const char P_TMC_Status06[] PROGMEM = { "Ph. B short "};
const char P_TMC_Status07[] PROGMEM = { "Ph. A short MOS "};
const char P_TMC_Status08[] PROGMEM = { "Ph. B short MOS "};
const char P_TMC_Status09[] PROGMEM = { "Overtemp. Warning "};
const char P_TMC_Status10[] PROGMEM = { "Overtemperature "};
// .....................\n.....................\n.....................\n.....................\n.....................
const char P_TMC_Status[] PROGMEM = { "Mode %7s\nRMS Cur. %4dmA\nPh. A/B open %3s/%3s\nPh. A/B short %3s/%3s\nOvertemperature %3s"};
const char P_GCmds[] PROGMEM = {
"G0\t-\tMove\n" \
"G1\t-\tMove\n" \
@@ -198,6 +265,7 @@ const char P_GCmds[] PROGMEM = {
"G91\t-\tRelative positioning\n" };
const char P_MCmds[] PROGMEM = {
"M17\t-\tSwitch feeder stepper control (Relay)\n" \
"M18\t-\tMotors off\n" \
"M84\t-\tMotors off\n" \
"M20\t-\tList SD-Card\n" \
@@ -209,21 +277,26 @@ const char P_MCmds[] PROGMEM = {
"M115\t-\tReport version\n" \
"M117\t-\tDisplay message\n" \
"M119\t-\tReport endstop status\n" \
"M122\t-\tReport TMC driver status\n" \
"M150\t-\tSet FastLED color\n" \
"M201\t-\tSet max acceleration\n" \
"M203\t-\tSet max feedrate\n" \
"M205\t-\tSet advanced options\n" \
"M206\t-\tSet offsets\n" \
"M250\t-\tLCD contrast\n" \
"M300\t-\tBeep\n" \
"M412\t-\tJAM detection on/off\n" \
"M300\t-\tPlay a tone or a tune\n" \
"M350\t-\tSet motor microstepping\n" \
"M500\t-\tSave settings\n" \
"M503\t-\tReport settings\n" \
"M569\t-\tSet SpreadCycle on/off\n" \
"M575\t-\tSet serial port baudrate\n" \
"M700\t-\tLoad filament\n" \
"M701\t-\tUnload filament\n" \
"M906\t-\tSet motor current\n" \
"M914\t-\tSet motor stall sensitivity\n" \
"M999\t-\tReset\n" \
"M2000\t-\tText to decimal\n" \
"M2001\t-\tDecimal to text\n"};
#endif

View File

@@ -48,6 +48,9 @@
#define BEEPER_PIN 37
#define DEBUG_PIN -1
#define RELAIS_PIN -1 // Relais for stepper motor switching
#define SERVO1_PIN 44
#define SERVO2_PIN 14
#define FAN_PIN 12
@@ -62,6 +65,10 @@
#define DSP_DC_PIN 40
#define DSP_RESET_PIN 27
#define CAN_USE_SERIAL1 true
#define CAN_USE_SERIAL2 false
#define CAN_USE_SERIAL3 false
#define TX2_PIN 16
#define RX2_PIN 17

66
include/ZFan.h Normal file
View File

@@ -0,0 +1,66 @@
/**
* SMuFF Firmware
* Copyright (C) 2019 Technik Gegg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdlib.h>
#include <Arduino.h>
#include "Config.h"
#ifndef _ZFAN_H
#define _ZFAN_H
#define MAX_FANS 2
#define FAN_DUTY_CYCLE 150 // fan cycle in us (7500)
extern void __debug(const char* fmt, ...);
void isrFanTimerHandler();
class ZFan {
public:
ZFan() { _pin = 0; };
void attach(int pin);
void attach(int pin, int fanIndex) { attach(pin); setIndex(fanIndex); }
void setIndex(int fanIndex);
void detach();
void setFanSpeed(int speed);
void setFan();
void setFanPin(int state);
void setPulseWidthMinMax(int min, int max) { _minSpeed = min; _maxSpeed = max; }
void setPulseWidthMin(int min) { _minSpeed = min; }
void setPulseWidthMax(int max) { _maxSpeed = max; }
private:
int _pin;
bool _useTimer = false;
bool _timerStopped = false;
int _fanIndex;
int _speed;
int _minSpeed = 0;
int _maxSpeed = FAN_DUTY_CYCLE;
#ifdef __STM32F1__
volatile uint32_t _tickCnt;
#else
volatile int _tickCnt;
#endif
volatile int _dutyCnt;
int _loopCnt;
int _pulseLen;
};
#endif

View File

@@ -37,7 +37,6 @@
extern void __debug(const char* fmt, ...);
void isrServoTimerHandler();
static ZTimer servoTimer;
static volatile bool timerSet = false;
class ZServo {
@@ -59,7 +58,8 @@ public:
void setPulseWidthMinMax(int min, int max) { _minPw = min; _maxPw = max; }
void setPulseWidthMin(int min) { _minPw = min; }
void setPulseWidthMax(int max) { _maxPw = max; }
void stop() { if(_useTimer) servoTimer.stopTimer(); }
void stop(bool state) { _timerStopped = state; }
bool isTimerStopped() { return _timerStopped; }
bool hasTimer() { return _useTimer; }
void setMaxCycles(int val) { _maxCycles = val;}
int getMaxCycles() { return _maxCycles;}
@@ -72,6 +72,7 @@ private:
void setServoPin(int state);
int _pin;
bool _useTimer = false;
bool _timerStopped = false;
int _servoIndex;
int _degree;
int _lastDegree;
@@ -84,7 +85,6 @@ private:
#endif
volatile int _dutyCnt;
int _maxCycles;
int _loopCnt;
int _pulseLen;
int _minPw = US_PER_PULSE_0DEG;
int _maxPw = US_PER_PULSE_180DEG;

View File

@@ -43,7 +43,7 @@ public:
ZStepper();
ZStepper(int number, char* descriptor, int stepPin, int dirPin, int enablePin, unsigned int accelaration, unsigned int minStepInterval);
void prepareMovement(long steps, boolean ignoreEndstop = false);
void prepareMovement(long steps, bool ignoreEndstop = false);
void handleISR();
void home();
@@ -51,6 +51,7 @@ public:
void (*endstopFunc)() = NULL;
void (*endstop2Func)() = NULL;
bool (*endstopCheck)() = NULL;
bool (*stallCheck)() = NULL;
void (*runAndWaitFunc)(int number) = NULL;
void (*runNoWaitFunc)(int number) = NULL;
void defaultStepFunc(); // default step method, uses digitalWrite on _stepPin

View File

@@ -39,6 +39,13 @@ public:
ZTIMER8 = 8
} IsrTimer;
typedef enum {
CH1 = 1,
CH2 = 2,
CH3 = 3,
CH4 = 4
} IsrTimerChannel;
typedef enum {
PRESCALER1 = 1,
PRESCALER8 = 2,

View File

@@ -8,30 +8,84 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = BIGTREE_SKR_MINI, BIGTREE_SKR_MINI_SD, SMUFF_ESP32
default_envs = BIGTREE_SKR_MINI_E3DIP_SD, BIGTREE_SKR_MINI_E3_SD, BIGTREE_SKR_MINI_SD, FYSETC_AIOII_SD, SMUFF_ESP32
#default_envs = BIGTREE_SKR_13
#
# TODO: Pick a display type here by removing / setting
# the comment char (#) accordingly
#
# WARNING: If you pick the ANET display, make sure you've checked
# the wiring before attaching the display to the board!
# Instructions to modify the ANET display can be found
# here: https://www.thingiverse.com/thing:4009810
[display]
build_flags = -D USE_TWI_DISPLAY
#-D USE_ANET_DISPLAY
#-D USE_MINI12864_PANEL_V21
#-D USE_CREALITY_DISPLAY
# use either one of the backlight options or none, if your
# display doesn't support this feature
#-D USE_FASTLED_BACKLIGHT
#-D USE_RGB_BACKLIGHT
#
# STM32 common build flags for USB port usage
#
[USB]
build_flags = -D ENABLE_USB_SERIAL
-D SERIAL_USB
-D USBD_USE_CDC
-D USBCON
# not sure about the next two
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D HAL_PCD_MODULE_ENABLED
#
# include these if you're going to use TMC stepper drivers
# and set the definitions accordingly
#
[TMC]
lib_deps = # both libraries being used for TMC stepper drivers
https://github.com/teemuatlut/TMCStepper
https://github.com/FYSETC/SoftwareSerialM
build_flags = -D TMC_BAUDRATE=19200
[common]
lib_deps =
# SD-Card file system library
SdFs
# JSON library for the configuration file
ArduinoJson@6
# LC-Display library
U8G2
# Rotary-Encoder library
#https://github.com/Den-W/encoder.git
#Free memory library
https://github.com/McNeight/MemoryFree
# FastLED library - use fork FastLED-STM32 instead of original one
# because of the compile time circular reference issues
#FastLED@>=3.3.3
https://github.com/13rac1/FastLED-STM32
build_flags = -D SMUFF_V5
-D xDEBUG
-D DEBUG
-D __HW_DEBUG__
# use the next two options only if you're compiling for Marlin MMU2
-D MARLIN2_ONLY
-D SOFTRESET
# some compiler options to get rid of not really critical messages while compiling
-Wno-unused-variable
build_unflags =
-Wno-format-extra-args
-Wno-misleading-indentation
# U8G2 library wrappers
-Wl,--wrap=u8x8_byte_arduino_2nd_hw_spi,--wrap=__wrap_u8g2_UserInterfaceMessage
-std=gnu++14
# generate debug information
# use -g for default, -g1 for minimal, -g3 for maximal debug information or
# -g0 for turning debug information off
-g0
build_unflags = -std=gnu++11
lib_deps = # SD-Card file system library
SdFs
# JSON library for the configuration file
ArduinoJson@6
# LC-Display library
U8G2
# Rotary-Encoder library
#https://github.com/Den-W/encoder.git
#Free memory library
https://github.com/McNeight/MemoryFree
# FastLED library - use fork FastLED-STM32 instead of original one
# because of the compile time circular reference issues
#FastLED@>=3.3.3
https://github.com/13rac1/FastLED-STM32
#
# Please note: From version 2.x the 8-bit ATMega is
@@ -43,11 +97,11 @@ build_unflags =
platform = atmelavr
framework = arduino
board = megaatmega2560
lib_deps = ${common.lib_deps}
build_flags = -D __BRD_I3_MINI
-D __AVR__
-I include/Wanhao_i3_mini
build_unflags = $(common.build_unflags)
lib_deps = ${common.lib_deps}
build_unflags = ${common.build_unflags}
upload_port = COM[35]
monitor_speed = 57600
@@ -57,22 +111,20 @@ monitor_speed = 57600
# This is a specific controller board built for the SMuFF
# based on a ESP32 microcontroller.
#
# For more information about it visit: https://{_smuff_esp32_controller_board_website_}.com
# For more information about it visit: https://sites.google.com/view/the-smuff/ESP32-Board
#
[env:SMUFF_ESP32]
platform = espressif32
framework = arduino
board = esp32doit-devkit-v1
build_flags = -D __BRD_ESP32
-D __ESP32__
-D __xDEBUG_BT__
-D USE_TWI_DISPLAY
-D USE_FASTLED_BACKLIGHT
-D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
-I include/ESP32
-Wl,--wrap=__wrap_u8g2_UserInterfaceMessage
lib_deps = https://github.com/lbernstone/Tone.git
${common.lib_deps}
build_flags = ${display.build_flags}
-D __BRD_ESP32
-D __ESP32__
#-D __DEBUG_BT__
-D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
-I include/ESP32
upload_port = COM[3]
monitor_speed = 115200
board_build.partitions = custompart.csv
@@ -80,65 +132,93 @@ board_build.partitions = custompart.csv
#
# BIGTREETECH SKR MINI V1.1
#
# IT'S NOT RECOMMENDED USING THIS ENV ANYMORE SINCE
# IT WILL OVERWRITE THE FACTORY BOOTLOADER.
# PLEASE USE BIGTREE_SKR_MINI_SD INSTEAD AND FLASH
# THE FIRMWARE FROM SD-CARD!
#
[env:BIGTREE_SKR_MINI]
platform = ststm32
framework = arduino
board = genericSTM32F103RC
board_build.core= maple
build_flags = ${common.build_flags}
-std=gnu++14
-g
-I include/SKR_mini
-D __BRD_SKR_MINI
-D __STM32F1__
-D USE_TWI_DISPLAY
-D USE_FASTLED_BACKLIGHT
-D ENABLE_USB_SERIAL
-D USBD_USE_CDC
-D USBCON
# Vendor STM (hardcoded to 0x1eaf in usb_cdcadm.c)
#-D LEAFLABS_ID_VENDOR=0x0483
# Product Virtual COM Port (hardcoded to 0x0004 in usb_cdcacm.c)
#-D MAPLE_ID_PRODUCT=0x5740
#-D HAL_PCD_MODULE_ENABLED
-Wl,--wrap=u8x8_byte_arduino_2nd_hw_spi,--wrap=__wrap_u8g2_UserInterfaceMessage
build_unflags = -std=gnu++11 $(common.build_unflags)
lib_deps = ${common.lib_deps}
monitor_speed = 115200
upload_protocol = stlink
#[env:BIGTREE_SKR_MINI]
#platform = ststm32
#framework = arduino
#board = genericSTM32F103RC
#board_build.core= maple
#lib_deps = ${common.lib_deps}
#build_flags = ${common.build_flags}
# ${display.build_flags}
# ${USB.build_flags}
# -I include/SKR_mini
# -D __BRD_SKR_MINI
# -D __STM32F1__
#build_unflags = ${common.build_unflags}
#monitor_speed = 115200
#upload_protocol = stlink
#upload_protocol = dfu
debug_tool = stlink
#debug_tool = stlink
#
# BIGTREETECH SKR MINI V1.1 (flashing through SDcard, using the default bootloader)
# BIGTREETECH SKR MINI V1.1 (flashing through SD-Card, using the default bootloader)
#
[env:BIGTREE_SKR_MINI_SD]
platform = ststm32
framework = arduino
board = genericSTM32F103RC
board_build.core = maple
lib_deps = ${common.lib_deps}
${TMC.lib_deps}
build_flags = ${common.build_flags}
-std=gnu++14
-g
${display.build_flags}
${USB.build_flags}
${TMC.build_flags}
-I include/SKR_mini
-D __BRD_SKR_MINI
-D __STM32F1__
-D SOFTRESET
#-D USE_ANET_DISPLAY
#-D USE_MINI12864_PANEL_V21
#-D USE_FASTLED_BACKLIGHT
-D ENABLE_USB_SERIAL
-D USBD_USE_CDC
-D USBCON
#-D USBD_VID=0x1EAF
#-D USB_MANUFACTURER="LeafLabs"
#-D USB_PRODUCT="MAPLE R3"
-Wl,--wrap=u8x8_byte_arduino_2nd_hw_spi,--wrap=__wrap_u8g2_UserInterfaceMessage
build_unflags = -std=gnu++11 $(common.build_unflags)
build_unflags = ${common.build_unflags}
extra_scripts = include/SKR_mini/STM32F103RC_SKR_MINI.py
board_build.ldscript = include/SKR_mini/STM32F103RC_SKR_MINI_256K.ld
#
# BIGTREETECH SKR MINI E3 V1.2 (flashing through SD-Card, using the default bootloader)
#
[env:BIGTREE_SKR_MINI_E3_SD]
platform = ststm32
framework = arduino
board = genericSTM32F103RC
board_build.core = maple
lib_deps = ${common.lib_deps}
${TMC.lib_deps}
build_flags = ${common.build_flags}
${display.build_flags}
${USB.build_flags}
${TMC.build_flags}
-I include/SKR_mini_E3
-D __BRD_SKR_MINI_E3
-D __STM32F1__
build_unflags = ${common.build_unflags}
extra_scripts = include/SKR_mini/STM32F103RC_SKR_MINI.py
board_build.ldscript = include/SKR_mini/STM32F103RC_SKR_MINI_256K.ld
#
# BIGTREETECH SKR MINI E3-DIP V1.1 (flashing through SD-Card, using the default bootloader)
#
[env:BIGTREE_SKR_MINI_E3DIP_SD]
platform = ststm32
framework = arduino
board = genericSTM32F103RC
board_build.core = maple
lib_deps = ${common.lib_deps}
${TMC.lib_deps}
build_flags = ${common.build_flags}
${display.build_flags}
${USB.build_flags}
${TMC.build_flags}
-I include/SKR_mini_E3DIP
-D __BRD_SKR_MINI_E3DIP
-D __STM32F1__
build_unflags = ${common.build_unflags}
extra_scripts = include/SKR_mini/STM32F103RC_SKR_MINI.py
board_build.ldscript = include/SKR_mini/STM32F103RC_SKR_MINI_256K.ld
# !!! DO NOT USE - EXPERIMENTAL !!!
# Will fail to compile because of the lacking
@@ -147,47 +227,22 @@ lib_deps = ${common.lib_deps}
# BIGTREETECH SKR 1.3
#
[env:BIGTREE_SKR_13]
platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/master.zip
platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip
framework = arduino
board = nxp_lpc1768
lib_deps = https://github.com/p3p/pio-framework-arduino-lpc176x.git
${common.lib_deps}
build_flags = ${common.build_flags}
-g
${display.build_flags}
-I include/SKR_13
-D __BRD_SKR_13
-D __NXP__
-D USE_TWI_DISPLAY
build_unflags = $(common.build_unflags)
build_unflags = ${common.build_unflags}
lib_ldf_mode = off
lib_compat_mode = strict
lib_deps = https://github.com/p3p/pio-framework-arduino-lpc176x.git
${common.lib_deps}
monitor_speed = 250000
upload_port = COM1
#
# FYSETC AIO II v3.2
#
[env:FYSETC_AIOII]
platform = ststm32
framework = arduino
board = genericSTM32F103RC
board_build.core = maple
platform_packages = tool-stm32duino
build_flags = ${common.build_flags}
-std=gnu++14
-g
-I include/FYSETC_AIOII
-D __BRD_FYSETC_AIOII
-D __STM32F1__
-D USE_RGB_BACKLIGHT
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D HAL_PCD_MODULE_ENABLED
build_unflags = -std=gnu++11 $(common.build_unflags)
extra_scripts = include/FYSETC_AIOII/FYSETC_AIOII.py
lib_deps = ${common.lib_deps}
debug_tool = stlink
upload_protocol = serial
#
# FYSETC AIO II v3.2 (flashing through SDcard, using FYSECT STM32F103 bootloader)
# https://github.com/FYSETC/Bootloader-STM32F103
@@ -197,16 +252,12 @@ platform = ststm32
framework = arduino
board = genericSTM32F103RC
board_build.core = maple
lib_deps = ${common.lib_deps}
build_flags = ${common.build_flags}
-std=gnu++14
-g
${USB.build_flags}
-I include/FYSETC_AIOII
-D __BRD_FYSETC_AIOII
-D __STM32F1__
-D SOFTRESET
-D USE_RGB_BACKLIGHT
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D HAL_PCD_MODULE_ENABLED
build_unflags = -std=gnu++11 $(common.build_unflags)
build_unflags = ${common.build_unflags}
extra_scripts = include/FYSETC_AIOII/FYSETC_AIOII_SD.py
lib_deps = ${common.lib_deps}

View File

@@ -11,6 +11,9 @@
#include "ClickEncoder.h"
extern void __debug(const char* fmt, ...);
extern void encoderBeep(int);
// ----------------------------------------------------------------------------
// Button configuration (values for 1ms timer service calls)
//
@@ -56,6 +59,7 @@ ClickEncoder::ClickEncoder(uint8_t A, uint8_t B, uint8_t BTN, uint8_t stepsPerNo
pinB = B;
pinBTN = BTN;
pinsActive = active;
enableSound = false;
#if defined (__STM32F1__)
WiringPinMode configType = (pinsActive == LOW) ? INPUT_PULLUP : INPUT_PULLDOWN;
@@ -116,7 +120,6 @@ void ClickEncoder::service(void)
if (digitalRead(pinB) == pinsActive) {
curr ^= 1;
}
int8_t diff = last - curr;
if (diff & 1) { // bit 0 = step
@@ -195,17 +198,19 @@ int16_t ClickEncoder::getValue(void)
#else
cli();
#endif
val = delta;
if (steps == 2) delta = val & 1;
else if (steps == 4) delta = val & 3;
else delta = 0; // default to 1 step per notch
#if defined (__STM32F1__)
interrupts();
#else
sei();
#endif
if (steps == 4) val >>= 2;
if (steps == 2) val >>= 1;

View File

@@ -27,7 +27,7 @@
SdFs SD;
#if defined(__STM32F1__)
const size_t capacity = 2400;
const size_t capacity = 3000;
#elif defined(__ESP32__)
const size_t capacity = 4800; // since the ESP32 has more memory, we can do this
#else
@@ -94,6 +94,17 @@ void readConfig()
smuffConfig.endstopTrigger_X = jsonDoc[selector][endstopTrig];
smuffConfig.stepDelay_X = jsonDoc[selector][stepDelay];
smuffConfig.maxSpeedHS_X = jsonDoc[selector][maxSpeedHS];
smuffConfig.stepperPower[SELECTOR] = jsonDoc[selector]["Power"];
smuffConfig.stepperMode[SELECTOR] = jsonDoc[selector]["Mode"];
smuffConfig.stepperRSense[SELECTOR] = jsonDoc[selector]["RSense"];
smuffConfig.stepperMicrosteps[SELECTOR] = jsonDoc[selector]["Microsteps"];
smuffConfig.stepperStall[SELECTOR] = jsonDoc[selector]["Stall"];
smuffConfig.stepperCSmin[SELECTOR] = jsonDoc[selector]["CoolStepMin"];
smuffConfig.stepperCSmax[SELECTOR] = jsonDoc[selector]["CoolStepMax"];
smuffConfig.stepperCSdown[SELECTOR] = jsonDoc[selector]["CoolStepDown"];
smuffConfig.stepperAddr[SELECTOR] = jsonDoc[selector]["DriverAddress"];
smuffConfig.stepperToff[SELECTOR] = jsonDoc[selector]["TOff"];
smuffConfig.stepsPerRevolution_Y= jsonDoc[revolver]["StepsPerRevolution"];
smuffConfig.firstRevolverOffset = jsonDoc[revolver]["Offset"];
smuffConfig.revolverSpacing = smuffConfig.stepsPerRevolution_Y / 10;
@@ -111,6 +122,16 @@ void readConfig()
smuffConfig.revolverOnPos = jsonDoc[revolver]["ServoOnPos"];
smuffConfig.servoCycles1 = jsonDoc[revolver]["Servo1Cycles"];
smuffConfig.servoCycles2 = jsonDoc[revolver]["Servo2Cycles"];
smuffConfig.stepperPower[REVOLVER] = jsonDoc[revolver]["Power"];
smuffConfig.stepperMode[REVOLVER] = jsonDoc[revolver]["Mode"];
smuffConfig.stepperRSense[REVOLVER] = jsonDoc[revolver]["RSense"];
smuffConfig.stepperMicrosteps[REVOLVER] = jsonDoc[revolver]["Microsteps"];
smuffConfig.stepperStall[REVOLVER] = jsonDoc[revolver]["Stall"];
smuffConfig.stepperCSmin[REVOLVER] = jsonDoc[revolver]["CoolStepMin"];
smuffConfig.stepperCSmax[REVOLVER] = jsonDoc[revolver]["CoolStepMax"];
smuffConfig.stepperCSdown[REVOLVER] = jsonDoc[revolver]["CoolStepDown"];
smuffConfig.stepperAddr[REVOLVER] = jsonDoc[revolver]["DriverAddress"];
smuffConfig.stepperToff[REVOLVER] = jsonDoc[revolver]["TOff"];
smuffConfig.externalControl_Z = jsonDoc[feeder]["ExternalControl"];
smuffConfig.stepsPerMM_Z = jsonDoc[feeder]["StepsPerMillimeter"];
@@ -135,24 +156,37 @@ void readConfig()
smuffConfig.insertLength = 5;
smuffConfig.maxSpeedHS_Z = jsonDoc[feeder][maxSpeedHS];
smuffConfig.useDuetLaser = jsonDoc[feeder]["DuetLaser"];
smuffConfig.isSharedStepper = jsonDoc[feeder]["SharedStepper"];
smuffConfig.stepperPower[FEEDER] = jsonDoc[feeder]["Power"];
smuffConfig.stepperMode[FEEDER] = jsonDoc[feeder]["Mode"];
smuffConfig.stepperRSense[FEEDER] = jsonDoc[feeder]["RSense"];
smuffConfig.stepperMicrosteps[FEEDER] = jsonDoc[feeder]["Microsteps"];
smuffConfig.stepperStall[FEEDER] = jsonDoc[feeder]["Stall"];
smuffConfig.stepperCSmin[FEEDER] = jsonDoc[feeder]["CoolStepMin"];
smuffConfig.stepperCSmax[FEEDER] = jsonDoc[feeder]["CoolStepMax"];
smuffConfig.stepperCSdown[FEEDER] = jsonDoc[feeder]["CoolStepDown"];
smuffConfig.stepperAddr[FEEDER] = jsonDoc[feeder]["DriverAddress"];
smuffConfig.stepperToff[FEEDER] = jsonDoc[feeder]["TOff"];
smuffConfig.sendPeriodicalStats = jsonDoc["SendPeriodicalStats"];
int contrast = jsonDoc["LCDContrast"];
smuffConfig.lcdContrast = (contrast >= MIN_CONTRAST && contrast <= MAX_CONTRAST) ? contrast : DSP_CONTRAST;
int backlightColor = jsonDoc["BacklightColor"];
smuffConfig.backlightColor = (backlightColor == 0 ? 7 : backlightColor); // set backlight color to white if not set
smuffConfig.encoderTickSound = jsonDoc["EncoderTicks"];
smuffConfig.bowdenLength = jsonDoc["BowdenLength"];
smuffConfig.selectorDistance = jsonDoc["SelectorDist"];
int i2cAdr = jsonDoc["I2CAddress"];
smuffConfig.i2cAddress = (i2cAdr > 0 && i2cAdr < 255) ? i2cAdr : I2C_SLAVE_ADDRESS;
smuffConfig.menuAutoClose = jsonDoc["MenuAutoClose"];
smuffConfig.delayBetweenPulses = jsonDoc["DelayBetweenPulses"];
smuffConfig.serial0Baudrate = jsonDoc["Serial0Baudrate"];
smuffConfig.serial1Baudrate = jsonDoc["Serial1Baudrate"];
smuffConfig.serial2Baudrate = jsonDoc["Serial2Baudrate"];
smuffConfig.serialDueBaudrate = jsonDoc["SerialDueBaudrate"];
smuffConfig.serial3Baudrate = jsonDoc["Serial3Baudrate"];
smuffConfig.fanSpeed = jsonDoc["FanSpeed"];
smuffConfig.powerSaveTimeout = jsonDoc["PowerSaveTimeout"];
smuffConfig.duetDirect = jsonDoc["Duet3DDirect"];
smuffConfig.sendActionCmds = jsonDoc["SendActionCmds"];
const char* p1 = jsonDoc["UnloadCommand"];
const char* p2 = jsonDoc["WipeSequence"];
if(p1 != NULL && strlen(p1) > 0) {
@@ -177,7 +211,6 @@ void readConfig()
smuffConfig.servoMinPwm = 550;
if(smuffConfig.servoMaxPwm == 0)
smuffConfig.servoMaxPwm = 2400;
smuffConfig.sendPeriodicalStats = jsonDoc["SendPeriodicalStats"];
// read materials if running on 32-Bit MCU
#if defined(__STM32F1__) || defined(__ESP32__)
@@ -234,9 +267,10 @@ bool writeConfig(Print* dumpTo)
}
}
JsonObject jsonObj = jsonDoc.to<JsonObject>();
jsonDoc["Serial0Baudrate"] = smuffConfig.serial0Baudrate;
jsonDoc["Serial1Baudrate"] = smuffConfig.serial1Baudrate;
jsonDoc["Serial2Baudrate"] = smuffConfig.serial2Baudrate;
jsonDoc["SerialDueBaudrate"] = smuffConfig.serialDueBaudrate;
jsonDoc["Serial3Baudrate"] = smuffConfig.serial3Baudrate;
jsonDoc["ToolCount"] = smuffConfig.toolCount;
jsonDoc["BowdenLength"] = smuffConfig.bowdenLength;
jsonDoc["SelectorDist"] = smuffConfig.selectorDistance;
@@ -244,9 +278,8 @@ bool writeConfig(Print* dumpTo)
jsonDoc["I2CAddress"] = smuffConfig.i2cAddress;
jsonDoc["MenuAutoClose"] = smuffConfig.menuAutoClose;
jsonDoc["FanSpeed"] = smuffConfig.fanSpeed;
jsonDoc["DelayBetweenPulses"] = smuffConfig.delayBetweenPulses;
jsonDoc["PowerSaveTimeout"] = smuffConfig.powerSaveTimeout;
jsonDoc["Duet3DDirect"] = smuffConfig.duetDirect;
jsonDoc["SendActionCmds"] = smuffConfig.sendActionCmds;
jsonDoc["EmulatePrusa"] = smuffConfig.prusaMMU2;
jsonDoc["UnloadCommand"] = smuffConfig.unloadCommand;
jsonDoc["HasPanelDue"] = smuffConfig.hasPanelDue;
@@ -255,6 +288,7 @@ bool writeConfig(Print* dumpTo)
jsonDoc["SendPeriodicalStats"] = smuffConfig.sendPeriodicalStats;
jsonDoc["WipeSequence"] = smuffConfig.wipeSequence;
jsonDoc["BacklightColor"] = smuffConfig.backlightColor;
jsonDoc["EncoderTicks"] = smuffConfig.encoderTickSound;
JsonObject node = jsonObj.createNestedObject("Selector");
@@ -267,6 +301,16 @@ bool writeConfig(Print* dumpTo)
node["Acceleration"] = smuffConfig.acceleration_X;
node["InvertDir"] = smuffConfig.invertDir_X;
node["EndstopTrigger"] = smuffConfig.endstopTrigger_X;
node["Power"] = smuffConfig.stepperPower[SELECTOR];
node["Mode"] = smuffConfig.stepperMode[SELECTOR];
node["RSense"] = smuffConfig.stepperRSense[SELECTOR];
node["Microsteps"] = smuffConfig.stepperMicrosteps[SELECTOR];
node["Stall"] = smuffConfig.stepperStall[SELECTOR];
node["CoolStepMin"] = smuffConfig.stepperCSmin[SELECTOR];
node["CoolStepMax"] = smuffConfig.stepperCSmax[SELECTOR];
node["CoolStepDown"] = smuffConfig.stepperCSdown[SELECTOR];
node["DriverAddress"] = smuffConfig.stepperAddr[SELECTOR];
node["TOff"] = smuffConfig.stepperToff[SELECTOR];
node = jsonObj.createNestedObject("Revolver");
node["Offset"] = smuffConfig.firstRevolverOffset;
@@ -285,6 +329,16 @@ bool writeConfig(Print* dumpTo)
node["ServoOnPos"] = smuffConfig.revolverOnPos;
node["Servo1Cycles"] = smuffConfig.servoCycles1;
node["Servo2Cycles"] = smuffConfig.servoCycles2;
node["Power"] = smuffConfig.stepperPower[REVOLVER];
node["Mode"] = smuffConfig.stepperMode[REVOLVER];
node["RSense"] = smuffConfig.stepperRSense[REVOLVER];
node["Microsteps"] = smuffConfig.stepperMicrosteps[REVOLVER];
node["Stall"] = smuffConfig.stepperStall[REVOLVER];
node["CoolStepMin"] = smuffConfig.stepperCSmin[REVOLVER];
node["CoolStepMax"] = smuffConfig.stepperCSmax[REVOLVER];
node["CoolStepDown"] = smuffConfig.stepperCSdown[REVOLVER];
node["DriverAddress"] = smuffConfig.stepperAddr[REVOLVER];
node["TOff"] = smuffConfig.stepperToff[REVOLVER];
node = jsonObj.createNestedObject("Feeder");
node["ExternalControl"] = smuffConfig.externalControl_Z;
@@ -305,6 +359,18 @@ bool writeConfig(Print* dumpTo)
node["EnableChunks"] = smuffConfig.enableChunks;
node["FeedChunks"] = smuffConfig.feedChunks;
node["InsertLength"] = smuffConfig.insertLength;
node["DuetLaser"] = smuffConfig.useDuetLaser;
node["SharedStepper"] = smuffConfig.isSharedStepper;
node["Power"] = smuffConfig.stepperPower[FEEDER];
node["Mode"] = smuffConfig.stepperMode[FEEDER];
node["RSense"] = smuffConfig.stepperRSense[FEEDER];
node["Microsteps"] = smuffConfig.stepperMicrosteps[FEEDER];
node["Stall"] = smuffConfig.stepperStall[FEEDER];
node["CoolStepMin"] = smuffConfig.stepperCSmin[FEEDER];
node["CoolStepMax"] = smuffConfig.stepperCSmax[FEEDER];
node["CoolStepDown"] = smuffConfig.stepperCSdown[FEEDER];
node["DriverAddress"] = smuffConfig.stepperAddr[FEEDER];
node["TOff"] = smuffConfig.stepperToff[FEEDER];
#if defined(__STM32F1__) || defined(__ESP32__)
node = jsonObj.createNestedObject("Materials");

View File

@@ -92,4 +92,23 @@ void recoverStore() {
cfg.close();
}
}
}
void readTune() {
#if defined(__ESP32__)
if (SD.begin(SDCS_PIN, SD_SCK_MHZ(4))) {
#else
if (SD.begin()) {
#endif
FsFile tune;
if (!tune.open(TUNE_FILE)){
__debug(PSTR("Tune file '%s' not found!\n"), TUNE_FILE);
}
else {
String tmp = tune.readString();
if(tmp.length() > 0)
tuneSequence = tmp;
tune.close();
}
}
}

View File

@@ -21,11 +21,33 @@
extern void __debug(const char* fmt, ...);
/* ==============================================================================================================================
Duet3D laser Sensor Protocol (according to the Duet3D Wiki)
P = partity bit
==============================================================================================================================
v1 Data word P00S 00pp pppp pppp S = switch open, pppppppppp = 10-bit filament position (50 counts/mm)
v1 Error word P010 0000 0000 0000
v1 Quality word P10s ssss bbbb bbbb sssss = shutter, bbbbbbbb = brightness
void DuetLaserSensor::attach(int pin) {
v2 Data word P00S 1ppp pppp pppp S = switch open, ppppppppppp = 11-bit filament position (100 counts/mm)
v2 Error word P010 0000 0000 eeee eeee = error code, will not be zero
v2 Version word P110 0000 vvvv vvvv vvvvvvvv = sensor/firmware version, at least 2
v2 Image quality word P110 0001 qqqq qqqq qqqqqqqq = image quality
v2 Brightness word P110 0010 bbbb bbbb bbbbbbbb = brightness
v2 Shutter word P110 0011 ssss ssss ssssssss = shutter
============================================================================================================================== */
void DuetLaserSensor::attach(int pin, bool v1) {
_pin = pin;
_isV1 = v1;
pinMode(_pin, INPUT);
reset();
resetPosition();
}
void DuetLaserSensor::resetPosition() {
_position = 0;
_positionMM = 0;
}
void DuetLaserSensor::reset() {
@@ -34,19 +56,34 @@ void DuetLaserSensor::reset() {
_bitCnt = 0;
_dataCnt = 0;
_data = 0;
_lastBit = -1;
_lastBits = String(_bits);
_lastStuff = String(_stuff);
_bits = "";
_stuff = "";
resetBits();
}
/* Method which reads out the Duet3D laser Sensor.
This service method must be called once each milisecond.
The data is being transmitted from the sensor in the following format:
Idle state: the line must be be at 0 for at least 8 bit times
Start bits: 1 followed by 0
Data bits 15, 14, 13, 12
Stuffing bit (inverse of bit 12)
Data bits 11,10,9,8
Stuffing bit (inverse of bit 8)
Data bits 7,6,5,4
Stuffing bit (inverse of bit 4)
Data bits 3,2,1,0
Stuffing bit (inverse of bit 0)
After the last stuffing bit, the line returns to 0 until the next start bit.
*/
void DuetLaserSensor::service() {
if(_pin == -1)
return;
volatile int _b = digitalRead(_pin);
// wait for idle to be signaled (=8 bits low)
if(!_gotIdle) {
_state = 0x8000;
_state = STATE_INIT;
if(_b == LOW) {
_bitCnt++;
}
@@ -54,21 +91,24 @@ void DuetLaserSensor::service() {
if(_bitCnt >= 8) {
_gotIdle = true;
_bitCnt = 0;
_state = STATE_IDLE;
}
else {
reset();
}
}
}
// wait for startbits
if(_gotIdle && !_gotStartbit) {
_state = 0x8001;
if(_b == HIGH && _bitCnt == 0) {
_bitCnt++;
_state = STATE_WAIT_START;
}
else if(_b == LOW && _bitCnt == 1) {
_state = 0x8002;
_state = STATE_GOT_START;
_gotStartbit = true;
_bitCnt = 19;
_pbitCnt = 0;
_dataCnt = 15;
return;
}
@@ -77,96 +117,105 @@ void DuetLaserSensor::service() {
return;
}
}
// read data bits
if(_gotIdle && _gotStartbit) {
_state = 0x8003;
_bits += _bitCnt%5==0 ? " " : (_b ? "1" : "0");
_state = STATE_READING_DATA;
/* FOR DEBUGGING ONLY
_bits += _bitCnt%5==0 ? " " : (_b ? "1" : "0");
_stuff += _bitCnt%5==0 ? (_b ? "1" : "0") : " ";
*/
if(_bitCnt%5!=0) {
_data |= (_b<<_dataCnt);
_dataCnt--;
_pbitCnt += _b ? 1 : 0; // count all '1's for parity check
}
_bitCnt--;
if(_bitCnt == -1) {
// all bits read
/*
volatile int v[4];
int idx;
int n;
for(idx = 0, n=0; idx < 20; idx += 5, n++) {
const char* p = _bits.substring(idx, idx+4).c_str();
v[n] = strtol(p, NULL, 2);
}
unsigned dataWord = (v[0] << 12) | (v[1] << 8) | (v[2] << 4) | v[3];
if(_data != dataWord)
_state = 0x9000;
else {
*/
_isValid = false;
if(_data > 0) {
_state = 0x8005;
uint8_t data8 = (uint8_t)((_data >> 8) ^ _data);
data8 ^= (data8 >> 4);
data8 ^= (data8 >> 2);
data8 ^= (data8 >> 1);
if ((data8 & 1) != 0)
{
_error = 0x8000;
_state = 0x8006;
reset();
}
else {
_state = 0x8007;
_isValid = true;
int cmd = (_data & 0x6000)>>13;
switch(cmd) {
case 0:
_state = 0x8008;
_switch = (_data & 0x1000) == 0;
_positionMM = _isV1 ? (double)((_data & 0x03ff)) * 0.02f : (double)((_data & 0x07ff)) *0.01f;
_position = _isV1 ? (_data & 0x03ff) : (_data & 0x07ff);
break;
case 1:
_state = 0x8009;
_error = _data & 0x0f;
break;
case 2:
_state = 0x800A;
_isV1 = true;
_isValid = false;
if(_data > 0) {
_state = STATE_GOT_ALL_BITS;
_error = E_NONE;
// check parity
if (_pbitCnt % 2 != (uint8_t)(_data & 0x8000) >> 15)
{
_error = E_WRONG_PARITY;
_state = STATE_PARITY_ERROR;
reset();
}
else {
_state = STATE_PARITY_OK;
int cmd = (_data & 0x6000)>>13;
switch(cmd) {
case 0: {
_state = STATE_GOT_POSITION;
_switch = (_data & 0x1000) == 0;
_prevpos = _position;
int32_t pos = _isV1 ? (_data & 0x03ff) : (_data & 0x07ff);
if(pos == _prevpos) {
_dir = DIR_NONE;
}
else if(pos < _prevpos) {
_dir = (pos - _prevpos < 0) ? DIR_RETRACT : DIR_EXTRUDE;
}
else if(pos > _prevpos) {
_dir = (pos - _prevpos > 0) ? DIR_EXTRUDE : DIR_RETRACT;
}
_position = pos;
_positionMM = _isV1 ? (double)_position * 0.02f : (double)_position * 0.01f;
_hasMoved = _prevpos != _position;
}
break;
case 1:
_state = STATE_GOT_ERROR_MSG;
_sensorError = _data & 0x0f;
break;
case 2:
if(_isV1) {
_state = STATE_GOT_QUALITY_V1;
_version = 1;
_shutter = (_data & 0x1f00) >> 8;
_brightness = (_data & 0x00ff);
break;
case 3:
{
_state = 0x800B;
int opt = (_data & 0x0f00) >> 8;
switch(opt) {
case 0:
_version = _data & 0xff;
break;
case 1:
_quality = _data & 0xff;
break;
case 2:
_brightness = _data & 0xff;
break;
case 3:
_shutter = _data & 0xff;
break;
default:
_error = 0x8001;
break;
}
}
else {
_state = STATE_INVALID;
_error = E_INVALID_VERSION;
}
break;
case 3:
{
_state = STATE_GOT_QUALITY_V2;
_error = E_NONE;
int opt = (_data & 0x0f00) >> 8;
switch(opt) {
case 0:
_version = _data & 0xff;
break;
case 1:
_quality = _data & 0xff;
break;
case 2:
_brightness = _data & 0xff;
break;
case 3:
_shutter = _data & 0xff;
break;
default:
_error = E_INVALID_QUALITY;
break;
}
break;
default:
_state = 0x800C;
_error = 0x8002;
break;
}
}
break;
default:
_state = STATE_INVALID;
_error = E_INVALID_DATA;
break;
}
if(_error == E_NONE)
_isValid = true;
}
//}
}
reset();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -45,9 +45,8 @@ void getEncoderButton(int* turn, int* button, bool* isHeld, bool* isClicked) {
}
}
bool showInputDialog(const char* title, const char* PROGMEM message, float* val, float min, float max, fCallback cb) {
bool showInputDialog(const char* title, const char* PROGMEM message, float* val, float min, float max, fCallback cb, float increment) {
bool stat = true;
float steps = 1.0F;
int turn, btn;
bool isHeld, isClicked;
@@ -65,7 +64,7 @@ bool showInputDialog(const char* title, const char* PROGMEM message, float* val,
break;
}
if(turn != 0) {
*val += steps*turn;
*val += increment*turn;
if(turn < 0) {
if(*val < min) {
*val = min;
@@ -88,11 +87,17 @@ bool showInputDialog(const char* title, const char* PROGMEM message, float* val,
return stat;
}
bool showInputDialog(const char* title, const char* PROGMEM message, int* val, int min, int max, iCallback cb) {
bool showInputDialog(const char* title, const char* PROGMEM message, int* val, int min, int max, iCallback cb, int increment) {
bool stat = true;
int turn, btn;
bool isHeld, isClicked;
if(cb == NULL && (min==0 && max==1)) {
// if there's no callback set, and min, max equals 0,1 don't show the dialog
// just return the inverted value (used for HI / LO)
*val = (*val==min ? max : min);
return true;
}
debounceButton();
encoder.setAccelerationEnabled(true);
drawValue(title, message, String(*val));
@@ -107,7 +112,7 @@ bool showInputDialog(const char* title, const char* PROGMEM message, int* val, i
break;
}
if(turn != 0) {
*val += turn;
*val += (turn*increment);
if(turn < 0) {
if(*val < min) {
*val = min;
@@ -135,8 +140,14 @@ bool showInputDialog(const char* title, const char* PROGMEM message, bool* val,
bool stat = true;
int turn, btn;
bool isHeld, isClicked;
char _yes[10], _no[10];
char _yes[5], _no[5];
if(cb == NULL) {
// if there's no callback set, don't show the dialog
// just return the inverted value
*val = !*val;
return true;
}
sprintf_P(_yes, P_Yes);
sprintf_P(_no, P_No);
@@ -177,17 +188,17 @@ bool showInputDialog(const char* title, const char* PROGMEM message, int* val, S
if(lineCnt==0)
return false;
for(int i=0; i< lineCnt; i++) {
if(valIsIndex) {
opt = *val;
}
else {
if(String(options[i]) == String(*val)) {
opt = i;
//__debug(PSTR("Current selection: %s"), options[i]);
for(int i=0; i< lineCnt; i++) {
if(String(options[i]) == String(*val)) {
opt = i;
//__debug(PSTR("Current selection: %s"), options[i]);
}
}
}
}
drawValue(title, message, String(options[opt]));
while(1) {
@@ -228,7 +239,7 @@ bool showInputDialog(const char* title, const char* PROGMEM message, unsigned lo
char* options[10];
debounceButton();
int lineCnt = splitStringLines(options, (int)(sizeof(options)/sizeof(options[0])), list.c_str());
int lineCnt = splitStringLines(options, (int)ArraySize(options), list.c_str());
if(lineCnt==0)
return false;

View File

@@ -17,11 +17,13 @@
*
*/
#include "SMuFF.h"
#include "Config.h"
#include "FastLED.h"
CRGB leds[NUM_LEDS];
#if !defined(USE_FASTLED_BACKLIGHT)
static CRGB ColorsFastLED[8];
#else
static CRGB ColorsFastLED[8] = { CRGB::Black, CRGB::Red, CRGB::Green, CRGB::Blue, CRGB::Cyan, CRGB::Magenta, CRGB::Yellow, CRGB::White };
#endif
// old function - meant to simulate beeps with
// different colors
@@ -61,50 +63,60 @@ void setBacklightRGB(byte R, byte G, byte B) {
void setBacklightRGB(int color) {
#if defined(RGB_LED_R_PIN)
pinMode(RGB_LED_R_PIN, OUTPUT);
digitalWrite(RGB_LED_R_PIN, color & 1);
pinMode(RGB_LED_R_PIN, OUTPUT);
digitalWrite(RGB_LED_R_PIN, color & 1);
#endif
#if defined(RGB_LED_G_PIN)
pinMode(RGB_LED_G_PIN, OUTPUT);
digitalWrite(RGB_LED_G_PIN, color & 2);
pinMode(RGB_LED_G_PIN, OUTPUT);
digitalWrite(RGB_LED_G_PIN, color & 2);
#endif
#if defined(RGB_LED_B_PIN)
pinMode(RGB_LED_B_PIN, OUTPUT);
digitalWrite(RGB_LED_B_PIN, color & 4);
pinMode(RGB_LED_B_PIN, OUTPUT);
digitalWrite(RGB_LED_B_PIN, color & 4);
#endif
}
void setBacklightCRGB(CRGB color) {
#if defined(USE_FASTLED_BACKLIGHT)
FastLED.showColor(color);
#endif
}
void setFastLED(int index, CRGB color) {
leds[index] = color;
FastLED.show();
#if defined(USE_FASTLED_BACKLIGHT)
leds[index] = color;
FastLED.show();
#endif
}
void setFastLEDIndex(int index, int color) {
#if defined(USE_FASTLED_BACKLIGHT)
leds[index] = ColorsFastLED[color];
FastLED.show();
#endif
}
void setFastLEDIntensity(int intensity) {
#if defined(USE_FASTLED_BACKLIGHT)
FastLED.setBrightness(intensity);
#endif
}
void setBacklightIndex(int color) {
#if defined(USE_RGB_BACKLIGHT)
setBacklightRGB(color);
#else
#elif defined(USE_FASTLED_BACKLIGHT)
setBacklightCRGB(ColorsFastLED[color]);
#endif
}
void testFastLED() {
#if defined(USE_FASTLED_BACKLIGHT)
for(int i=0; i< NUM_LEDS; i++) {
leds[i] = ColorsFastLED[1];
FastLED.show();
delay(250);
leds[i] = ColorsFastLED[0];
}
#endif
}

File diff suppressed because it is too large Load Diff

122
src/Periodicals.cpp Normal file
View File

@@ -0,0 +1,122 @@
/**
* SMuFF Firmware
* Copyright (C) 2019 Technik Gegg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "SMuFF.h"
volatile bool interval10ms; // set each time when function is called; reset yourself if needed
volatile bool interval20ms;
volatile bool interval50ms;
volatile bool interval100ms;
volatile bool interval250ms;
volatile bool interval500ms;
volatile bool interval1s;
volatile bool interval2s;
volatile bool interval5s;
static volatile uint32_t last10ms;
static volatile uint32_t last20ms;
static volatile uint32_t last50ms;
static volatile uint32_t last100ms;
static volatile uint32_t last250ms;
static volatile uint32_t last500ms;
static volatile uint32_t last1s;
static volatile uint32_t last2s;
static volatile uint32_t last5s;
void every10ms() {
if(millis()-last10ms < 10)
return;
last10ms = millis();
interval10ms = true;
// Add your periodical code here
}
void every20ms() {
if(millis()-last20ms < 20)
return;
last20ms = millis();
interval20ms = true;
// Add your periodical code here
}
void every50ms() {
if(millis()-last50ms < 50)
return;
last50ms = millis();
interval50ms = true;
// Add your periodical code here
}
void every100ms() {
if(millis()-last100ms < 100)
return;
last100ms = millis();
interval100ms = true;
// Add your periodical code here
}
void every250ms() {
if(millis()-last250ms < 250)
return;
last250ms = millis();
interval250ms = true;
// Add your periodical code here
}
void every500ms() {
if(millis()-last500ms < 500)
return;
last500ms = millis();
interval500ms = true;
// Add your periodical code here
}
void every1s() {
if(millis()-last1s < 1000)
return;
last1s = millis();
interval1s = true;
// Add your periodical code here
}
void every2s() {
if(millis()-last2s < 2000)
return;
last2s = millis();
interval2s = true;
if(parserBusy || sendingResponse) {
__debug(PSTR("Parser busy: %s Sending Response: %s"), parserBusy ? P_Yes : P_No, sendingResponse ? P_Yes : P_No);
}
// send status of endstops and current tool to all listeners, if configured
if(!sendingResponse && smuffConfig.sendPeriodicalStats && enablePeriStat && !parserBusy) {
printPeriodicalState(0);
if(CAN_USE_SERIAL1) printPeriodicalState(1);
if(CAN_USE_SERIAL2 && smuffConfig.hasPanelDue != 2) printPeriodicalState(2);
if(CAN_USE_SERIAL3 && smuffConfig.hasPanelDue != 3) printPeriodicalState(3);
}
// Add your periodical code here
}
void every5s() {
if(millis()-last5s < 5000)
return;
last5s = millis();
interval5s = true;
// Add your periodical code here
}

File diff suppressed because it is too large Load Diff

View File

@@ -25,17 +25,14 @@
#include "SMuFF.h"
#include "SMuFFBitmaps.h"
#include "Config.h"
#include "ZTimerLib.h"
#include "ZStepperLib.h"
#include "ZServo.h"
#ifdef __ESP32__
extern BluetoothSerial SerialBT;
#endif
#ifdef __STM32F1__
#include "libmaple/libmaple.h"
SPIClass SPI_3(3);
//#include "libmaple/libmaple.h"
//SPIClass SPI_3(3);
#define _tone(pin, freq, duration) playTone(pin, freq, duration)
#define _noTone(pin) muteTone(pin)
#elif defined (__ESP32__)
@@ -65,10 +62,22 @@ int swapTools[MAX_TOOLS];
bool isWarning;
unsigned long feederErrors = 0;
bool ignoreHoming = false;
String tuneSequence = "F440D120P150.F523D120P80.F196D220P80.F196D120P80.F587D400P120.F349D80P240.F349D80P160.";
// the "old" tune
//String tuneSequence = "F1760D90.F1975D90.F2093D90.F1975D90.F1760D200P50.";
const char brand[] = VERSION_STRING;
void setupDisplay() {
// The next code line (display.setI2CAddress) changes the address for your TWI_DISPLAY if it's
// configured differently.
// Usually, thoses displays are pre-configured at I2C address 0x78, which equals to 0x3c
// from the software side because of the 7-Bit address mode.
// If it's configured at 0x7a, you need to change the I2C_DISPLAY_ADDRESS in Config.h to 0x3d.
#if I2C_DISPLAY_ADDRESS != 0x3C
display.setI2CAddress(I2C_DISPLAY_ADDRESS);
#endif
display.begin(/*Select=*/ ENCODER_BUTTON_PIN, /* menu_next_pin= */ U8X8_PIN_NONE, /* menu_prev_pin= */ U8X8_PIN_NONE, /* menu_home_pin= */ U8X8_PIN_NONE);
display.enableUTF8Print();
resetDisplay();
@@ -107,7 +116,9 @@ void drawStatus() {
#ifdef __AVR__
sprintf_P(tmp, PSTR("M:%d | %-4s | %-5s "), freeMemory(), traceSerial2.c_str(), _wait);
#else
sprintf_P(tmp, PSTR("%-4s| %-4s | %-5s "), String(steppers[FEEDER].getStepsTakenMM()).c_str(), traceSerial2.c_str(), _wait);
String pos = String(steppers[FEEDER].getStepsTakenMM());
//String pos = String(lastDuetPos);
sprintf_P(tmp, PSTR("%-7s| %-4s | %-4s "), pos.c_str(), smuffConfig.externalStepper ? P_External : P_Internal, _wait);
#endif
display.drawStr(1, display.getDisplayHeight(), tmp);
display.setFontMode(0);
@@ -129,8 +140,15 @@ void drawFeed() {
display.setFont(SMALL_FONT);
display.setFontMode(0);
display.setDrawColor(0);
display.drawBox(0, display.getDisplayHeight()-display.getMaxCharHeight()+2, 40, display.getMaxCharHeight());
display.drawStr(1, display.getDisplayHeight(), tmp);
int x = 0;
int y = display.getDisplayHeight()-display.getMaxCharHeight() + 2;
int w = 40;
int h = display.getMaxCharHeight();
display.drawBox(x, y, w, h);
display.drawStr(x+1, display.getDisplayHeight(), tmp);
display.sendBuffer();
//display.updateDisplayArea(x, y, w, h);
#else
display.setFont(STATUS_FONT);
display.setFontMode(0);
@@ -141,6 +159,125 @@ void drawFeed() {
#endif
}
int duetTurn = 0;
void drawSymbolCallback() {
uint16_t symbols[] = { 0x25ef, 0x25d0, 0x25d3, 0x25d1, 0x25d2 };
if(duetLS.isMoving()) {
if(++duetTurn > 4)
duetTurn = 1;
}
else {
duetTurn = 0;
}
display.setFont(SYMBOL_FONT);
display.drawGlyph(118, 10, symbols[duetTurn]);
}
void showDuetLS() {
char _msg[128];
char _addData[15];
char _dir[3];
bool extStepper = smuffConfig.externalStepper;
switchFeederStepper(INTERNAL);
debounceButton();
encoder.setAccelerationEnabled(true);
while(1) {
if(encoder.getButton() == ClickEncoder::Clicked)
break;
// if the encoder knob is being turned, extrude / retract filament by the value defined
switch(encoder.getValue()) {
case -1: moveFeeder(-0.25); break;
case 1: moveFeeder( 0.25); break;
case -2: moveFeeder(-0.50); break;
case 2: moveFeeder( 0.50); break;
case -3: moveFeeder(-1.00); break;
case 3: moveFeeder( 1.00); break;
case -4: moveFeeder(-2.00); break;
case 4: moveFeeder( 2.00); break;
case -5: moveFeeder(-5.00); break;
case 5: moveFeeder( 5.00); break;
default: break;
}
uint8_t err = duetLS.getSensorError();
if(err != 0)
sprintf_P(_addData, PSTR("%4s/%04x"), err==E_SENSOR_INIT ? "INIT" : err==E_SENSOR_VCC ? "VCC" : String(err).c_str(), duetLS.getError());
else {
if(!duetLS.isValid())
sprintf_P(_addData, PSTR("-invalid-"));
else
sprintf_P(_addData, PSTR("none/%04x"), duetLS.getError());
}
switch(duetLS.getDirection()) {
case DIR_NONE: sprintf(_dir," "); break;
case DIR_EXTRUDE: sprintf(_dir, "<<"); break;
case DIR_RETRACT: sprintf(_dir, ">>"); break;
}
sprintf_P(_msg, P_DuetLSData, _dir, String(duetLS.getPositionMM()).c_str(), duetLS.getQuality(), duetLS.getBrightness(), duetLS.getShutter(), duetLS.getSwitch() ? P_On : P_Off, _addData, duetLS.getVersion());
drawUserMessage(_msg, true, false, drawSymbolCallback);
delay(100);
}
if(extStepper)
switchFeederStepper(EXTERNAL);
}
TMC2209Stepper* showDriver = NULL;
void drawStallCallback() {
uint16_t symbols[] = { 0x0020, 0x21af, 0x0020, 0x21a0 };
if(showDriver == NULL)
return;
bool stat = showDriver->diag();
display.setFont(SYMBOL_FONT);
display.drawGlyph(50, 8, symbols[stat]);
stat = showDriver->SG_RESULT() > showDriver->SGTHRS();
display.drawGlyph(61, 8, symbols[stat+2]);
}
void showTMCStatus(int axis) {
char _msg[256];
debounceButton();
encoder.setAccelerationEnabled(true);
switch(axis) {
case SELECTOR:
showDriver = driverX;
break;
case REVOLVER:
showDriver = driverY;
break;
case FEEDER:
showDriver = driverZ;
break;
}
if(showDriver == NULL) {
debounceButton();
drawUserMessage(P_StepperNotCfg);
delay(3000);
return;
}
steppers[axis].setEnabled(true);
displayingUserMessage = true;
while(1) {
checkSerialPending();
if(encoder.getButton() == ClickEncoder::Clicked)
break;
sprintf_P(_msg, P_TMC_Status,
showDriver->stealth() ? P_Stealth : P_Spread,
showDriver->rms_current(),
showDriver->ola() ? P_Yes : P_No,
showDriver->olb() ? P_Yes : P_No,
showDriver->s2ga() ? P_Yes : P_No,
showDriver->s2gb() ? P_Yes : P_No,
showDriver->ot() ? P_Yes : P_No);
drawUserMessage(_msg, true, false, drawStallCallback);
delay(100);
}
displayingUserMessage = false;
}
void resetDisplay() {
display.clearDisplay();
display.setFont(BASE_FONT);
@@ -151,6 +288,9 @@ void resetDisplay() {
void drawSelectingMessage(int tool) {
char _sel[128];
char _wait[128];
if(displayingUserMessage) // don't show if something else is being displayed
return;
display.firstPage();
do {
resetDisplay();
@@ -208,10 +348,10 @@ int splitStringLines(char* lines[], int maxLines, const char* message) {
return cnt;
}
void drawUserMessage(String message) {
void drawUserMessage(String message, bool smallFont /* = false */, bool center /* = true */, void (*drawCallbackFunc)() /* = null */) {
char* lines[6];
int lineCnt = splitStringLines(lines, (int)(sizeof(lines)/sizeof(lines[0])), message.c_str());
char* lines[8];
int lineCnt = splitStringLines(lines, (int)ArraySize(lines), message.c_str());
if(isPwrSave) {
setPwrSave(0);
@@ -222,12 +362,13 @@ void drawUserMessage(String message) {
display.drawFrame(0, 0, display.getDisplayWidth(), display.getDisplayHeight());
display.firstPage();
do {
display.setFont(BASE_FONT_BIG);
display.setFont(smallFont ? BASE_FONT : BASE_FONT_BIG);
int y = (display.getDisplayHeight()-(lineCnt-1)*display.getMaxCharHeight())/2;
display.firstPage();
do {
for(int i=0; i< lineCnt; i++) {
display.drawStr((display.getDisplayWidth() - display.getStrWidth(lines[i]))/2, y, lines[i]);
int x = center ? (display.getDisplayWidth() - display.getStrWidth(lines[i]))/2 : 0;
display.drawStr(x, y, lines[i]);
if(i==0) {
if(lineCnt > 1 && strcmp(lines[1]," ")==0) {
display.drawHLine(0, y+3, display.getDisplayWidth());
@@ -236,6 +377,8 @@ void drawUserMessage(String message) {
y += display.getMaxCharHeight();
}
} while(display.nextPage());
if(drawCallbackFunc != NULL)
drawCallbackFunc();
display.setFont(BASE_FONT);
} while(display.nextPage());
displayingUserMessage = true;
@@ -300,6 +443,8 @@ uint8_t u8x8_GetMenuEvent(u8x8_t *u8x8)
else {
if (turn != 0) {
resetAutoClose();
if(smuffConfig.encoderTickSound)
encoderBeep(1);
switch (turn)
{
case 1:
@@ -569,11 +714,20 @@ bool moveHome(int index, bool showMessage, bool checkFeeder) {
}
}
}
if(index != FEEDER && smuffConfig.revolverIsServo) {
setServoPos(1, smuffConfig.revolverOffPos);
if(smuffConfig.revolverIsServo) {
//__debug(PSTR("Stepper home SERVO variant"));
// don't release the servo when homing the Feeder but
// release it when homing something else
if(index != FEEDER)
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
// Revolver isn't being used on a servo variant
if(index != REVOLVER)
steppers[index].home();
}
if(index != REVOLVER && smuffConfig.revolverIsServo) {
steppers[index].home();
else {
//__debug(PSTR("Stepper home non SERVO variant"));
// not a servo variant, home stepper which ever it is
steppers[index].home();
}
//__debug(PSTR("DONE Stepper home"));
@@ -673,19 +827,44 @@ void signalNoTool() {
drawUserMessage(_msg1);
}
void switchFeederStepper(int stepper) {
if(RELAIS_PIN != -1) {
if(stepper == EXTERNAL) {
steppers[FEEDER].setEnabled(false);
digitalWrite(RELAIS_PIN, 0);
smuffConfig.externalStepper = true;
}
else if(stepper == INTERNAL) {
digitalWrite(RELAIS_PIN, 1);
smuffConfig.externalStepper = false;
}
// gain the relay some time to debounce
delay(50);
}
}
void moveFeeder(float distanceMM) {
steppers[FEEDER].setEnabled(true);
unsigned int curSpeed = steppers[FEEDER].getMaxSpeed();
steppers[FEEDER].setMaxSpeed(smuffConfig.insertSpeed_Z);
prepSteppingRelMillimeter(FEEDER, distanceMM, true);
runAndWait(FEEDER);
steppers[FEEDER].setMaxSpeed(curSpeed);
}
void positionRevolver() {
// disable Feeder temporarily
steppers[FEEDER].setEnabled(false);
if(smuffConfig.resetBeforeFeed_Y && !ignoreHoming) {
if(smuffConfig.revolverIsServo) {
setServoPos(1, smuffConfig.revolverOffPos);
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
else
moveHome(REVOLVER, false, false);
}
if(smuffConfig.revolverIsServo) {
setServoPos(1, smuffConfig.revolverOnPos);
setServoPos(SERVO_LID, smuffConfig.revolverOnPos);
steppers[FEEDER].setEnabled(true);
return;
}
@@ -801,7 +980,7 @@ bool feedToEndstop(bool showMessage) {
repositionSelector(true);
}
if(smuffConfig.revolverIsServo)
setServoPos(1, smuffConfig.revolverOnPos);
setServoPos(SERVO_LID, smuffConfig.revolverOnPos);
n = 0;
}
if (retry < 0) {
@@ -810,7 +989,7 @@ bool feedToEndstop(bool showMessage) {
moveHome(REVOLVER, false, false); // home Revolver
M18("M18", "", 0); // turn all motors off
if(smuffConfig.revolverIsServo) { // release servo, if used
setServoPos(1, smuffConfig.revolverOffPos);
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
if(showFeederFailedMessage(1) == true) { // user wants to retry...
steppers[FEEDER].setEnabled(true);
@@ -866,11 +1045,14 @@ bool loadFilament(bool showMessage) {
signalNoTool();
return false;
}
if(smuffConfig.externalControl_Z) {
if(smuffConfig.externalControl_Z && !smuffConfig.isSharedStepper) {
positionRevolver();
signalLoadFilament();
return true;
}
if(smuffConfig.externalControl_Z && smuffConfig.isSharedStepper) {
switchFeederStepper(INTERNAL);
}
parserBusy = true;
unsigned int curSpeed = steppers[FEEDER].getMaxSpeed();
@@ -894,7 +1076,7 @@ bool loadFilament(bool showMessage) {
if(smuffConfig.homeAfterFeed) {
if(smuffConfig.revolverIsServo) {
setServoPos(1, smuffConfig.revolverOffPos);
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
else
steppers[REVOLVER].home();
@@ -902,6 +1084,10 @@ bool loadFilament(bool showMessage) {
bool wasAborted = steppers[FEEDER].getAbort();
steppers[FEEDER].setAbort(false);
if(smuffConfig.externalControl_Z && smuffConfig.isSharedStepper) {
switchFeederStepper(EXTERNAL);
}
parserBusy = false;
return true; //aborted ? false : true;
}
@@ -916,11 +1102,15 @@ bool loadFilamentPMMU2(bool showMessage) {
signalNoTool();
return false;
}
if(smuffConfig.externalControl_Z) {
if(smuffConfig.externalControl_Z && !smuffConfig.isSharedStepper) {
positionRevolver();
signalLoadFilament();
return true;
}
if(smuffConfig.externalControl_Z && smuffConfig.isSharedStepper) {
switchFeederStepper(INTERNAL);
}
parserBusy = true;
unsigned int curSpeed = steppers[FEEDER].getMaxSpeed();
// move filament until it hits the feeder endstop
@@ -948,13 +1138,17 @@ bool loadFilamentPMMU2(bool showMessage) {
if(smuffConfig.homeAfterFeed) {
if(smuffConfig.revolverIsServo) {
setServoPos(1, smuffConfig.revolverOffPos);
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
else
steppers[REVOLVER].home();
}
steppers[FEEDER].setAbort(false);
if(smuffConfig.externalControl_Z && smuffConfig.isSharedStepper) {
switchFeederStepper(EXTERNAL);
}
parserBusy = false;
return true;
}
@@ -993,11 +1187,14 @@ bool unloadFilament() {
signalNoTool();
return false;
}
if(smuffConfig.externalControl_Z) {
if(smuffConfig.externalControl_Z && !smuffConfig.isSharedStepper) {
positionRevolver();
signalUnloadFilament();
return true;
}
else if(smuffConfig.externalControl_Z && smuffConfig.isSharedStepper) {
switchFeederStepper(INTERNAL);
}
steppers[FEEDER].setStepsTaken(0);
parserBusy = true;
if(!steppers[FEEDER].getEnabled())
@@ -1084,12 +1281,14 @@ bool unloadFilament() {
steppers[FEEDER].setAbort(false);
if(smuffConfig.homeAfterFeed) {
if(smuffConfig.revolverIsServo) {
setServoPos(1, smuffConfig.revolverOffPos);
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
else
steppers[REVOLVER].home();
}
if(smuffConfig.externalControl_Z && smuffConfig.isSharedStepper) {
switchFeederStepper(EXTERNAL);
}
parserBusy = false;
return true;
}
@@ -1145,8 +1344,10 @@ bool selectTool(int ndx, bool showMessage) {
}
else if (smuffConfig.externalControl_Z && feederEndstop()) {
beep(4);
if(smuffConfig.duetDirect) {
sprintf(_tmp, "//action: WAIT\n");
if(smuffConfig.sendActionCmds) {
// send action command to indicate a jam has happend and
// the controller shall wait
sprintf_P(_tmp, PSTR("//action: WAIT\n"));
printResponse(_tmp, 0);
printResponse(_tmp, 1);
printResponse(_tmp, 2);
@@ -1158,15 +1359,16 @@ bool selectTool(int ndx, bool showMessage) {
if(!stat)
return false;
if(smuffConfig.unloadCommand != NULL && strlen(smuffConfig.unloadCommand) > 0) {
#if !defined(__ESP32__)
Serial2.print(smuffConfig.unloadCommand);
Serial2.print("\n");
//__debug(PSTR("Feeder jammed, sent unload command '%s'\n"), smuffConfig.unloadCommand);
#endif
if(CAN_USE_SERIAL2) {
Serial2.print(smuffConfig.unloadCommand);
Serial2.print("\n");
//__debug(PSTR("Feeder jammed, sent unload command '%s'\n"), smuffConfig.unloadCommand);
}
}
}
if(smuffConfig.duetDirect) {
sprintf(_tmp, "//action: CONTINUE\n");
if(smuffConfig.sendActionCmds) {
// send action command to indicate jam cleared, continue printing
sprintf_P(_tmp, PSTR("//action: CONTINUE\n"));
printResponse(_tmp, 0);
printResponse(_tmp, 1);
printResponse(_tmp, 2);
@@ -1174,24 +1376,31 @@ bool selectTool(int ndx, bool showMessage) {
}
if(smuffConfig.revolverIsServo) {
// release servo prior moving the selector
setServoPos(1, smuffConfig.revolverOffPos);
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
}
//__debug(PSTR("Selecting tool: %d"), ndx);
parserBusy = true;
drawSelectingMessage(ndx);
//__debug(PSTR("Message shown"));
unsigned speed = steppers[SELECTOR].getMaxSpeed();
// if the distance between two tools is more than 3, use higher speed to move
// if the distance between two tools is more than 3 (tools), use higher speed to move
if(abs(toolSelected-ndx) >=3)
steppers[SELECTOR].setMaxSpeed(steppers[SELECTOR].getMaxHSpeed());
prepSteppingAbsMillimeter(SELECTOR, smuffConfig.firstToolOffset + (ndx * smuffConfig.toolSpacing));
remainingSteppersFlag |= _BV(SELECTOR);
#if !defined(SMUFF_V5)
if(!smuffConfig.resetBeforeFeed_Y) {
prepSteppingAbs(REVOLVER, smuffConfig.firstRevolverOffset + (ndx *smuffConfig.revolverSpacing), true);
remainingSteppersFlag |= _BV(REVOLVER);
}
runAndWait(-1);
#else
runAndWait(SELECTOR);
#endif
//__debug(PSTR("Selector in position: %d"), ndx);
steppers[SELECTOR].setMaxSpeed(speed);
toolSelected = ndx;
@@ -1200,20 +1409,26 @@ bool selectTool(int ndx, bool showMessage) {
dataStore.stepperPos[REVOLVER] = steppers[REVOLVER].getStepPosition();
dataStore.stepperPos[FEEDER] = steppers[FEEDER].getStepPosition();
saveStore();
//__debug(PSTR("Data stored"));
if (!smuffConfig.externalControl_Z && showMessage) {
showFeederLoadMessage();
}
if(smuffConfig.externalControl_Z) {
//__debug(PSTR("Resetting Revolver"));
resetRevolver();
signalSelectorReady();
//__debug(PSTR("Revolver reset done"));
}
// Attn: if testMode is set, it'll echo the selected tool to Serial2
if(testMode) {
/*
if(testMode && CAN_USE_SERIAL2) {
Serial2.print("T");
Serial2.println(ndx);
}
*/
parserBusy = false;
//__debug(PSTR("Finished selecting tool"));
return true;
}
@@ -1226,7 +1441,7 @@ void resetRevolver() {
}
else {
//__debug(PSTR("Positioning servo to: %d (CLOSED)"), smuffConfig.revolverOnPos);
setServoPos(1, smuffConfig.revolverOnPos);
setServoPos(SERVO_LID, smuffConfig.revolverOnPos);
}
}
}
@@ -1237,7 +1452,7 @@ void setStepperSteps(int index, long steps, bool ignoreEndstop) {
if(smuffConfig.revolverIsServo && index == SELECTOR) {
if(servoRevolver.getDegree() != smuffConfig.revolverOffPos) {
//__debug(PSTR("Positioning servo to: %d (OPEN)"), smuffConfig.revolverOffPos);
setServoPos(1, smuffConfig.revolverOffPos);
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
}
if (steps != 0)
@@ -1295,7 +1510,8 @@ void printSpeeds(int serial) {
String(smuffConfig.stepDelay_X).c_str(),
String(steppers[REVOLVER].getMaxSpeed()).c_str(),
String(smuffConfig.stepDelay_Y).c_str(),
smuffConfig.externalControl_Z ? "external" : String(steppers[FEEDER].getMaxSpeed()).c_str(),
String(steppers[FEEDER].getMaxSpeed()).c_str(),
smuffConfig.externalControl_Z ? " (E)" : " (I)",
String(smuffConfig.stepDelay_Z).c_str());
printResponse(tmp, serial);
}
@@ -1306,7 +1522,8 @@ void printAcceleration(int serial) {
String(smuffConfig.stepDelay_X).c_str(),
String(steppers[REVOLVER].getAcceleration()).c_str(),
String(smuffConfig.stepDelay_Y).c_str(),
smuffConfig.externalControl_Z ? "external" : String(steppers[FEEDER].getAcceleration()).c_str(),
String(steppers[FEEDER].getMaxSpeed()).c_str(),
smuffConfig.externalControl_Z ? " (E)" : " (I)",
String(smuffConfig.stepDelay_Z).c_str());
printResponse(tmp, serial);
}
@@ -1391,15 +1608,55 @@ void userBeep() {
_noTone(BEEPER_PIN);
}
void initBeep() {
void encoderBeep(int count) {
if(BEEPER_PIN == -1)
return;
_tone(BEEPER_PIN, 330, 5);
delayMicroseconds(5);
_noTone(BEEPER_PIN);
}
/*
Plays a sound sequence given in a string.
The format is: F{frequency} D{duration} [P{pause}].F{frequency}D{duration}[P{pause}]. ...
Example: "F440D120P80." plays an A (440Hz) with a duration of 120mS and pauses 80mS
after the tone has played.
The '.' at the end of a tone is needed to play that tone and must not be omitted.
*/
void playSequence(const char* seq) {
int f=0, d=0, p=0;
while(*seq) {
if(*seq=='"' || *seq==' ')
seq++;
if(toupper(*seq)=='F') {
f = atoi(++seq);
}
if(toupper(*seq)=='D') {
d = atoi(++seq);
}
if(toupper(*seq)=='P') {
p = atoi(++seq);
}
if(*seq=='.') {
if(f && d) {
_tone(BEEPER_PIN, f, d);
delay(d);
}
if(p)
delay(p);
f = d = p = 0;
}
seq++;
}
_noTone(BEEPER_PIN);
}
void startupBeep() {
showLed(4, 1);
if(BEEPER_PIN == -1)
return;
_tone(BEEPER_PIN, 1760, 90); delay(90); _noTone(BEEPER_PIN);
_tone(BEEPER_PIN, 1975, 90); delay(90); _noTone(BEEPER_PIN);
_tone(BEEPER_PIN, 2093, 90); delay(90); _noTone(BEEPER_PIN);
_tone(BEEPER_PIN, 1975, 90); delay(90); _noTone(BEEPER_PIN);
_tone(BEEPER_PIN, 1760, 200); delay(250); _noTone(BEEPER_PIN);
// the "new" tune
playSequence(tuneSequence.c_str());
}
void setServoMinPwm(int servoNum, int pwm) {
@@ -1460,14 +1717,10 @@ void getStoredData() {
void setSignalPort(int port, bool state) {
if(!smuffConfig.prusaMMU2 && !smuffConfig.sendPeriodicalStats) {
sprintf(tmp,"%c%c%s", 0x1b, port, state ? "1" : "0");
#if defined(__STM32F1__)
Serial1.write(tmp);
#elif defined(__ESP32__)
// nothing here yet, might need adding some port pins settings / resetting
//__debug(PSTR("setting signal port: %d, %s"), port, state ? "true" : "false");
#else
Serial2.write(tmp);
#endif
if(CAN_USE_SERIAL1)
Serial1.write(tmp);
if(CAN_USE_SERIAL2)
Serial2.write(tmp);
}
}
@@ -1555,6 +1808,23 @@ bool getFiles(const char* rootFolder, const char* pattern, int maxFiles, bool cu
return false;
}
/*
Removes file firmware.bin from root directory in order
to prevent re-flashing on each reset!
*/
void removeFirmwareBin() {
SdFat SD;
#if defined(__ESP32__)
if (SD.begin(SDCS_PIN, SD_SCK_MHZ(4))) {
#else
if (SD.begin()) {
#endif
SD.remove("firmware.bin");
}
}
void testRun(String fname) {
char line[80];
char msg[256];
@@ -1707,6 +1977,14 @@ void maintainTool() {
}
}
void blinkLED() {
#if defined(LED_PIN)
if(LED_PIN != -1)
digitalWrite(LED_PIN, !digitalRead(LED_PIN));
#endif
}
extern Stream* debugSerial;
void __debug(const char* fmt, ...) {

479
src/SetupInit.cpp Normal file
View File

@@ -0,0 +1,479 @@
/**
* SMuFF Firmware
* Copyright (C) 2019 Technik Gegg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "SMuFF.h"
#if defined(__STM32F1__)
#define PRODUCT_ID 0x29 // for CompositeSerial
#endif
#if defined(USE_COMPOSITE_SERIAL)
bool writeSDCard(const uint8_t *writebuff, uint32_t startSector, uint16_t numSectors) {
return SD.card()->writeSectors(startSector, writebuff, numSectors);
}
bool readSDCard(uint8_t *readbuff, uint32_t startSector, uint16_t numSectors) {
return SD.card()->readSectors(startSector, readbuff, numSectors);
}
#endif
void initUSB() {
#if defined(__STM32F1__)
if(USB_CONNECT_PIN != -1) {
pinMode(USB_CONNECT_PIN, OUTPUT);
digitalWrite(USB_CONNECT_PIN, HIGH); // USB clear connection
delay(1000); // give OS time to notice
digitalWrite(USB_CONNECT_PIN, LOW); // USB reestablish connection
}
#if defined(USE_COMPOSITE_SERIAL)
/* Not tested yet */
bool sdStat;
if(SDCS_PIN != -1) {
sdStat = SD.begin(SDCS_PIN, SD_SCK_MHZ(4));
}
else {
sdStat = SD.begin();
}
if(sdStat) {
USBComposite.setProductId(PRODUCT_ID);
MassStorage.setDriveData(0, SD.card()->sectorCount(), readSDCard, writeSDCard);
MassStorage.registerComponent();
CompositeSerial.registerComponent();
USBComposite.begin();
delay(2000);
}
#endif
#endif
}
void setupDeviceName() {
String appendix = "";
#if defined(__ESP32__)
appendix = WiFi.macAddress().substring(9);
appendix.replace(":", "");
#endif
wirelessHostname = String("SMuFF") + "_" + appendix;
}
void setupBuzzer() {
if(BEEPER_PIN != -1) {
#if defined(__ESP32__)
ledcSetup(BEEPER_CHANNEL, 5000, 8);
ledcAttachPin(BEEPER_PIN, BEEPER_CHANNEL);
#else
#endif
}
}
/*
Initialize FastLED library for NeoPixels.
Primarily used for backlight on some displays (i.e. FYSETC 12864 Mini V2.1)
*/
void initFastLED() {
#if NEOPIXEL_PIN != -1 && defined(USE_FASTLED_BACKLIGHT)
FastLED.addLeds<LED_TYPE, NEOPIXEL_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
#endif
}
/*
Initialize pin for hardware debugging.
Primarily used to attach an oscilloscope.
*/
void initHwDebug() {
#if defined(__HW_DEBUG__)
pinMode(DEBUG_PIN, OUTPUT);
digitalWrite(DEBUG_PIN, HIGH);
#endif
}
void setupDuetLaserSensor() {
// Duet Laser Sensor is being used as the Feeder endstop
if(smuffConfig.useDuetLaser) {
duetLS.attach(Z_END_DUET_PIN);
}
}
void setupSerialBT() {
#ifdef __ESP32__
// this line must be kept, otherwise BT power down will cause a reset
SerialBT.begin(wirelessHostname);
#endif
}
void setupSerial() {
// special case:
// if the baudrate is set to 0, the board is running out of memory
if(smuffConfig.serial0Baudrate != 0) {
if(smuffConfig.serial0Baudrate != 115200) {
Serial.end();
Serial.begin(smuffConfig.serial0Baudrate);
}
}
else {
writeConfig(&Serial);
longBeep(3);
showDialog(P_TitleConfigError, P_ConfigFail1, P_ConfigFail4, P_OkButtonOnly);
}
Serial.begin(smuffConfig.serial0Baudrate);
if(CAN_USE_SERIAL1) Serial1.begin(smuffConfig.serial1Baudrate);
if(CAN_USE_SERIAL2) Serial2.begin(smuffConfig.serial2Baudrate);
if(CAN_USE_SERIAL3) Serial3.begin(smuffConfig.serial3Baudrate);
//__debug(PSTR("DONE init SERIAL"));
}
void setupSwSerial0() {
#if defined(USE_SW_SERIAL)
swSer0.begin(TMC_BAUDRATE);
#endif
}
void setupRelay() {
if(RELAIS_PIN != -1 && smuffConfig.revolverIsServo) {
// Relay mode will only work on servo variants
pinMode(RELAIS_PIN, OUTPUT);
// if there's an external Feeder stepper defined (i.e. the 3D-Printer drives the Feeder),
// switch on the external stepper by default. Otherwise, use the interal stepper.
if(smuffConfig.externalControl_Z)
switchFeederStepper(EXTERNAL);
else
switchFeederStepper(INTERNAL);
}
}
void setupServos() {
// setup the Wiper servo
if(SERVO1_PIN != -1) {
servo.setMaxCycles(smuffConfig.servoCycles1);
servo.setPulseWidthMinMax(smuffConfig.servoMinPwm, smuffConfig.servoMaxPwm);
#if defined(__ESP32__)
// we'll be using the internal ledcWrite for servo control on ESP32
servo.attach(SERVO1_PIN, false, 0);
#elif defined(__STM32F1__)
servo.attach(SERVO1_PIN, true, 0);
#else
servo.attach(SERVO1_PIN, true, 0);
#endif
int resetPos = 90, param;
// try to find out the default reset position of the wiper servo from
// within the wipe sequence
if((param = getParam(String(smuffConfig.wipeSequence), (char*)"P")) != -1) {
resetPos = param;
}
setServoPos(SERVO_WIPER, resetPos);
}
// setup the Lid servo (replaces the Revolver stepper motor)
if(SERVO2_PIN != -1) {
servoRevolver.setMaxCycles(smuffConfig.servoCycles2);
servoRevolver.setPulseWidthMinMax(smuffConfig.servoMinPwm, smuffConfig.servoMaxPwm);
#if defined(__ESP32__)
// we'll be using the internal ledcWrite for servo control on ESP32
servoRevolver.attach(SERVO2_PIN, false, 1);
#elif defined(__STM32F1__)
servoRevolver.attach(SERVO2_PIN, true, 1);
#else
servoRevolver.attach(SERVO2_PIN, true, 1);
#endif
setServoPos(SERVO_LID, smuffConfig.revolverOffPos);
}
}
void setupHeaterBed() {
// Please note: All the PWM pins on the SKR are not working as
// expected. Maybe it's a common libmaple issue, maybe it's a
// STM32 timer related thing or maybe it's the
// hardware design of the board itself.
// Can't tell for sure, need some more investigation.
if(HEATER0_PIN != -1) {
pinMode(HEATER0_PIN, OUTPUT);
}
#if defined(__STM32F1__) || defined(__ESP32__)
if(HEATBED_PIN != -1) {
#if defined(__STM32F1__)
pinMode(HEATBED_PIN, PWM);
#else
pinMode(HEATBED_PIN, OUTPUT);
#endif
}
#endif
}
void setupFan() {
if(FAN_PIN != -1) {
#ifdef __STM32F1__
fan.attach(FAN_PIN, 0);
#elif defined(__ESP32__)
ledcSetup(FAN_CHANNEL, FAN_FREQ, 8);
ledcAttachPin(FAN_PIN, FAN_CHANNEL);
//__debug(PSTR("DONE FAN PIN CONFIG"));
#else
pinMode(FAN_PIN, OUTPUT);
#endif
if(smuffConfig.fanSpeed >= 0 && smuffConfig.fanSpeed <= 100) {
#if defined (__ESP32__)
ledcWrite(FAN_PIN, map(smuffConfig.fanSpeed, 0, 100, 0, 65535));
#elif defined(__STM32F1__)
//pwmWrite(FAN_PIN, map(smuffConfig.fanSpeed, 0, 100, 0, 65535));
fan.setFanSpeed(smuffConfig.fanSpeed);
#else
analogWrite(FAN_PIN, map(smuffConfig.fanSpeed, 0, 100, 0, 255));
#endif
}
}
//__debug(PSTR("DONE FAN init"));
}
void setupPortExpander() {
#if defined(__ESP32__)
// init the PCF8574 port expander and set pin modes (0-5 OUTPUT, 6-7 INPUT)
portEx.begin(PORT_EXPANDER_ADDRESS, false);
for(int i=0; i< 6; i++) {
portEx.pinMode(i, OUTPUT);
portEx.setPin(i);
}
portEx.pinMode(6, INPUT_PULLUP);
portEx.pinMode(7, INPUT_PULLUP);
portEx.resetPin(0);
//__debug(PSTR("DONE PortExpander init"));
#endif
}
void setupI2C() {
#ifdef __AVR__
// We can't do Master and Slave on this device.
// Slave mode is used for the I2C OLE Display on SKR mini
if(smuffConfig.i2cAddress != 0) {
Wire.begin(smuffConfig.i2cAddress);
Wire.onReceive(wireReceiveEvent);
}
//__debug(PSTR("DONE I2C init"));
#endif
}
void setupBacklight() {
#if defined(USE_RGB_BACKLIGHT) || defined(USE_FASTLED_BACKLIGHT)
for(int i=0; i< 8; i++) {
setBacklightIndex(i); // flip through all colors
delay(250);
}
setBacklightIndex(smuffConfig.backlightColor); // turn on the LCD backlight according to the configured setting
#endif
}
void setupEncoder() {
encoder.setDoubleClickEnabled(true); // enable doubleclick on the rotary encoder
encoder.setEnableSound(smuffConfig.encoderTickSound);
}
void setupSteppers() {
steppers[SELECTOR] = ZStepper(SELECTOR, (char*)"Selector", X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, smuffConfig.acceleration_X, smuffConfig.maxSpeed_X);
steppers[SELECTOR].setEndstop(X_END_PIN, smuffConfig.endstopTrigger_X, ZStepper::MIN);
steppers[SELECTOR].stepFunc = overrideStepX;
steppers[SELECTOR].setMaxStepCount(smuffConfig.maxSteps_X);
steppers[SELECTOR].setStepsPerMM(smuffConfig.stepsPerMM_X);
steppers[SELECTOR].setInvertDir(smuffConfig.invertDir_X);
steppers[SELECTOR].setMaxHSpeed(smuffConfig.maxSpeedHS_X);
steppers[SELECTOR].setAccelDistance(smuffConfig.accelDistance_X);
if(smuffConfig.stepperStall[SELECTOR] > 0)
steppers[SELECTOR].stallCheck = stallCheckX;
#if !defined(SMUFF_V5)
steppers[REVOLVER] = ZStepper(REVOLVER, (char*)"Revolver", Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, smuffConfig.acceleration_Y, smuffConfig.maxSpeed_Y);
steppers[REVOLVER].setEndstop(Y_END_PIN, smuffConfig.endstopTrigger_Y, ZStepper::ORBITAL);
steppers[REVOLVER].stepFunc = overrideStepY;
steppers[REVOLVER].setMaxStepCount(smuffConfig.stepsPerRevolution_Y);
steppers[REVOLVER].setStepsPerDegree(smuffConfig.stepsPerRevolution_Y/360);
steppers[REVOLVER].endstopFunc = endstopYevent;
steppers[REVOLVER].setInvertDir(smuffConfig.invertDir_Y);
steppers[REVOLVER].setMaxHSpeed(smuffConfig.maxSpeedHS_Y);
steppers[REVOLVER].setAccelDistance(smuffConfig.accelDistance_Y);
if(smuffConfig.stepperStall[REVOLVER] > 0)
steppers[REVOLVER].stallCheck = stallCheckY;
#else
// we don't use the Revolver stepper but an servo instead, although
// create a dummy instance
steppers[REVOLVER] = ZStepper(REVOLVER, (char*)"Revolver", -1, -1, Y_ENABLE_PIN, 0, 0);
#endif
steppers[FEEDER] = ZStepper(FEEDER, (char*)"Feeder", Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, smuffConfig.acceleration_Z, smuffConfig.maxSpeed_Z);
if(smuffConfig.useDuetLaser) {
steppers[FEEDER].setEndstop(-1, smuffConfig.endstopTrigger_Z, ZStepper::MIN);
steppers[FEEDER].endstopCheck = checkDuetEndstop;
}
else
steppers[FEEDER].setEndstop(Z_END_PIN, smuffConfig.endstopTrigger_Z, ZStepper::MIN);
if(Z_END2_PIN != -1)
steppers[FEEDER].setEndstop(Z_END2_PIN, smuffConfig.endstopTrigger_Z, ZStepper::MIN, 2); // optional; used for testing only
steppers[FEEDER].stepFunc = overrideStepZ;
steppers[FEEDER].setStepsPerMM(smuffConfig.stepsPerMM_Z);
steppers[FEEDER].endstopFunc = endstopEventZ;
steppers[FEEDER].endstop2Func = endstopEventZ2;
steppers[FEEDER].setInvertDir(smuffConfig.invertDir_Z);
steppers[FEEDER].setMaxHSpeed(smuffConfig.maxSpeedHS_Z);
steppers[FEEDER].setAccelDistance(smuffConfig.accelDistance_Z);
if(smuffConfig.stepperStall[FEEDER] > 0)
steppers[FEEDER].stallCheck = stallCheckZ;
for(int i=0; i < NUM_STEPPERS; i++) {
steppers[i].runAndWaitFunc = runAndWait;
steppers[i].runNoWaitFunc = runNoWait;
steppers[i].setEnabled(true);
}
__debug(PSTR("DONE init/enabling steppers"));
for(int i=0; i < MAX_TOOLS; i++) {
swapTools[i] = i;
}
//__debug(PSTR("DONE initializing swaps"));
}
TMC2209Stepper* initDriver(int axis, int rx_pin, int tx_pin) {
int mode = smuffConfig.stepperMode[axis];
int stall = smuffConfig.stepperStall[axis];
int current = smuffConfig.stepperPower[axis];
int msteps = smuffConfig.stepperMicrosteps[axis];
int csmin = smuffConfig.stepperCSmin[axis];
int csmax = smuffConfig.stepperCSmax[axis];
int csdown = smuffConfig.stepperCSdown[axis];
float rsense= smuffConfig.stepperRSense[axis];
int drvrAdr = smuffConfig.stepperAddr[axis];
int toff = stall == 0 ? 4 : 3; // smuffConfig.stepperToff[axis];
bool spread = smuffConfig.stepperSpread[axis];
if(mode == 0) {
//__debug(PSTR("Driver for %c-axis skipped"), 'X'+axis);
return NULL;
}
TMC2209Stepper* driver = new TMC2209Stepper(rx_pin, tx_pin, rsense, drvrAdr);
//__debug(PSTR("Driver for %c-axis initialized"), 'X'+axis);
steppers[axis].setEnabled(true);
driver->beginSerial(TMC_BAUDRATE);
delay(50);
driver->toff(toff);
driver->blank_time(24);
driver->internal_Rsense(true);
driver->Rsense = rsense;
driver->I_scale_analog(true); // set external Vref
driver->rms_current(current); // set current in mA
driver->mstep_reg_select(1); // set microstepping
driver->microsteps(msteps);
// setup StallGuard only if stepperStall value is between 1 and 255
// otherwise put it in SpreadCycle mode
if(stall >= 1 && stall <= 255) {
#if defined(TMC_TYPE_2130)
stall = (int)map(stall, 1, 255, -63, 63); // remap values for TMC2130 (not tested yet!)
#endif
driver->pwm_autoscale(true);
driver->TCOOLTHRS(0xFFFFF);
if(csmin >0 && csmax >0) {
driver->semin(csmin);
driver->semax(csmax);
driver->sedn(csdown);
}
driver->SGTHRS(0);
driver->en_spreadCycle(false); // set StealthChop (enable StallGuard)
}
else {
driver->TCOOLTHRS(0);
driver->en_spreadCycle(true); // set SpreadCycle (disable StallGuard)
}
return driver;
}
void setupTMCDrivers() {
#if defined(X_SERIAL_TX_PIN)
driverX = initDriver(SELECTOR, X_SERIAL_TX_PIN, X_SERIAL_TX_PIN);
#endif
#if defined(Y_SERIAL_TX_PIN)
driverY = initDriver(REVOLVER, Y_SERIAL_TX_PIN, Y_SERIAL_TX_PIN);
#endif
#if defined(Z_SERIAL_TX_PIN)
driverZ = initDriver(FEEDER, Z_SERIAL_TX_PIN, Z_SERIAL_TX_PIN);
#endif
#if defined(E_SERIAL_TX_PIN)
driverE = initDriver(FEEDER, E_SERIAL_TX_PIN, E_SERIAL_TX_PIN);
#endif
__debug(PSTR("DONE initializing TMC Steppers"));
}
void setupTimers() {
#if defined(__AVR__)
// *****
// Attn:
// Servo uses: TIMER5 (if it's setup to create its own timer)
// Steppers use: TIMER4
// Encoder uses: gpTimer
// *****
stepperTimer.setupTimer(ZTimer::ZTIMER4, ZTimer::PRESCALER1);
gpTimer.setupTimer(ZTimer::ZTIMER3, ZTimer::PRESCALER256); // round about 1ms on 16MHz CPU
#elif defined(__ESP32__)
// *****
// Attn:
// Servo uses: TIMER3 (if it's setup to create its own timer)
// PortExpander uses: TIMER3 (via general purpose timer)
// Steppers use: TIMER1
// Encoder uses: gpTimer
// *****
stepperTimer.setupTimer(ZTimer::ZTIMER1, 4); // prescaler set to 20MHz, timer will be calculated as needed
gp.setupTimer(ZTimer::ZTIMER2, 80); // 1ms on 80MHz timer clock
#else
// *****
// Attn:
// PA8 (Fan) uses: TIMER1 CH1 (predefined by libmaple for PWM)
// Steppers use: TIMER5 CH1 (may corrupt TH0 readings)
// GP timer uses: TIMER8 CH1 (general, encoder, servo)
// Beeper uses: TIMER4 CH3
// SW-Serial uses: TIMER3 CH4 (see SoftwareSerialM library)
// PC8 (Heater0) uses: TIMER8 CH3 (predefined by libmaple for PWM)
// PC9 (Heatbed) uses: TIMER8 CH4 (predefined by libmaple for PWM)
//
// Warning: If you need to modify this assignment, be sure you know what you do!
// Swapping timers and/or channels may lead to a non functioning device or
// communication interrupts/breaks. Read the STM32F1 MCU spec. and check
// the libmaple library settings before you do so.
// *****
stepperTimer.setupTimer(ZTimer::ZTIMER2, ZTimer::CH1, 1, 1); // prescaler set to 72MHz, timer will be calculated as needed
gpTimer.setupTimer(ZTimer::ZTIMER8, ZTimer::CH1, 8, 0); // prescaler set to 9MHz, timer will be set to 50uS
setToneTimerChannel(ZTimer::ZTIMER4, ZTimer::CH3); // force TIMER4 / CH3 on STM32F1x for tone library
#endif
stepperTimer.setupTimerHook(isrStepperHandler); // setup the ISR for the steppers
gpTimer.setupTimerHook(isrGPTimerHandler); // setup the ISR for rotary encoder, servo and general timers
#if defined(__STM32F1__)
gpTimer.setNextInterruptInterval(450); // run general purpose (gp)timer on 50uS (STM32)
#elif defined(__ESP32__)
gpTimer.setNextInterruptInterval(50); // run general purpose (gp)timer on 50uS (ESP32)
#else
gpTimer.setNextInterruptInterval(3); // run general purpose (gp)timer on 48uS (AVR)
#endif
//__debug(PSTR("DONE setup timers"));
}

View File

@@ -96,12 +96,14 @@ void parseGcode(const String& serialBuffer, int serial) {
if(!steppers[FEEDER].getMovementDone()) {
//__debug(PSTR("Wait after 'T' 500ms"));
delay(500);
#if !defined(MARLIN2_ONLY)
if(currentLine > 0)
sprintf_P(ptmp, PSTR("M998 %d\n"), currentLine);
else
sprintf_P(ptmp, PSTR("M998\n"));
printResponseP(ptmp, serial);
//__debug(PSTR("Resend 'T' sent"));
#endif
return;
}
}
@@ -203,10 +205,12 @@ bool parse_T(const String& buf, int serial) {
}
else if(tool >= 0 && tool <= smuffConfig.toolCount-1) {
//__debug(PSTR("Tool change requested: T%d"), tool);
// Prusa expects the MMU to unload filament on its own before tool change
if(smuffConfig.prusaMMU2 && feederEndstop()) {
//__debug(PSTR("must unload first!"));
unloadFilament();
if(feederEndstop()) {
// Prusa expects the MMU to unload filament on its own before tool change
// Same goes if the Feeder stepper is declared shared
if(smuffConfig.prusaMMU2 || smuffConfig.isSharedStepper)
//__debug(PSTR("must unload first!"));
unloadFilament();
}
stat = selectTool(tool, false);
if(stat) {
@@ -219,7 +223,7 @@ bool parse_T(const String& buf, int serial) {
}
}
}
if(!smuffConfig.prusaMMU2) // Prusa expects not Tx as response
if(!smuffConfig.prusaMMU2) // Prusa doesn't expect "Tx" as a response
printResponse(msg, serial);
}
else {
@@ -232,18 +236,24 @@ bool parse_T(const String& buf, int serial) {
bool parse_Action(const String& buf, int serial) {
char tmp[256];
if(buf.length()==0) {
return false;
}
actionOk = false;
if(buf.startsWith("T:")) {
actionOk = false;
String msg = buf.substring(2);
if(msg == "OK")
actionOk = true;
else {
drawUserMessage(msg);
sprintf_P(tmp, P_ActionMsg, msg.c_str());
drawUserMessage(tmp);
}
}
else if(buf.startsWith("PING")) {
printResponse("//action: PONG", serial);
}
return false;
}
@@ -441,6 +451,22 @@ int getParam(String buf, char* token) {
return -1;
}
float getParamF(String buf, char* token) {
int pos = buf.indexOf(token);
//__debug(PSTR("getParam: %s\n"),buf.c_str());
if(pos != -1) {
//__debug(PSTR("getParam:pos: %d"),pos);
if(buf.charAt(pos+1)=='-') {
int val = buf.substring(pos+2).toInt();
//__debug(PSTR("Negative: %d"), 0-val);
return 0-val;
}
return atof(buf.substring(pos+1).c_str());
}
else
return -1;
}
long getParamL(String buf, char* token) {
int pos = buf.indexOf(token);
//__debug(PSTR("getParam: %s\n"),buf.c_str());
@@ -554,11 +580,9 @@ void printResponse(const char* response, int serial) {
sendingResponse = true;
switch(serial) {
case 0: Serial.print(response); break;
case 1: Serial1.print(response); break;
case 2: Serial2.print(response); break;
#ifndef __ESP32__
case 3: Serial3.print(response); break;
#endif
case 1: if(CAN_USE_SERIAL1) Serial1.print(response); break;
case 2: if(CAN_USE_SERIAL2) Serial2.print(response); break;
case 3: if(CAN_USE_SERIAL3) Serial3.print(response); break;
}
sendingResponse = false;
}
@@ -567,11 +591,9 @@ void printResponseP(const char* response, int serial) {
sendingResponse = true;
switch(serial) {
case 0: Serial.print((__FlashStringHelper*)response); break;
case 1: Serial1.print((__FlashStringHelper*)response); break;
case 2: Serial2.print((__FlashStringHelper*)response); break;
#ifndef __ESP32__
case 3: Serial3.print((__FlashStringHelper*)response); break;
#endif
case 1: if(CAN_USE_SERIAL1) Serial1.print((__FlashStringHelper*)response); break;
case 2: if(CAN_USE_SERIAL2) Serial2.print((__FlashStringHelper*)response); break;
case 3: if(CAN_USE_SERIAL3) Serial3.print((__FlashStringHelper*)response); break;
}
sendingResponse = false;
}

71
src/ZFan.cpp Normal file
View File

@@ -0,0 +1,71 @@
/**
* SMuFF Firmware
* Copyright (C) 2019 Technik Gegg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ZFan.h"
static ZFan* fanInstances[MAX_FANS];
void ZFan::attach(int pin) {
_pin = pin;
pinMode(_pin, OUTPUT);
digitalWrite(_pin, 0);
}
void ZFan::detach() {
digitalWrite(_pin, 0);
fanInstances[_fanIndex] = NULL;
_pin = 0;
}
void ZFan::setIndex(int fanIndex) {
if(fanIndex != -1 && fanIndex < MAX_FANS) {
_fanIndex = fanIndex;
fanInstances[_fanIndex] = this;
}
}
void ZFan::setFanSpeed(int speed) {
_speed = speed;
_pulseLen = map(speed, 0, 100, _minSpeed, _maxSpeed);
}
void ZFan::setFan() {
_tickCnt += 50;
if(_tickCnt <= (uint32_t)_pulseLen)
setFanPin(HIGH);
else
setFanPin(LOW);
if(_tickCnt >= (uint32_t)(FAN_DUTY_CYCLE)) {
_tickCnt = 0;
}
}
void ZFan::setFanPin(int state) {
digitalWrite(_pin, state);
}
void isrFanTimerHandler() {
// call all handlers for all fans periodically if the
// internal timer is being used.
for(int i=0; i< MAX_FANS; i++) {
if(fanInstances[i] != NULL) {
fanInstances[i]->setFan();
}
}
}

View File

@@ -21,37 +21,25 @@
static ZServo* servoInstances[MAX_SERVOS];
/*
To use the servo with an timer (interrupt), you have to setup an timer
externally, call the attach method with useTimer = true and call the
isrServoTimerHandler() method down below from within the timers
own interrupt routine.
The external timer has to run at 50uS (20kHz) in order to get the correct
timing for the servos.
Otherwise, as in case of the ESP32, the servos will be handled by
PWM on the give pin.
Had to realize it this way because I was running out of precious timers
on the STM32 MCU.
*/
void ZServo::attach(int pin, bool useTimer, int servoIndex) {
_useTimer = useTimer;
attach(pin);
setIndex(servoIndex);
// To set up an independent timer, you have to use the attach()-method above
// with useTimer = true. Otherwise you'll have to call setServo() in a 20 ms
// period to get the servo running, which is a bit more complex but saves
// on timers.
if(!timerSet && _useTimer) {
timerSet = true;
#ifdef __STM32F1__
servoTimer.setupTimer(ZTimer::ZTIMER5, 1800); // equals to 25 us on 72 MHz CPU
// timers on STM32 are killing me...
// it's supposed to be 50us but with 50us in the timer each
// PWM signal it twice as long - therefore 25us.
// Need to investigate in that some day.
#elif __ESP32__
servoTimer.setupTimer(ZTimer::ZTIMER3, 80, 50); // equals to 50 us
#else
servoTimer.setupTimer(ZTimer::ZTIMER5, ZTimer::PRESCALER1024);
#endif
servoTimer.setupTimerHook(isrServoTimerHandler);
#if defined(__ESP32__)
servoTimer.setNextInterruptInterval(50);
#else
servoTimer.setNextInterruptInterval(1);
#endif
//__debug(PSTR("Servo with timer initialized"));
}
else {
if(!_useTimer) {
#if defined(__ESP32__)
ledcSetup(SERVO_CHANNEL+_servoIndex, SERVO_FREQ, 16);
ledcAttachPin(pin, SERVO_CHANNEL+_servoIndex);
@@ -63,7 +51,7 @@ void ZServo::attach(int pin, bool useTimer, int servoIndex) {
void ZServo::attach(int pin) {
_pin = pin;
#if defined(__STM32F1__) && defined(SMUFF_V5)
#if defined(SMUFF_V5) && defined(__BRD_SKR_MINI)
pinMode(_pin, OUTPUT_OPEN_DRAIN); // set tp Open Drain for the +5V pullup resistor
#else
pinMode(_pin, OUTPUT);
@@ -152,17 +140,17 @@ void ZServo::setServo() {
ledcWrite(SERVO_CHANNEL+_servoIndex, _pulseLen);
#else
digitalWrite(_pin, HIGH);
delay_us(_pulseLen);
delayMicroseconds(_pulseLen);
digitalWrite(_pin, LOW);
#endif
_lastDegree = _degree;
}
}
else {
// this method increments every 50 us and when the _pulseLen is reached
// it sets the output to low.
// Using this method will prevent blocking the whole CPU while the delay
// is being active, as it's in the method above.
// this method increments with every call by 50 (uS) and when the _pulseLen is reached it'll
// sets the output to low.
// This way, blocking the whole CPU while the delay is being active as it's in the method above
// isn't happening.
_tickCnt += 50;
if(_tickCnt <= (uint32_t)_pulseLen)
@@ -173,7 +161,6 @@ void ZServo::setServo() {
if(_maxCycles == 0 || (++_dutyCnt < _maxCycles)) // but no more cycles than defined to avoid jitter on the servo
_tickCnt = 0;
}
}
}
@@ -181,15 +168,19 @@ void ZServo::setServoPin(int state) {
digitalWrite(_pin, state);
}
bool state;
void isrServoTimerHandler() {
#if defined(__HW_DEBUG__) && defined(DEBUG_PIN)
// used for internal hardware debugging only
//if(DEBUG_PIN != -1) digitalWrite(DEBUG_PIN, !digitalRead(DEBUG_PIN));
#endif
// call all handlers for all servos periodically if the
// internal timer is being used.
//digitalWrite(SERVO2_PIN, state = !state);
for(int i=0; i< MAX_SERVOS; i++) {
if(servoInstances[i] != NULL)
servoInstances[i]->setServo();
if(servoInstances[i] != NULL) {
if(!servoInstances[i]->isTimerStopped())
servoInstances[i]->setServo();
}
}
}

View File

@@ -37,9 +37,12 @@ ZStepper::ZStepper(int number, char* descriptor, int stepPin, int dirPin, int en
_enablePin = enablePin;
_acceleration = acceleration;
_minStepInterval = minStepInterval;
pinMode(_stepPin, OUTPUT);
pinMode(_dirPin, OUTPUT);
pinMode(_enablePin, OUTPUT);
if(_stepPin != -1)
pinMode(_stepPin, OUTPUT);
if(_dirPin != -1)
pinMode(_dirPin, OUTPUT);
if(_enablePin != -1)
pinMode(_enablePin, OUTPUT);
}
void ZStepper::defaultStepFunc(void) {
@@ -58,7 +61,7 @@ void ZStepper::resetStepper() {
_endstopHit = false;
}
void ZStepper::prepareMovement(long steps, boolean ignoreEndstop /*= false */) {
void ZStepper::prepareMovement(long steps, bool ignoreEndstop /*= false */) {
setDirection(steps < 0 ? CCW : CW);
_totalSteps = abs(steps);
_accelDistSteps = _endstopType == ORBITAL ? _stepsPerDegree * _accelDistance : _stepsPerMM * _accelDistance;
@@ -75,7 +78,7 @@ void ZStepper::setEndstop(int pin, int triggerState, EndstopType type, int index
_endstopType = type;
if(pin != -1) {
pinMode(_endstopPin, ((triggerState == 0) ? INPUT_PULLUP : INPUT));
_endstopHit = digitalRead(_endstopPin) == _endstopState;
_endstopHit = (int)digitalRead(_endstopPin) == (int)_endstopState;
}
}
else if(index == 2) {
@@ -84,7 +87,7 @@ void ZStepper::setEndstop(int pin, int triggerState, EndstopType type, int index
_endstopType2 = type;
if(pin != -1) {
pinMode(_endstopPin2, ((triggerState == 0) ? INPUT_PULLUP : INPUT));
_endstopHit2 = digitalRead(_endstopPin2) == _endstopState2;
_endstopHit2 = (int)digitalRead(_endstopPin2) == (int)_endstopState2;
}
}
}
@@ -96,7 +99,7 @@ void ZStepper::setDirection(ZStepper::MoveDirection direction) {
}
}
void ZStepper::setEnabled(boolean state) {
void ZStepper::setEnabled(bool state) {
if(_enablePin != -1) {
digitalWrite(_enablePin, state ? LOW : HIGH);
_enabled = state;
@@ -124,6 +127,11 @@ void ZStepper::updateAcceleration() {
void ZStepper::handleISR() {
// just in case nothing has been defined
if(_stepPin == -1) {
setMovementDone(true);
return;
}
bool hit = false;
if((_endstopType == MIN && _dir == CCW) ||
(_endstopType == MAX && _dir == CW) ||
@@ -134,6 +142,8 @@ void ZStepper::handleISR() {
else {
if(endstopCheck != NULL)
hit = endstopCheck();
//if(stallCheck != NULL)
//hit = stallCheck();
}
setEndstopHit(hit);
}

View File

@@ -23,7 +23,7 @@
#include "ZTimerLib.h"
#if defined(__STM32F1__)
#include <libmaple/libmaple.h>
//#include <libmaple/libmaple.h>
#elif defined(__ESP32__)
#include "esp32-hal.h"
#endif
@@ -237,15 +237,25 @@ void ZTimer::setupTimer(IsrTimer timer, int channel, unsigned int prescaler, uns
hwTimer5.attachInterrupt(channel, ISR5);
break;
case ZTIMER6:
/*
hwTimer6.setMode(channel, TIMER_OUTPUT_COMPARE);
hwTimer6.setPrescaleFactor(prescaler);
hwTimer6.setCompare(channel, compare);
*/
// since this timer doesn't have a compare mode, we're using
// the compare value as a period (in uS)
hwTimer6.setPeriod(compare);
hwTimer6.attachInterrupt(channel, ISR6);
break;
case ZTIMER7:
/*
hwTimer7.setMode(channel, TIMER_OUTPUT_COMPARE);
hwTimer7.setPrescaleFactor(prescaler);
hwTimer7.setCompare(channel, compare);
*/
// since this timer doesn't have a compare mode, we're using
// the compare value as a period (in uS)
hwTimer7.setPeriod(compare);
hwTimer7.attachInterrupt(channel, ISR7);
break;
case ZTIMER8: