Skip to content

Commit

Permalink
Add invert Z axis in list menu and fix invert z axis g-code (#260)
Browse files Browse the repository at this point in the history
* update language keywords for invert z axis
* update minor firmware version number to 25.1
* add invert z axis to list mode and fix for z inverted z axis move command
  • Loading branch information
guruathwal authored and bigtreetech committed Dec 26, 2019
1 parent da07e46 commit 2a6211e
Show file tree
Hide file tree
Showing 22 changed files with 119 additions and 40 deletions.
13 changes: 13 additions & 0 deletions TFT/src/User/API/Language/Language.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const char *const en_pack[LABEL_NUM]={
EN_SMART,
EN_TERMINAL_ACK,
EN_INVERT_YAXIS,
EN_INVERT_ZAXIS,
EN_MOVE_SPEED,
};

Expand Down Expand Up @@ -333,6 +334,7 @@ const char *const cn_pack[LABEL_NUM]={
CN_SMART,
CN_TERMINAL_ACK,
CN_INVERT_YAXIS,
CN_INVERT_ZAXIS,
CN_MOVE_SPEED,
};

Expand Down Expand Up @@ -494,6 +496,7 @@ const char *const ru_pack[LABEL_NUM]={
RU_SMART,
RU_TERMINAL_ACK,
RU_INVERT_YAXIS,
RU_INVERT_ZAXIS,
RU_MOVE_SPEED,
};

Expand Down Expand Up @@ -655,6 +658,7 @@ const char *const jp_pack[LABEL_NUM]={
JP_SMART,
JP_TERMINAL_ACK,
JP_INVERT_YAXIS,
JP_INVERT_ZAXIS,
JP_MOVE_SPEED,
};

Expand Down Expand Up @@ -816,6 +820,7 @@ const char *const am_pack[LABEL_NUM]={
AM_SMART,
AM_TERMINAL_ACK,
AM_INVERT_YAXIS,
AM_INVERT_ZAXIS,
AM_MOVE_SPEED,
};

Expand Down Expand Up @@ -977,6 +982,7 @@ const char *const de_pack[LABEL_NUM]={
DE_SMART,
DE_TERMINAL_ACK,
DE_INVERT_YAXIS,
DE_INVERT_ZAXIS,
DE_MOVE_SPEED,
};

Expand Down Expand Up @@ -1138,6 +1144,7 @@ const char *const cz_pack[LABEL_NUM]={
CZ_SMART,
CZ_TERMINAL_ACK,
CZ_INVERT_YAXIS,
CZ_INVERT_ZAXIS,
CZ_MOVE_SPEED,
};

Expand Down Expand Up @@ -1299,6 +1306,7 @@ const char *const es_pack[LABEL_NUM]={
ES_SMART,
ES_TERMINAL_ACK,
ES_INVERT_YAXIS,
ES_INVERT_ZAXIS,
ES_MOVE_SPEED,
};

Expand Down Expand Up @@ -1460,6 +1468,7 @@ const char *const fr_pack[LABEL_NUM]={
FR_SMART,
FR_TERMINAL_ACK,
FR_INVERT_YAXIS,
FR_INVERT_ZAXIS,
FR_MOVE_SPEED,
};

Expand Down Expand Up @@ -1621,6 +1630,7 @@ const char *const pt_pack[LABEL_NUM]={
PT_SMART,
PT_TERMINAL_ACK,
PT_INVERT_YAXIS,
PT_INVERT_ZAXIS,
PT_MOVE_SPEED,
};

Expand Down Expand Up @@ -1782,6 +1792,7 @@ const char *const it_pack[LABEL_NUM]={
IT_SMART,
IT_TERMINAL_ACK,
IT_INVERT_YAXIS,
IT_INVERT_ZAXIS,
IT_MOVE_SPEED,
};

Expand Down Expand Up @@ -1943,6 +1954,7 @@ const char *const pl_pack[LABEL_NUM]={
PL_SMART,
PL_TERMINAL_ACK,
PL_INVERT_YAXIS,
PL_INVERT_ZAXIS,
PL_MOVE_SPEED,
};

Expand Down Expand Up @@ -2103,6 +2115,7 @@ const char *const sk_pack[LABEL_NUM]={
SK_SMART,
SK_TERMINAL_ACK,
SK_INVERT_YAXIS,
SK_INVERT_ZAXIS,
SK_MOVE_SPEED,
};

Expand Down
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ enum
LABEL_SMART,
LABEL_TERMINAL_ACK,
LABEL_INVERT_YAXIS,
LABEL_INVERT_ZAXIS,
LABEL_MOVE_SPEED,

//add new keywords above this line only
Expand Down
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_am.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define AM_SMART "SMART"
#define AM_TERMINAL_ACK "Hide Terminal ACK"
#define AM_INVERT_YAXIS "Invert Y Axis"
#define AM_INVERT_ZAXIS "Invert Z Axis"
#define AM_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_cn.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define CN_SMART "SMART"
#define CN_TERMINAL_ACK "Hide Terminal ACK"
#define CN_INVERT_YAXIS "Invert Y Axis"
#define CN_INVERT_ZAXIS "Invert Z Axis"
#define CN_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_cz.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
#define CZ_SMART "SMART"
#define CZ_TERMINAL_ACK "Hide Terminal ACK"
#define CZ_INVERT_YAXIS "Invert Y Axis"
#define CZ_INVERT_ZAXIS "Invert Z Axis"
#define CZ_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define DE_SMART "SMART"
#define DE_TERMINAL_ACK "Hide Terminal ACK"
#define DE_INVERT_YAXIS "Invert Y Axis"
#define DE_INVERT_ZAXIS "Invert Z Axis"
#define DE_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define EN_SMART "SMART"
#define EN_TERMINAL_ACK "Hide Terminal ACK"
#define EN_INVERT_YAXIS "Invert Y Axis"
#define EN_INVERT_ZAXIS "Invert Z Axis"
#define EN_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define ES_SMART "SMART"
#define ES_TERMINAL_ACK "Hide Terminal ACK"
#define ES_INVERT_YAXIS "Invert Y Axis"
#define ES_INVERT_ZAXIS "Invert Z Axis"
#define ES_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
#define FR_SMART "SMART"
#define FR_TERMINAL_ACK "Hide Terminal ACK"
#define FR_INVERT_YAXIS "Invert Y Axis"
#define FR_INVERT_ZAXIS "Invert Z Axis"
#define FR_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define IT_SMART "SMART"
#define IT_TERMINAL_ACK "Hide Terminal ACK"
#define IT_INVERT_YAXIS "Invert Y Axis"
#define IT_INVERT_ZAXIS "Invert Z Axis"
#define IT_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_jp.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define JP_SMART "SMART"
#define JP_TERMINAL_ACK "Hide Terminal ACK"
#define JP_INVERT_YAXIS "Invert Y Axis"
#define JP_INVERT_ZAXIS "Invert Z Axis"
#define JP_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_pl.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define PL_SMART "SMART"
#define PL_TERMINAL_ACK "Hide Terminal ACK"
#define PL_INVERT_YAXIS "Invert Y Axis"
#define PL_INVERT_ZAXIS "Invert Z Axis"
#define PL_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_pt.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define PT_SMART "SMART"
#define PT_TERMINAL_ACK "Hide Terminal ACK"
#define PT_INVERT_YAXIS "Invert Y Axis"
#define PT_INVERT_ZAXIS "Invert Z Axis"
#define PT_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_ru.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define RU_SMART "SMART"
#define RU_TERMINAL_ACK "Hide Terminal ACK"
#define RU_INVERT_YAXIS "Invert Y Axis"
#define RU_INVERT_ZAXIS "Invert Z Axis"
#define RU_MOVE_SPEED "Move speed(X Y Z)"

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/Language/language_sk.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define SK_SMART "SMART"
#define SK_TERMINAL_ACK "Hide Terminal ACK"
#define SK_INVERT_YAXIS "Invert Y Axis"
#define SK_INVERT_ZAXIS "Invert Z Axis"
#define SK_MOVE_SPEED "Move speed(X Y Z)"

#endif
4 changes: 3 additions & 1 deletion TFT/src/User/API/flashStore.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define PARA_SIZE 256 //bytes
#define TSC_SIGN 0x20190827 // DO NOT MODIFY
#define PARA_SIGN 0x20191219 // If a new setting parameter is added, modify here and initialize the initial value in the "infoSettingsReset()" function
#define PARA_SIGN 0x20191225 // If a new setting parameter is added, modify here and initialize the initial value in the "infoSettingsReset()" function

extern u32 TSC_Para[7]; //
extern SETTINGS infoSettings; //
Expand Down Expand Up @@ -67,6 +67,7 @@ bool readStoredPara(void)
infoSettings.terminalACK = byteToWord(data + (index += 4), 4);
infoSettings.invert_yaxis = byteToWord(data + (index += 4), 4);
infoSettings.move_speed = byteToWord(data + (index += 4), 4);
infoSettings.invert_zaxis = byteToWord(data + (index += 4), 4);
}

