Skip to content

Commit

Permalink
Merge branch 'MK3_sm_MeatPack_WhiteSpace' into MK3_sm_MeatPack
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmudge committed Jan 20, 2021
2 parents b45d0ec + ebf039c commit 2a16ac3
Show file tree
Hide file tree
Showing 15 changed files with 525 additions and 194 deletions.
2 changes: 1 addition & 1 deletion Firmware/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ enum CalibrationStatus
// Try to maintain a minimum distance from the bed even when Z is
// unknown when doing the following operations
#define MIN_Z_FOR_LOAD 50
#define MIN_Z_FOR_UNLOAD 20
#define MIN_Z_FOR_UNLOAD 50
#define MIN_Z_FOR_PREHEAT 10

#include "Configuration_adv.h"
Expand Down
36 changes: 19 additions & 17 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5974,28 +5974,30 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
/*!
### M46 - Show the assigned IP address <a href="https://reprap.org/wiki/G-code#M46:_Show_the_assigned_IP_address">M46: Show the assigned IP address.</a>
*/
/*
case 46:
case 46:
{
// M46: Prusa3D: Show the assigned IP address.
uint8_t ip[4];
bool hasIP = card.ToshibaFlashAir_GetIP(ip);
if (hasIP) {
SERIAL_ECHOPGM("Toshiba FlashAir current IP: ");
SERIAL_ECHO(int(ip[0]));
SERIAL_ECHOPGM(".");
SERIAL_ECHO(int(ip[1]));
SERIAL_ECHOPGM(".");
SERIAL_ECHO(int(ip[2]));
SERIAL_ECHOPGM(".");
SERIAL_ECHO(int(ip[3]));
SERIAL_ECHOLNPGM("");
if (card.ToshibaFlashAir_isEnabled()) {
uint8_t ip[4];
bool hasIP = card.ToshibaFlashAir_GetIP(ip);
if (hasIP) {
// SERIAL_PROTOCOLPGM("Toshiba FlashAir current IP: ");
SERIAL_PROTOCOL(int(ip[0]));
SERIAL_PROTOCOLPGM(".");
SERIAL_PROTOCOL(int(ip[1]));
SERIAL_PROTOCOLPGM(".");
SERIAL_PROTOCOL(int(ip[2]));
SERIAL_PROTOCOLPGM(".");
SERIAL_PROTOCOL(int(ip[3]));
SERIAL_PROTOCOLPGM("\n");
} else {
SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n");
}
} else {
SERIAL_ECHOLNPGM("Toshiba FlashAir GetIP failed");
SERIAL_PROTOCOLPGM("n/a\n");
}
break;
}
*/

