mirror of
https://github.com/technik-gegg/SMuFF-1.1.git
synced 2026-02-20 01:41:28 +01:00
Minor bug fixes, see README.md
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
"ServoMaxPwm": 2400,
|
||||
"WipeSeq": "S200 I140 J160 P90 R20",
|
||||
"BackColor": 4,
|
||||
"ToolColor": 5,
|
||||
"HasPanelDue": 0,
|
||||
"EncTicks": true,
|
||||
"SendStats": true,
|
||||
|
||||
@@ -42,6 +42,14 @@ For more information about building the SMuFF and some more detailed stuff, head
|
||||
|
||||
## Recent changes
|
||||
|
||||
**2.20** - Minor bugfix for test scripts / Overhaul for 32-Bit only
|
||||
|
||||
+ GMagican kindly did some code review and removed code that was releated to the 8-Bit AVR MCUs. He also added a HAL for ESP32 MCUs (just in case for future controllers based on this MCU family).
|
||||
+ fixed some outdated settings in the test scripts which caused the test scripts not running correctly (i.e. Feeder-Test).
|
||||
+ added an InputDialog for 16 bit values.
|
||||
+ Original SdFat from greiman version 2.x will compile now.
|
||||
+ added FastLED support for tools. This one has to be enabled by setting the **USE_FASTLED_BACKLIGHT** flag and the **NEOPIXEL_TOOL_PIN**. **Using this feature may render your controller unstable if it has not enough RAM**. Newer boards such as the E3-DIP with 64KB of RAM outght to be preferred.
|
||||
|
||||
**2.19** - STM32 platform update / SKR E3 bug fixing / Purge added
|
||||
|
||||
+ updated STM32 platform to version **11.0.0**. Please do the same, since 10.0.1 seems to have a lot of issues. Also, be aware that 11.0.0 also still has bugs, i.e. the I2C bus enumeration will not report any device available! Though, devices attached work flawlessly (as far as I can tell).
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define VERSION_STRING "V2.19"
|
||||
#define VERSION_STRING "V2.20"
|
||||
#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 "2021-01-02"
|
||||
#define VERSION_DATE "2021-02-18"
|
||||
#define CONFIG_FILE "SMUFF.CFG"
|
||||
#define MATERIALS_FILE "MATERIALS.CFG"
|
||||
#define TMC_CONFIG_FILE "TMCDRVR.CFG"
|
||||
|
||||
@@ -115,6 +115,6 @@ const char* endstop2 PROGMEM = "UseEStop2";
|
||||
const char* color PROGMEM = "Color";
|
||||
const char* pfactor PROGMEM = "PFactor";
|
||||
const char* autoWipe PROGMEM = "AutoWipe";
|
||||
|
||||
const char* toolColor PROGMEM = "ToolColor";
|
||||
|
||||
|
||||
|
||||
@@ -88,5 +88,6 @@ extern char* endstop2;
|
||||
extern char* color;
|
||||
extern char* pfactor;
|
||||
extern char* autoWipe;
|
||||
extern char* toolColor;
|
||||
|
||||
|
||||
|
||||
@@ -95,7 +95,8 @@
|
||||
#define RX3_PIN 3
|
||||
|
||||
#define NEOPIXEL_PIN 13
|
||||
#define NUM_LEDS 5 // number of Neopixel LEDS
|
||||
#define NEOPIXEL_TOOL_PIN -1 // for tools
|
||||
#define NUM_LEDS 5 // number of Neopixel LEDS
|
||||
#define BRIGHTNESS 127
|
||||
#define LED_TYPE WS2812B
|
||||
#define COLOR_ORDER GRB
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#define HEATBED_PIN PC6 // END
|
||||
|
||||
#define NEOPIXEL_PIN -1
|
||||
#define NEOPIXEL_TOOL_PIN -1 // for tools
|
||||
#define DEBUG_PIN -1
|
||||
#define RELAY_PIN -1 // Relais for stepper motor switching
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#define BOARD_INFO "SKR V1.3"
|
||||
// SELECTOR (X)
|
||||
#define STEP_HIGH_X digitalWrite(X_STEP_PIN, HIGH);
|
||||
#define STEP_LOW_X digitalWrite(X_STEP_PIN, LOW);
|
||||
#define STEP_HIGH_X digitalWrite(X_STEP_PIN, HIGH);
|
||||
#define STEP_LOW_X digitalWrite(X_STEP_PIN, LOW);
|
||||
#define X_STEP_PIN P2_02
|
||||
#define X_DIR_PIN P2_06
|
||||
#define X_ENABLE_PIN P2_01
|
||||
@@ -45,9 +45,9 @@
|
||||
#define Z_ENABLE_PIN P0_21
|
||||
#define Z_END_PIN P1_25
|
||||
#define Z_END2_PIN P1_24
|
||||
#define Z_END_DUET_PIN -1
|
||||
#define Z_END_DUET_PIN -1
|
||||
|
||||
#define BEEPER_PIN P1_30
|
||||
#define BEEPER_PIN P1_30
|
||||
|
||||
#define SERVO1_PIN P2_00 // Servo-Pin
|
||||
#define SERVO2_PIN P1_26 // Endstop Y+
|
||||
@@ -56,12 +56,13 @@
|
||||
#define HEATBED_PIN P0_23_A0
|
||||
|
||||
#define NEOPIXEL_PIN P1_21
|
||||
#define NEOPIXEL_TOOL_PIN -1 // for tools
|
||||
|
||||
#define DSP_CS_PIN P1_21 // These pins are only valid if a SPI display is being used
|
||||
#define DSP_CS_PIN P1_21 // These pins are only valid if a SPI display is being used
|
||||
#define DSP_DC_PIN P1_22
|
||||
#define DSP_RESET_PIN P1_20
|
||||
#define DSP_RESET_PIN P1_20
|
||||
|
||||
#define DSP_SCL P0_01 // By default we run the SMuFF controller display on TWI (I2C)
|
||||
#define DSP_SCL P0_01 // By default we run the SMuFF controller display on TWI (I2C)
|
||||
#define DSP_SDA P0_00
|
||||
|
||||
#ifndef USE_TWI_DISPLAY
|
||||
@@ -75,7 +76,7 @@
|
||||
|
||||
|
||||
#define TX3_PIN P1_01 // on SKR usually used for stepper driver serial connection
|
||||
#define RX3_PIN P1_10
|
||||
#define RX3_PIN P1_10
|
||||
|
||||
#define TX2_PIN P1_00 // on SKR usually used for stepper driver serial connection
|
||||
#define RX2_PIN P1_09 // on SKR Mini already used for SD-Card DATA2
|
||||
|
||||
@@ -80,7 +80,8 @@ _DEFPIN_ARM(PB9, 9, B);
|
||||
#define NEOPIXEL_PIN PB7
|
||||
#define NUM_LEDS 3 // number of Neopixel LEDS
|
||||
#elif defined(USE_TWI_DISPLAY)
|
||||
#define NEOPIXEL_PIN PB9 // PC12
|
||||
#define NEOPIXEL_PIN PB9 // EXP2.4 (alternatively PC12/EXP1.7 if used on DIY TWI display)
|
||||
#define NEOPIXEL_TOOL_PIN PB8 // for tools (EXP2.6)
|
||||
#define NUM_LEDS 5 // number of Neopixel LEDS
|
||||
#else
|
||||
#define NEOPIXEL_PIN PB9
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
_DEFPIN_ARM(PC7, 7, C); // needed to compensate "Invalid pin specified" while compiling
|
||||
|
||||
#define NEOPIXEL_PIN PA8 // NEOPIXEL
|
||||
#define NEOPIXEL_TOOL_PIN -1 // for tools
|
||||
#define NUM_LEDS 5 // number of Neopixel LEDS
|
||||
#define BRIGHTNESS 127
|
||||
#define LED_TYPE WS2812B
|
||||
|
||||
@@ -74,6 +74,8 @@
|
||||
_DEFPIN_ARM(PC7, 7, C); // needed to compensate "Invalid pin specified" while compiling
|
||||
|
||||
#define NEOPIXEL_PIN -1 //PC7 // NEOPIXEL
|
||||
#define NEOPIXEL_TOOL_PIN -1 // for tools
|
||||
|
||||
#define NUM_LEDS 5 // number of Neopixel LEDS
|
||||
#define BRIGHTNESS 127
|
||||
#define LED_TYPE WS2812B
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
#endif
|
||||
|
||||
#define NEOPIXEL_PIN -1
|
||||
#define NEOPIXEL_TOOL_PIN -1 // for tools
|
||||
#define NUM_LEDS 5 // number of Neopixel LEDS
|
||||
#define BRIGHTNESS 127
|
||||
#define LED_TYPE WS2812B
|
||||
|
||||
@@ -200,6 +200,7 @@ typedef struct {
|
||||
char materials[MAX_TOOLS][MAX_MATERIAL_LEN];
|
||||
uint16_t purges[MAX_TOOLS];
|
||||
bool wipeBeforeUnload = false;
|
||||
uint8_t toolColor = 5;
|
||||
} SMuFFConfig;
|
||||
|
||||
#if defined(__BRD_I3_MINI)
|
||||
@@ -269,6 +270,7 @@ extern ClickEncoder encoder;
|
||||
#endif
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
extern CRGB leds[];
|
||||
extern CRGB ledsTool[];
|
||||
#else
|
||||
#endif
|
||||
#if defined(MULTISERVO)
|
||||
@@ -330,6 +332,8 @@ extern bool isWarning;
|
||||
extern bool lidOpen;
|
||||
extern uint16_t mmsMin, mmsMax;
|
||||
extern uint16_t speedIncrement;
|
||||
extern uint8_t fastLedHue;
|
||||
extern bool fastLedStatus;
|
||||
|
||||
#ifdef HAS_TMC_SUPPORT
|
||||
extern TMC2209Stepper* drivers[];
|
||||
@@ -474,6 +478,7 @@ extern void blinkLED();
|
||||
#ifdef HAS_TMC_SUPPORT
|
||||
extern void setDriverSpreadCycle(TMC2209Stepper* driver, bool spread, uint8_t stallThrs, uint8_t csmin=0, uint8_t csmax=0, uint8_t csdown=0, uint8_t toff=3);
|
||||
#endif
|
||||
void waitFor(uint32_t ms);
|
||||
|
||||
extern void printEndstopState(int8_t serial);
|
||||
extern void printPos(int8_t index, int8_t serial);
|
||||
@@ -518,8 +523,13 @@ extern void showLed(uint8_t mode, uint8_t count);
|
||||
extern void setBacklightIndex(int color);
|
||||
extern void setFastLED(uint8_t index, CRGB color);
|
||||
extern void setFastLEDIndex(uint8_t index, uint8_t color);
|
||||
extern void setFastLEDToolIndex(uint8_t index, uint8_t color);
|
||||
extern void setFastLEDTools();
|
||||
extern void setFastLEDIntensity(uint8_t intensity);
|
||||
extern void testFastLED();
|
||||
extern void setFastLEDToolsStatus(uint8_t status);
|
||||
extern void setFastLEDToolsMarquee();
|
||||
extern void setFastLEDToolsRainbow();
|
||||
|
||||
extern void showDuetLS();
|
||||
extern void switchFeederStepper(uint8_t stepper);
|
||||
|
||||
@@ -86,7 +86,6 @@ build_unflags = -std=gnu++11
|
||||
lib_deps = # SD-Card file system library
|
||||
#SdFs
|
||||
https://github.com/greiman/SdFat
|
||||
#https://github.com/stevstrong/SdFat@=1.1.4 # Removed because it include itoa.h that is not found....
|
||||
# JSON library for the configuration file
|
||||
ArduinoJson@6
|
||||
# LC-Display library
|
||||
|
||||
@@ -130,7 +130,9 @@ bool readConfig()
|
||||
uint8_t _contrast = jsonDoc[contrast];
|
||||
smuffConfig.lcdContrast = (_contrast >= MIN_CONTRAST && _contrast <= MAX_CONTRAST) ? _contrast : DSP_CONTRAST;
|
||||
uint8_t _backlightColor = jsonDoc[backlightColor];
|
||||
smuffConfig.backlightColor = (_backlightColor == 0 ? 7 : _backlightColor); // set backlight color to white if not set
|
||||
smuffConfig.backlightColor = (_backlightColor == 0 ? 7 : _backlightColor); // set backlight color to White if not set
|
||||
uint8_t _toolColor = jsonDoc[toolColor];
|
||||
smuffConfig.toolColor = (_toolColor == 0 ? 5 : _toolColor); // set tool color to Magenta if not set
|
||||
smuffConfig.encoderTickSound = jsonDoc[encoderTicks];
|
||||
smuffConfig.bowdenLength = jsonDoc[bowdenLength];
|
||||
smuffConfig.selectorDistance = jsonDoc[selectorDist];
|
||||
@@ -513,6 +515,7 @@ bool writeConfig(Print* dumpTo) {
|
||||
jsonDoc[periodicalStats] = smuffConfig.sendPeriodicalStats;
|
||||
jsonDoc[wipeSequence] = smuffConfig.wipeSequence;
|
||||
jsonDoc[backlightColor] = smuffConfig.backlightColor;
|
||||
jsonDoc[toolColor] = smuffConfig.toolColor;
|
||||
jsonDoc[encoderTicks] = smuffConfig.encoderTickSound;
|
||||
jsonDoc[lButtonDown] = smuffConfig.lButtonDown;
|
||||
jsonDoc[lButtonHold] = smuffConfig.lButtonHold;
|
||||
|
||||
@@ -52,7 +52,10 @@ void saveStore() {
|
||||
serializeJsonPretty(jsonDoc, cfg);
|
||||
}
|
||||
cfg.close();
|
||||
//__debugS(PSTR("DataStore updated"));
|
||||
//__debugS(PSTR("%s updated."), DATASTORE_FILE);
|
||||
}
|
||||
else {
|
||||
__debugS(PSTR("ERROR: %s not updated. Can't init SD-Card!"), DATASTORE_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -859,6 +859,12 @@ bool M150(const char* msg, String buf, int8_t serial) {
|
||||
if((param = getParam(buf, C_Param)) != -1) {
|
||||
colorNdx = (int8_t)param;
|
||||
}
|
||||
if((param = getParam(buf, T_Param)) != -1) {
|
||||
index = (int8_t)param;
|
||||
setFastLEDIntensity(intensity);
|
||||
setFastLEDToolIndex(index, colorNdx);
|
||||
return true;
|
||||
}
|
||||
setFastLEDIntensity(intensity);
|
||||
if(colorNdx != -1) {
|
||||
if(index == -1)
|
||||
@@ -2044,12 +2050,14 @@ bool G1(const char* msg, String buf, int8_t serial) {
|
||||
bool G4(const char* msg, String buf, int8_t serial) {
|
||||
bool stat = true;
|
||||
printResponse(msg, serial);
|
||||
long val;
|
||||
if((param = getParam(buf, S_Param)) != -1) {
|
||||
if(param > 0 && param < 500)
|
||||
delay(param*1000);
|
||||
if(param > 0 && param < 500) {
|
||||
waitFor(param*1000);
|
||||
}
|
||||
}
|
||||
else if((param = getParam(buf, P_Param)) != -1) {
|
||||
delay(param);
|
||||
else if((val = getParamL(buf, P_Param)) != -1) {
|
||||
waitFor(val);
|
||||
}
|
||||
else {
|
||||
stat = false;
|
||||
|
||||
@@ -125,6 +125,7 @@ void getInput(int16_t* turn, uint8_t* button, bool* isHeld, bool* isClicked, boo
|
||||
if(checkSerial)
|
||||
checkSerialPending();
|
||||
#endif
|
||||
setFastLEDTools();
|
||||
getEncoderButton(turn, button, isHeld, isClicked);
|
||||
if(*isClicked || *isHeld || *turn != 0) {
|
||||
if(smuffConfig.encoderTickSound)
|
||||
|
||||
79
src/Led.cpp
79
src/Led.cpp
@@ -18,9 +18,17 @@
|
||||
*/
|
||||
#include "SMuFF.h"
|
||||
|
||||
#define FADE_SPEED 80
|
||||
#define FADE_SPEED_MARQUEE 30
|
||||
|
||||
uint8_t last_index, last_color;
|
||||
bool fastLedStatus = false;
|
||||
uint8_t colorMap[8] PROGMEM = { 0, 1, 2, 4, 6, 5, 3, 7 };
|
||||
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
CRGB leds[NUM_LEDS];
|
||||
static CRGB ColorsFastLED[8] = { CRGB::Black, CRGB::Red, CRGB::Green, CRGB::Blue, CRGB::Cyan, CRGB::Magenta, CRGB::Yellow, CRGB::White };
|
||||
CRGB ledsTool[MAX_TOOLS];
|
||||
const CRGB ColorsFastLED[8] PROGMEM = { CRGB::Black, CRGB::Red, CRGB::Green, CRGB::Blue, CRGB::Cyan, CRGB::Magenta, CRGB::Yellow, CRGB::White };
|
||||
#endif
|
||||
|
||||
// simulate beeps with different LEDs on LeoNerd display
|
||||
@@ -45,8 +53,6 @@ void showLed(uint8_t mode, uint8_t count) {
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t colorMap[8] PROGMEM = { 0, 1, 2, 4, 6, 5, 3, 7 };
|
||||
|
||||
void setBacklightRGB(uint8_t color) {
|
||||
if(color >= 0 && color <= 7) {
|
||||
#if defined(RGB_LED_R_PIN)
|
||||
@@ -84,20 +90,75 @@ void setBacklightCRGB(CRGB color) {
|
||||
void setFastLED(uint8_t index, CRGB color) {
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
leds[index] = color;
|
||||
FastLED.show();
|
||||
#endif
|
||||
}
|
||||
|
||||
void setFastLEDIndex(uint8_t index, uint8_t color) {
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
leds[index] = ColorsFastLED[color];
|
||||
FastLED.show();
|
||||
leds[index] = ColorsFastLED[color];
|
||||
#endif
|
||||
}
|
||||
|
||||
void setFastLEDToolsStatus(uint8_t status) {
|
||||
fastLedStatus = true;
|
||||
switch(status) {
|
||||
case 0: fastLedStatus = false; setFastLEDTools(); break;
|
||||
case 1: setFastLEDToolsMarquee(); break;
|
||||
case 2: setFastLEDToolsRainbow(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void setFastLEDToolsRainbow() {
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
// FastLED's built-in rainbow generator
|
||||
fill_rainbow(ledsTool, smuffConfig.toolCount, fastLedHue);
|
||||
#endif
|
||||
}
|
||||
|
||||
void setFastLEDToolsMarquee() {
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
uint8_t bpm = 10;
|
||||
static uint32_t lastUpdate;
|
||||
if((millis()-lastUpdate) < 20)
|
||||
return;
|
||||
lastUpdate = millis();
|
||||
// taken from: Sinelon by Kriegsman (https://gist.github.com/kriegsman/261beecba85519f4f934)
|
||||
fadeToBlackBy(ledsTool, smuffConfig.toolCount, FADE_SPEED_MARQUEE);
|
||||
int8_t pos = beatsin16(bpm, 0, smuffConfig.toolCount);
|
||||
static int8_t prevpos = 0;
|
||||
if( pos < prevpos ) {
|
||||
fill_solid(ledsTool+pos, (prevpos-pos)+1, CHSV(fastLedHue, 220, 255));
|
||||
}
|
||||
else {
|
||||
fill_solid(ledsTool+prevpos, (pos-prevpos)+1, CHSV(fastLedHue, 220, 255));
|
||||
}
|
||||
prevpos = pos;
|
||||
#endif
|
||||
}
|
||||
|
||||
void setFastLEDTools() {
|
||||
setFastLEDToolIndex(last_index, last_color);
|
||||
}
|
||||
|
||||
void setFastLEDToolIndex(uint8_t index, uint8_t color) {
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
if(fastLedStatus) {
|
||||
last_index = index;
|
||||
last_color = color;
|
||||
return;
|
||||
}
|
||||
fadeToBlackBy(ledsTool, smuffConfig.toolCount, FADE_SPEED);
|
||||
if(index >= 0 && index < smuffConfig.toolCount) {
|
||||
ledsTool[smuffConfig.toolCount-index-1] = ColorsFastLED[color];
|
||||
last_index = index;
|
||||
last_color = color;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void setFastLEDIntensity(uint8_t intensity) {
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
FastLED.setBrightness(intensity);
|
||||
FastLED.setBrightness(intensity);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -117,5 +178,9 @@ void testFastLED() {
|
||||
delay(250);
|
||||
leds[i] = ColorsFastLED[0];
|
||||
}
|
||||
// set black as active tool color
|
||||
for(uint8_t i=0; i< smuffConfig.toolCount; i++) {
|
||||
ledsTool[i] = ColorsFastLED[0];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -159,6 +159,8 @@ volatile bool sdRemoved = false;
|
||||
uint16_t mmsMin = 1; // minimum moving speed for stepper in mm/s
|
||||
uint16_t mmsMax = 800; // maximum moving speed for stepper in mm/s
|
||||
uint16_t speedIncrement = 5; // increment for speeds in menus
|
||||
uint8_t fastLedHue = 0;
|
||||
uint32_t lastEvent = 0;
|
||||
|
||||
|
||||
static volatile uint16_t intervalMask; // bit-mask for interval reached
|
||||
@@ -293,6 +295,12 @@ void isrGPTimerHandler() {
|
||||
FLIPDBG
|
||||
#endif
|
||||
isrFanTimerHandler(); // call the fan interrupt routines also every 1ms
|
||||
#if defined(USE_FASTLED_BACKLIGHT)
|
||||
if(initDone && (tickCounter % 400 == 0)) {
|
||||
FastLED.show(); // refresh Neopixels every 20ms to allow fading and stuff
|
||||
fastLedHue++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(tickCounter == 1000) // reset counter to avoid overrun
|
||||
tickCounter = 0;
|
||||
@@ -639,6 +647,7 @@ void fncKey4() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
// Call periodical functions as the timeout has reached.
|
||||
// Add your specific code there, if you need to have something
|
||||
// managed periodically.
|
||||
@@ -666,6 +675,7 @@ void loop() {
|
||||
char tmp[50];
|
||||
sprintf_P(tmp, P_SDCardRemoved);
|
||||
drawUserMessage(tmp);
|
||||
setFastLEDToolsStatus(2);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -673,6 +683,7 @@ void loop() {
|
||||
if(initSD(false)) {
|
||||
sdRemoved = false;
|
||||
leoNerdBlinkRed = false;
|
||||
setFastLEDToolsStatus(0);
|
||||
refreshStatus(true, false);
|
||||
}
|
||||
}
|
||||
@@ -726,9 +737,12 @@ void loop() {
|
||||
}
|
||||
|
||||
getInput(&turn, &button, &isHeld, &isClicked);
|
||||
if(isPwrSave && (isClicked || turn != 0)) {
|
||||
setPwrSave(0);
|
||||
refreshStatus(true, false);
|
||||
if(isClicked || turn != 0) {
|
||||
if(isPwrSave) {
|
||||
setPwrSave(0);
|
||||
refreshStatus(true, false);
|
||||
}
|
||||
lastEvent = millis();
|
||||
}
|
||||
|
||||
if((button == MainButton && isClicked) || (button == WheelButton && isHeld)) {
|
||||
@@ -776,6 +790,12 @@ void loop() {
|
||||
refreshStatus(true, false);
|
||||
setPwrSave(1);
|
||||
}
|
||||
if((millis() - lastEvent)/1000 >= (unsigned long)smuffConfig.powerSaveTimeout) {
|
||||
setFastLEDToolsStatus(1);
|
||||
}
|
||||
else {
|
||||
setFastLEDToolsStatus(0);
|
||||
}
|
||||
|
||||
#ifdef HAS_TMC_SUPPORT
|
||||
if(smuffConfig.stepperStall[SELECTOR]) {
|
||||
@@ -788,6 +808,7 @@ void loop() {
|
||||
monitorTMC(FEEDER);
|
||||
}
|
||||
#endif
|
||||
|
||||
// For testing only
|
||||
// loopEx();
|
||||
}
|
||||
@@ -818,19 +839,25 @@ bool checkUserMessage() {
|
||||
void checkSerialPending() {
|
||||
if(Serial.available()) {
|
||||
serialEvent();
|
||||
lastEvent = millis();
|
||||
}
|
||||
if(CAN_USE_SERIAL1) {
|
||||
if(Serial1.available())
|
||||
if(Serial1.available()) {
|
||||
serialEvent1();
|
||||
lastEvent = millis();
|
||||
}
|
||||
}
|
||||
if(CAN_USE_SERIAL2) {
|
||||
if(Serial2.available()) {
|
||||
serialEvent2();
|
||||
lastEvent = millis();
|
||||
}
|
||||
}
|
||||
if(CAN_USE_SERIAL3) {
|
||||
if(Serial3.available())
|
||||
if(Serial3.available()) {
|
||||
serialEvent3();
|
||||
lastEvent = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -579,6 +579,7 @@ bool moveHome(int8_t index, bool showMessage, bool checkFeeder) {
|
||||
|
||||
//__debugS(PSTR("DONE Stepper home"));
|
||||
if (index == SELECTOR) {
|
||||
setFastLEDToolIndex(toolSelected, 0);
|
||||
toolSelected = -1;
|
||||
}
|
||||
long pos = steppers[index].getStepPosition();
|
||||
@@ -1534,6 +1535,8 @@ bool selectTool(int8_t ndx, bool showMessage) {
|
||||
dataStore.stepperPos[REVOLVER] = steppers[REVOLVER].getStepPosition();
|
||||
dataStore.stepperPos[FEEDER] = steppers[FEEDER].getStepPosition();
|
||||
saveStore();
|
||||
setFastLEDToolIndex(toolSelected, smuffConfig.toolColor);
|
||||
|
||||
//__debugS(PSTR("Data stored"));
|
||||
|
||||
if (showMessage && (!smuffConfig.extControlFeeder || (smuffConfig.extControlFeeder && smuffConfig.isSharedStepper))) {
|
||||
@@ -1656,7 +1659,6 @@ void printDriverStallThrs(int8_t serial) {
|
||||
drivers[FEEDER] == nullptr ? P_Unknown : String(drivers[FEEDER]->SGTHRS()).c_str());
|
||||
printResponse(tmp, serial);
|
||||
}
|
||||
#endif
|
||||
|
||||
void printEndstopState(int8_t serial) {
|
||||
char tmp[128];
|
||||
@@ -2033,6 +2035,7 @@ void getStoredData() {
|
||||
steppers[REVOLVER].setStepPosition(dataStore.stepperPos[REVOLVER]);
|
||||
steppers[FEEDER].setStepPosition(dataStore.stepperPos[FEEDER]);
|
||||
toolSelected = dataStore.tool;
|
||||
setFastLEDToolIndex(toolSelected, smuffConfig.toolColor);
|
||||
//__debugS(PSTR("Recovered tool: %d"), toolSelected);
|
||||
}
|
||||
|
||||
@@ -2268,6 +2271,9 @@ void testRun(const char* fname) {
|
||||
} while(tool == lastTool);
|
||||
gCode.replace("{RNDT}", String(tool));
|
||||
}
|
||||
if(gCode.indexOf("{RNDTL}") >-1) {
|
||||
gCode.replace("{RNDTL}", String(tool));
|
||||
}
|
||||
parseGcode(gCode, -1);
|
||||
//__debugS(PSTR("GCode: %s"), gCode.c_str());
|
||||
if(*line=='T') {
|
||||
@@ -2309,10 +2315,6 @@ void testRun(const char* fname) {
|
||||
break;
|
||||
}
|
||||
drawTestrunMessage(loopCnt, msg);
|
||||
getInput(&turn, &btn, &isHeld, &isClicked, false);
|
||||
if(isHeld || isClicked) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
#if defined(USE_LEONERD_DISPLAY)
|
||||
@@ -2327,6 +2329,15 @@ void testRun(const char* fname) {
|
||||
}
|
||||
}
|
||||
|
||||
void waitFor(uint32_t ms) {
|
||||
uint32_t start = millis();
|
||||
do {
|
||||
uint32_t now = millis()-start;
|
||||
if(now >= ms)
|
||||
break;
|
||||
} while(1);
|
||||
}
|
||||
|
||||
void listTextFile(const char* filename PROGMEM, int8_t serial) {
|
||||
SdFile file;
|
||||
char line[80];
|
||||
|
||||
@@ -101,11 +101,21 @@ void readSequences() {
|
||||
/*
|
||||
Initialize FastLED library for NeoPixels.
|
||||
Primarily used for backlight on some displays (i.e. FYSETC 12864 Mini V2.1)
|
||||
but also for the tool status if wired and defined.
|
||||
*/
|
||||
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);
|
||||
__debugS(PSTR("FastLED initialized"));
|
||||
#else
|
||||
__debugS(PSTR("FastLED not enabled. Neopixel Pin: %d"), NEOPIXEL_PIN);
|
||||
#endif
|
||||
#if NEOPIXEL_TOOL_PIN != -1 && defined(USE_FASTLED_BACKLIGHT)
|
||||
FastLED.addLeds<LED_TYPE, NEOPIXEL_TOOL_PIN, COLOR_ORDER>(ledsTool, smuffConfig.toolCount).setCorrection(TypicalLEDStrip);
|
||||
FastLED.setBrightness(BRIGHTNESS);
|
||||
__debugS(PSTR("FastLED for tools initialized"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; --------------------------------------------
|
||||
; SMuFF test script for 5 tools
|
||||
; --------------------------------------------
|
||||
M205 P"EmulatePrusa" S1
|
||||
M205 P"EmulPrusa" S1
|
||||
G28
|
||||
G4 S2
|
||||
T0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; --------------------------------------------
|
||||
; SMuFF test script for 9 tools
|
||||
; --------------------------------------------
|
||||
M205 P"EmulatePrusa" S1
|
||||
M205 P"EmulPrusa" S1
|
||||
G28
|
||||
G4 S3
|
||||
T0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; SMuFF test script for random tools selects
|
||||
; The {RNDT} parameter gets replaced dynamically
|
||||
; --------------------------------------------
|
||||
M205 P"EmulatePrusa" S1
|
||||
M205 P"EmulPrusa" S1
|
||||
G28
|
||||
G4 S1
|
||||
T{RNDT}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
; SMuFF test script for random Revolver positioning
|
||||
; The {RNDT} parameter gets replaced dynamically
|
||||
; --------------------------------------------
|
||||
M205 P"ResetBeforeFeed" S0
|
||||
M205 P"HomeAfterFeed" S0
|
||||
M205 P"EmulatePrusa" S1
|
||||
M205 P"ResetBeforeFd" S0
|
||||
M205 P"HomeAfterFd" S0
|
||||
M205 P"EmulPrusa" S1
|
||||
G28 Y
|
||||
G4 S1
|
||||
G0 Y0
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
; SMuFF test script for random Revolver positioning
|
||||
; The {RNDT} parameter gets replaced dynamically
|
||||
; --------------------------------------------
|
||||
M205 P"ResetBeforeFeed" S0
|
||||
M205 P"HomeAfterFeed" S0
|
||||
M205 P"EmulatePrusa" S1
|
||||
M205 P"ResetBeforeFd" S0
|
||||
M205 P"HomeAfterFd" S0
|
||||
M205 P"EmulPrusa" S1
|
||||
G28 Y
|
||||
G4 S1
|
||||
G0 Y0
|
||||
|
||||
Reference in New Issue
Block a user