return paraExist;
Expand Down Expand Up @@ -95,6 +96,7 @@ void storePara(void)
wordToByte(infoSettings.terminalACK, data + (index += 4));
wordToByte(infoSettings.invert_yaxis, data + (index += 4));
wordToByte(infoSettings.move_speed, data + (index += 4));
wordToByte(infoSettings.invert_zaxis, data + (index += 4));

STM32_FlashWrite(data, PARA_SIZE);
}
10 changes: 6 additions & 4 deletions TFT/src/User/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
//#define INVERT_YAXIS

//Invert the Z Axis move Direction
// this does not work if LIST MODE is enabled. To invert z axis in LIST MODE go to setting->feature settings
//#define INVERT_ZAXIS

// Enable Unified Move Menu
Expand Down Expand Up @@ -182,11 +183,12 @@

#define SHOW_FAN_PERCENTAGE // enable to show fan speed as a percentage instead of a value

/**
* Support up to 7 custom gcodes, uncomment CUSTOM_X_LABEL and CUSTOM_X_GCODE to enable custom gcode
/** CUSTOM GCODE COMMANDS
* Support up to 7 custom gcodes in Icon mode and 15 in List Mode.
* Uncomment CUSTOM_X_LABEL and CUSTOM_X_GCODE to enable custom gcode.
* CUSTOM_X_LABEL is the name of the custom button, CUSTOM_X_GCODE
* CUSTOM_X_GCODE is the gcode to be sent by the custom button, end with '\n'
* You also need to customize the icon corresponding to the command
* You also need to customize the icon corresponding to the command if MENU_LIST_MODE is not enabled.
* Copy your custom icon to the SD card to be updated, such as:"TFT35/bmp/Custom0.bmp", "TFT24/bmp/Custom1.bmp", etc...
* The format of the custom icon is as follows
* Bit depth: 24 / 32 bit, Pixel size: 95*95(for TFT35), 70*70(for TFT28/TFT24)
Expand All @@ -207,7 +209,7 @@
//#define CUSTOM_6_GCODE "M105\n"

/*
custom gcode below are compatible only in if LIST_MODE is active
custom gcode below are compatible only if MENU_LIST_MODE is active
*/
#ifdef MENU_LIST_MODE
//#define CUSTOM_7_LABEL "Custom7"
Expand Down
47 changes: 27 additions & 20 deletions TFT/src/User/Menu/FeatureSettings.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,14 @@
const uint16_t toggleitem[2] = {ICONCHAR_TOGGLE_OFF,ICONCHAR_TOGGLE_ON};
const u8 item_toggleState[2] = {0, 1};