/*!
### M47 - Show end stops dialog on the display <a href="https://reprap.org/wiki/G-code#M47:_Show_end_stops_dialog_on_the_display">M47: Show end stops dialog on the display</a>
Expand Down Expand Up @@ -9572,7 +9574,7 @@ static uint16_t nFSCheckCount=0;
bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active
#endif // IR_SENSOR_ANALOG
#endif // IR_SENSOR
if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active
if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag) && (menu_menu != lcd_move_e)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active
{
if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE))
{
Expand Down
5 changes: 4 additions & 1 deletion Firmware/Sd2Card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,17 @@ uint8_t Sd2Card::waitStartBlock(void) {

// Toshiba FlashAir support, copied from
// https://flashair-developers.com/en/documents/tutorials/arduino/
// However, the official website was closed in September 2019.
// There is an archived website (written in Japanese).
// https://flashair-developers.github.io/website/docs/tutorials/arduino/2.html

//------------------------------------------------------------------------------
/** Perform Extention Read. */
uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) {
uint16_t i;

// send command and argument.
if (cardCommand(CMD48, arg)) {
if (cardCommand(CMD48, arg) && cardCommand(CMD17, arg)) { // CMD48 for W-03, CMD17 for W-04
error(SD_CARD_ERROR_CMD48);
goto fail;
}
Expand Down
24 changes: 17 additions & 7 deletions Firmware/cmdqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,32 @@ extern bool is_buffer_empty();
extern void get_command();
extern uint16_t cmdqueue_calc_sd_length();


#if defined(__cplusplus)
extern "C" {
#endif
extern double strtod_noE(const char* nptr, char** endptr);
#if defined(__cplusplus)
}
#endif

// Return True if a character was found
static inline bool code_seen(char code) { return (strchr_pointer = strchr(CMDBUFFER_CURRENT_STRING, code)) != NULL; }
static inline bool code_seen(const char *code) { return (strchr_pointer = strstr(CMDBUFFER_CURRENT_STRING, code)) != NULL; }
static inline float code_value() { return strtod(strchr_pointer+1, NULL);}
static inline float code_value() { return strtod_noE(strchr_pointer+1, NULL);}
static inline long code_value_long() { return strtol(strchr_pointer+1, NULL, 10); }
static inline int16_t code_value_short() { return int16_t(strtol(strchr_pointer+1, NULL, 10)); };
static inline uint8_t code_value_uint8() { return uint8_t(strtol(strchr_pointer+1, NULL, 10)); };

static inline float code_value_float()
{
char* e = strchr(strchr_pointer, 'E');
if (!e) return strtod(strchr_pointer + 1, NULL);
*e = 0;
float ret = strtod(strchr_pointer + 1, NULL);
*e = 'E';
return ret;
// A correct version of strtod() has been implemented, this hack is unnecessary.
//char* e = strchr(strchr_pointer, 'E');
//if (!e) return strtod(strchr_pointer + 1, NULL);
//*e = 0;
//float ret = strtod(strchr_pointer + 1, NULL);
//*e = 'E';
return strtod_noE(strchr_pointer + 1, NULL);
}


Expand Down
56 changes: 2 additions & 54 deletions Firmware/eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,9 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0FF1h 4081 | uint32 | EEPROM_FILAMENTUSED | ??? | 00 00 00 00h 0 __S/P__| Filament used in meters | ??? | D3 Ax0ff1 C4
| 0x0FEDh 4077 | uint32 | EEPROM_TOTALTIME | ??? | 00 00 00 00h 0 __S/P__| Total print time | ??? | D3 Ax0fed C4
| 0x0FE5h 4069 | float | EEPROM_BED_CALIBRATION_CENTER | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fe5 C8
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0FDDh 4061 | float | EEPROM_BED_CALIBRATION_VEC_X | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fdd C8
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0FD5h 4053 | float | EEPROM_BED_CALIBRATION_VEC_Y | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fd5 C8
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0FC5h 4037 | int16 | EEPROM_BED_CALIBRATION_Z_JITTER | ??? | ff ffh 65535 | ??? | ??? | D3 Ax0fc5 C16
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0FC4h 4036 | bool | EEPROM_FARM_MODE | 00h 0 | ffh 255 __P__ | Prusa farm mode: __off__ | G99 | D3 Ax0fc4 C1
| ^ | ^ | ^ | 01h 1 | ^ | Prusa farm mode: __on__ | G98 | ^
| 0x0FC3h 4035 | free | _EEPROM_FREE_NR1_ | ??? | ffh 255 | _Free EEPROM space_ | _free space_ | D3 Ax0fc3 C1
Expand All @@ -129,10 +119,6 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 01h 1 | ^ | Toshiba Air: __on__ | ^ | ^
| 0x0FBAh 4026 | uchar | EEPROM_PRINT_FLAG | ??? | ??? | _unsued_ | ??? | D3 Ax0fba C1
| 0x0FB0h 4016 | int16 | EEPROM_PROBE_TEMP_SHIFT | ??? | ??? | ??? | ??? | D3 Ax0fb0 C10
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0FAFh 4015 | bool | EEPROM_TEMP_CAL_ACTIVE | 00h 0 | 00h 0 | PINDA Temp cal.: __inactive__ | LCD menu | D3 Ax0faf C1
| ^ | ^ | ^ | ffh 255 | ^ | PINDA Temp cal.: __active__ | ^ | ^
| 0x0FA7h 4007 | uint32 | EEPROM_BOWDEN_LENGTH | ??? | ff 00 00 00h | Bowden length | ??? | D3 Ax0fae C8
Expand All @@ -143,16 +129,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 01h 1 | ^ | Power Panic flag: __active__ | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | Power Panic flag: __???__ | ^ | ^
| 0x0F9Dh 3997 | float | EEPROM_UVLO_CURRENT_POSITION | ??? | ffh 255 | Power Panic position | ??? | D3 Ax0f9d C8
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0F95h 3989 | char | EEPROM_FILENAME | ??? | ffh 255 | Power Panic Filename | ??? | D3 Ax0f95 C8
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0F91h 39851 | uint32 | EEPROM_FILE_POSITION | ??? | ff ff ff ffh | Power Panic File Position | ??? | D3 Ax0f91 C4
| 0x0F91h 3985 | uint32 | EEPROM_FILE_POSITION | ??? | ff ff ff ffh | Power Panic File Position | ??? | D3 Ax0f91 C4
| 0x0F8Dh 3981 | float | EEPROM_UVLO_CURRENT_POSITION_Z | ??? | ff ff ff ffh | Power Panic Z Position | ^ | D3 Ax0f8d C4
| 0x0F8Ch 3980 | ??? | EEPROM_UVLO_UNUSED_001 | ??? | ffh 255 | Power Panic _unused_ | ^ | D3 Ax0f8c C1
| 0x0F8Bh 3979 | uint8 | EEPROM_UVLO_TARGET_BED | ??? | ffh 255 | Power Panic Bed temperature | ^ | D3 Ax0f8b C1
Expand All @@ -161,14 +139,6 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0F87h 3975 | uint8 | EEPROM_FAN_CHECK_ENABLED | 00h 0 | ??? | Fan Check __disabled__ | LCD menu | D3 Ax0f87 C1
| ^ | ^ | ^ | 01h 1 | ffh 255 | Fan Check __enabled__ | ^ | ^
| 0x0F75h 3957 | uint16 | EEPROM_UVLO_MESH_BED_LEVELING | ??? | ff ffh 65535 | Power Panic Mesh Bed Leveling | ??? | D3 Ax0f75 C18
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ^ | ^ | ^ | ^ | ^
| 0x0F73h 3955 | uint16 | EEPROM_UVLO_Z_MICROSTEPS | ??? | ff ffh 65535 | Power Panic Z microsteps | ??? | D3 Ax0f73 C2
| 0x0F72h 3954 | uint8 | EEPROM_UVLO_E_ABS | ??? | ffh 255 | Power Panic ??? position | ??? | D3 Ax0f72 C1
| 0x0F6Eh 3950 | foat | EEPROM_UVLO_CURRENT_POSITION_E | ??? | ff ff ff ffh | Power Panic E position | ??? | D3 Ax0f6e C4
Expand Down Expand Up @@ -203,7 +173,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0F01h 3841 | uint16 | EEPROM_FERROR_COUNT_TOT | 0000-fffe | ff ffh __S/P__ | Total filament sensor errors | ??? | D3 Ax0f01 C2
| 0x0EFFh 3839 | uint16 | EEPROM_POWER_COUNT_TOT | 0000-fffe | ff ffh __S/P__ | Total power failures | ??? | D3 Ax0eff C2
| 0x0EFEh 3838 | uint8 | EEPROM_TMC2130_HOME_X_ORIGIN | ??? | ffh 255 | ??? | ??? | D3 Ax0efe C1
| 0x0EFDh 3837 | uint8 | EEPROM MC2130_HOME_X_BSTEPS | ??? | ffh 255 | ??? | ??? | D3 Ax0efd C1
| 0x0EFDh 3837 | uint8 | EEPROM MC2130_HOME_X_BSTEPS | ??? | ffh 255 | ??? | ??? | D3 Ax0efd C1
| 0x0EFCh 3836 | uint8 | EEPROM_TMC2130_HOME_X_FSTEPS | ??? | ffh 255 | ??? | ??? | D3 Ax0efc C1
| 0x0EFBh 3835 | uint8 | EEPROM_TMC2130_HOME_Y_ORIGIN | ??? | ffh 255 | ??? | ??? | D3 Ax0efb C1
| 0x0EFAh 3834 | uint8 | EEPROM_TMC2130_HOME_Y_BSTEPS | ??? | ffh 255 | ??? | ??? | D3 Ax0efa C1
Expand Down Expand Up @@ -257,28 +227,6 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 01h 1 | ^ | MMU2/s cutter: __enabled__ | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | MMU2/s cutter: __always__ | ^ | ^
| 0x0DAE 3502 | uint16 | EEPROM_UVLO_MESH_BED_LEVELING_FULL | ??? | ff ffh 65535 | Power panic Mesh bed leveling points | ??? | D3 Ax0dae C288
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| ^ | ^ | ^ | ??? | ^ | ^ | ^ | ^
| 0x0DAD 3501 | uint8 | EEPROM_MBL_TYPE | ??? | ffh 255 | Mesh bed leveling precision _unused atm_ | ??? | D3 Ax0dad C1
| 0x0DAC 3500 | bool | EEPROM_MBL_MAGNET_ELIMINATION | 01h 1 | ffh 255 | Mesh bed leveling does: __ignores__ magnets | LCD menu | D3 Ax0dac C1
| ^ | ^ | ^ | 00h 0 | ^ | Mesh bed leveling does: __NOT ignores__ magnets | ^ | ^
Expand Down
4 changes: 2 additions & 2 deletions Firmware/fsensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void fsensor_autoload_check_start(void)
printf_P(ERRMSG_PAT9125_NOT_RESP, 3);
return;
}
puts_P(_N("fsensor_autoload_check_start - autoload ENABLED\n"));
puts_P(_N("fsensor_autoload_check_start - autoload ENABLED"));
fsensor_autoload_y = pat9125_y; //save current y value
fsensor_autoload_c = 0; //reset number of changes counter
fsensor_autoload_sum = 0;
Expand All @@ -334,7 +334,7 @@ void fsensor_autoload_check_stop(void)
if (!fsensor_autoload_enabled) return;
// puts_P(_N("fsensor_autoload_check_stop 2\n"));
if (!fsensor_watch_autoload) return;
puts_P(_N("fsensor_autoload_check_stop - autoload DISABLED\n"));
puts_P(_N("fsensor_autoload_check_stop - autoload DISABLED"));
fsensor_autoload_sum = 0;
fsensor_watch_autoload = false;
fsensor_watch_runout = true;
Expand Down
20 changes: 12 additions & 8 deletions Firmware/meatpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ uint8_t mp_char_out_count = 0; // Stores number of characters to be read out
#ifdef USE_LOOKUP_TABLE
// The 15 most-common characters used in G-code, ~90-95% of all g-code uses these characters
// NOT storing this with PROGMEM, given how frequently this table will be accessed.
uint8_t MeatPackLookupTbl[16] = {
volatile uint8_t MeatPackLookupTbl[16] = {
'0', // 0000
'1', // 0001
'2', // 0010
Expand Down Expand Up @@ -160,11 +160,10 @@ void FORCE_INLINE mp_handle_output_char(const uint8_t c) {
mp_char_out_buf[mp_char_out_count++] = c;

#ifdef MP_DEBUG
if (mp_chars_decoded < 64) {
if (mp_chars_decoded < 4096) {
++mp_chars_decoded;
SERIAL_ECHOPGM("Rec Byte: ");
MYSERIAL.print("0x");
MYSERIAL.print((uint8_t)c, HEX);
SERIAL_ECHOPGM("RB: ");
MYSERIAL.print((char)c);
SERIAL_ECHOLNPGM("");
}
#endif
Expand Down Expand Up @@ -243,8 +242,10 @@ void FORCE_INLINE mp_handle_rx_char_inner(const uint8_t c) {
}
else {
mp_handle_output_char(buf[0]);
if (res & MeatPack_NextPackedSecond) ++mp_full_char_queue;
else mp_handle_output_char(buf[1]);
if (buf[0] != '\n') {
if (res & MeatPack_NextPackedSecond) ++mp_full_char_queue;
else mp_handle_output_char(buf[1]);
}
}
}
}
Expand Down Expand Up @@ -275,7 +276,10 @@ void FORCE_INLINE mp_echo_config_state() {

// Validate config vars
#ifdef USE_LOOKUP_TABLE
MeatPackLookupTbl[MeatPack_SpaceCharIdx] = (uint8_t)((mp_config & MPConfig_NoSpaces) ? MeatPack_SpaceCharReplace : ' ');
if (mp_config & MPConfig_NoSpaces)
MeatPackLookupTbl[MeatPack_SpaceCharIdx] = (uint8_t)(MeatPack_SpaceCharReplace);
else
MeatPackLookupTbl[MeatPack_SpaceCharIdx] = ' ';
#endif

}
Expand Down
2 changes: 1 addition & 1 deletion Firmware/sm4.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ uint16_t sm4_line_xyze_ui(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de)
}
if (ce <= de)
{
sm |= 4;
sm |= 8;
ce += dd;
e++;
}
Expand Down
Loading

0 comments on commit 2a16ac3

Please sign in to comment.