static u8 item_terminalACK_i = 0; //for hide ack
static u8 item_invert_yaxis_i = 0; //for invert y axis
static u8 item_movespeed_i = 0; //for move speed

//
//add key number index of the items
//
typedef enum
{
SKEY_HIDEACK = 0,
SKEY_INVERT_Y,
SKEY_INVERT_Z,
#ifdef PS_ON_PIN
SKEY_POWER,
#endif
Expand All @@ -242,6 +239,7 @@
LISTITEM settingPage[SKEY_COUNT] = {
{ICONCHAR_TOGGLE_ON, LIST_TOGGLE, LABEL_TERMINAL_ACK, LABEL_BACKGROUND},
{ICONCHAR_TOGGLE_ON, LIST_TOGGLE, LABEL_INVERT_YAXIS, LABEL_BACKGROUND},
{ICONCHAR_TOGGLE_ON, LIST_TOGGLE, LABEL_INVERT_ZAXIS, LABEL_BACKGROUND},
#ifdef PS_ON_PIN
{ICONCHAR_TOGGLE_ON, LIST_TOGGLE, LABEL_AUTO_SHUT_DOWN, LABEL_BACKGROUND},
#endif
Expand All @@ -261,19 +259,24 @@
switch (item_index)
{
case SKEY_HIDEACK:
item_terminalACK_i = (item_terminalACK_i + 1) % 2;
settingPage[item_index].icon = toggleitem[item_terminalACK_i];
featureSettingsItems.items[key_val].icon = toggleitem[item_terminalACK_i];;
infoSettings.terminalACK = (infoSettings.terminalACK + 1) % 2;
settingPage[item_index].icon = toggleitem[infoSettings.terminalACK];
featureSettingsItems.items[key_val].icon = toggleitem[infoSettings.terminalACK];;
menuDrawListItem(&featureSettingsItems.items[key_val], key_val);
infoSettings.terminalACK = item_terminalACK_i;
break;

case SKEY_INVERT_Y:
item_invert_yaxis_i = (item_invert_yaxis_i + 1) % 2;
settingPage[item_index].icon = toggleitem[item_invert_yaxis_i];
infoSettings.invert_yaxis = (infoSettings.invert_yaxis + 1) % 2;
settingPage[item_index].icon = toggleitem[infoSettings.invert_yaxis];
featureSettingsItems.items[key_val] = settingPage[item_index];
menuDrawListItem(&featureSettingsItems.items[key_val], key_val);
break;

case SKEY_INVERT_Z:
infoSettings.invert_yaxis = (infoSettings.invert_yaxis + 1) % 2;
settingPage[item_index].icon = toggleitem[infoSettings.invert_yaxis];
featureSettingsItems.items[key_val] = settingPage[item_index];
menuDrawListItem(&featureSettingsItems.items[key_val], key_val);
infoSettings.invert_yaxis = item_invert_yaxis_i;
break;

#ifdef PS_ON_PIN
Expand All @@ -297,11 +300,10 @@
#endif

case SKEY_SPEED:
item_movespeed_i = (item_movespeed_i + 1) % ITEM_SPEED_NUM;
settingPage[item_index] = itemMoveSpeed[item_movespeed_i];
infoSettings.move_speed = (infoSettings.move_speed + 1) % ITEM_SPEED_NUM;
settingPage[item_index] = itemMoveSpeed[infoSettings.move_speed];
featureSettingsItems.items[key_val] = settingPage[item_index];
menuDrawListItem(&featureSettingsItems.items[key_val], key_val);
infoSettings.move_speed = item_movespeed_i;
break;
default:
break;
Expand All @@ -318,17 +320,23 @@
switch (item_index)
{
case SKEY_HIDEACK:
item_terminalACK_i = infoSettings.terminalACK;
settingPage[SKEY_HIDEACK].icon = toggleitem[item_terminalACK_i];
//item_terminalACK_i = infoSettings.terminalACK;
settingPage[SKEY_HIDEACK].icon = toggleitem[infoSettings.terminalACK];
featureSettingsItems.items[i] = settingPage[SKEY_HIDEACK];
break;

case SKEY_INVERT_Y:
item_invert_yaxis_i = infoSettings.invert_yaxis;
settingPage[SKEY_INVERT_Y].icon = toggleitem[item_invert_yaxis_i];
//item_invert_yaxis_i = infoSettings.invert_yaxis;
settingPage[SKEY_INVERT_Y].icon = toggleitem[infoSettings.invert_yaxis];
featureSettingsItems.items[i] = settingPage[SKEY_INVERT_Y];
break;

case SKEY_INVERT_Z:
//item_invert_zaxis_i = infoSettings.invert_zaxis;
settingPage[SKEY_INVERT_Z].icon = toggleitem[infoSettings.invert_yaxis];
featureSettingsItems.items[i] = settingPage[SKEY_INVERT_Z];
break;

#ifdef PS_ON_PIN
case SKEY_POWER:
for (u8 n = 0; n < ITEM_PS_ON_NUM; n++)
Expand All @@ -352,8 +360,7 @@
#endif

case SKEY_SPEED:
item_movespeed_i = infoSettings.move_speed;
featureSettingsItems.items[i] = itemMoveSpeed[item_movespeed_i];
featureSettingsItems.items[i] = itemMoveSpeed[infoSettings.move_speed];
break;
default:
settingPage[item_index].icon = ICONCHAR_BACKGROUND;
Expand Down
Loading

0 comments on commit 2a6211e

Please sign in to comment.