From 2a6211e87c8370a8b29394132d22158bca02820b Mon Sep 17 00:00:00 2001 From: guruathwal Date: Thu, 26 Dec 2019 13:18:55 +0530 Subject: [PATCH] Add invert Z axis in list menu and fix invert z axis g-code (#260) * 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 --- TFT/src/User/API/Language/Language.c | 13 +++++ TFT/src/User/API/Language/Language.h | 1 + TFT/src/User/API/Language/language_am.h | 1 + TFT/src/User/API/Language/language_cn.h | 1 + TFT/src/User/API/Language/language_cz.h | 1 + TFT/src/User/API/Language/language_de.h | 1 + TFT/src/User/API/Language/language_en.h | 1 + TFT/src/User/API/Language/language_es.h | 1 + TFT/src/User/API/Language/language_fr.h | 1 + TFT/src/User/API/Language/language_it.h | 1 + TFT/src/User/API/Language/language_jp.h | 1 + TFT/src/User/API/Language/language_pl.h | 1 + TFT/src/User/API/Language/language_pt.h | 1 + TFT/src/User/API/Language/language_ru.h | 1 + TFT/src/User/API/Language/language_sk.h | 1 + TFT/src/User/API/flashStore.c | 4 +- TFT/src/User/Configuration.h | 10 ++-- TFT/src/User/Menu/FeatureSettings.c | 47 ++++++++++-------- TFT/src/User/Menu/Move.c | 66 +++++++++++++++++++------ TFT/src/User/Menu/Settings.c | 2 + TFT/src/User/Menu/Settings.h | 1 + platformio.ini | 2 +- 22 files changed, 119 insertions(+), 40 deletions(-) diff --git a/TFT/src/User/API/Language/Language.c b/TFT/src/User/API/Language/Language.c index 7369060311..87d6b75cb8 100644 --- a/TFT/src/User/API/Language/Language.c +++ b/TFT/src/User/API/Language/Language.c @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; @@ -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, }; diff --git a/TFT/src/User/API/Language/Language.h b/TFT/src/User/API/Language/Language.h index 46059be080..3cd7d16650 100644 --- a/TFT/src/User/API/Language/Language.h +++ b/TFT/src/User/API/Language/Language.h @@ -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 diff --git a/TFT/src/User/API/Language/language_am.h b/TFT/src/User/API/Language/language_am.h index a7add84a83..13503f8b89 100644 --- a/TFT/src/User/API/Language/language_am.h +++ b/TFT/src/User/API/Language/language_am.h @@ -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 diff --git a/TFT/src/User/API/Language/language_cn.h b/TFT/src/User/API/Language/language_cn.h index fb7511c4ab..995d4f9dbc 100644 --- a/TFT/src/User/API/Language/language_cn.h +++ b/TFT/src/User/API/Language/language_cn.h @@ -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 diff --git a/TFT/src/User/API/Language/language_cz.h b/TFT/src/User/API/Language/language_cz.h index 8e87d7c7a9..1662fd1384 100644 --- a/TFT/src/User/API/Language/language_cz.h +++ b/TFT/src/User/API/Language/language_cz.h @@ -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 diff --git a/TFT/src/User/API/Language/language_de.h b/TFT/src/User/API/Language/language_de.h index a7faa525a2..3d22a0abc6 100644 --- a/TFT/src/User/API/Language/language_de.h +++ b/TFT/src/User/API/Language/language_de.h @@ -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 diff --git a/TFT/src/User/API/Language/language_en.h b/TFT/src/User/API/Language/language_en.h index 6eb13d4c82..acd8619147 100644 --- a/TFT/src/User/API/Language/language_en.h +++ b/TFT/src/User/API/Language/language_en.h @@ -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 diff --git a/TFT/src/User/API/Language/language_es.h b/TFT/src/User/API/Language/language_es.h index d4ba967589..815022b1b8 100644 --- a/TFT/src/User/API/Language/language_es.h +++ b/TFT/src/User/API/Language/language_es.h @@ -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 diff --git a/TFT/src/User/API/Language/language_fr.h b/TFT/src/User/API/Language/language_fr.h index a8d1dd6838..92cbfea373 100644 --- a/TFT/src/User/API/Language/language_fr.h +++ b/TFT/src/User/API/Language/language_fr.h @@ -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 diff --git a/TFT/src/User/API/Language/language_it.h b/TFT/src/User/API/Language/language_it.h index cd9da47405..59ffcb7a48 100644 --- a/TFT/src/User/API/Language/language_it.h +++ b/TFT/src/User/API/Language/language_it.h @@ -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 diff --git a/TFT/src/User/API/Language/language_jp.h b/TFT/src/User/API/Language/language_jp.h index e9025266ba..2729570416 100644 --- a/TFT/src/User/API/Language/language_jp.h +++ b/TFT/src/User/API/Language/language_jp.h @@ -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 diff --git a/TFT/src/User/API/Language/language_pl.h b/TFT/src/User/API/Language/language_pl.h index 3339eba6e7..1efe6c9245 100644 --- a/TFT/src/User/API/Language/language_pl.h +++ b/TFT/src/User/API/Language/language_pl.h @@ -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 diff --git a/TFT/src/User/API/Language/language_pt.h b/TFT/src/User/API/Language/language_pt.h index b6f26a5281..acf7b6bc6b 100644 --- a/TFT/src/User/API/Language/language_pt.h +++ b/TFT/src/User/API/Language/language_pt.h @@ -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 diff --git a/TFT/src/User/API/Language/language_ru.h b/TFT/src/User/API/Language/language_ru.h index 57d90c3a10..67c3d3d379 100644 --- a/TFT/src/User/API/Language/language_ru.h +++ b/TFT/src/User/API/Language/language_ru.h @@ -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 diff --git a/TFT/src/User/API/Language/language_sk.h b/TFT/src/User/API/Language/language_sk.h index c6a5f8f1ba..122243d114 100644 --- a/TFT/src/User/API/Language/language_sk.h +++ b/TFT/src/User/API/Language/language_sk.h @@ -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 diff --git a/TFT/src/User/API/flashStore.c b/TFT/src/User/API/flashStore.c index bc392fcf1f..e380a41673 100644 --- a/TFT/src/User/API/flashStore.c +++ b/TFT/src/User/API/flashStore.c @@ -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; // @@ -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; @@ -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); } diff --git a/TFT/src/User/Configuration.h b/TFT/src/User/Configuration.h index 456c3f2b42..1f8b1848e4 100644 --- a/TFT/src/User/Configuration.h +++ b/TFT/src/User/Configuration.h @@ -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 @@ -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) @@ -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" diff --git a/TFT/src/User/Menu/FeatureSettings.c b/TFT/src/User/Menu/FeatureSettings.c index 658149742f..8a4b01c062 100644 --- a/TFT/src/User/Menu/FeatureSettings.c +++ b/TFT/src/User/Menu/FeatureSettings.c @@ -212,10 +212,6 @@ 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 // @@ -223,6 +219,7 @@ { SKEY_HIDEACK = 0, SKEY_INVERT_Y, + SKEY_INVERT_Z, #ifdef PS_ON_PIN SKEY_POWER, #endif @@ -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 @@ -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 @@ -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; @@ -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++) @@ -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; diff --git a/TFT/src/User/Menu/Move.c b/TFT/src/User/Menu/Move.c index b46ce35d0b..5eacc00a7d 100644 --- a/TFT/src/User/Menu/Move.c +++ b/TFT/src/User/Menu/Move.c @@ -7,6 +7,8 @@ #ifdef MENU_LIST_MODE #define YGCODE_INC "G1 Y%.1f\n" #define YGCODE_DEC "G1 Y-%.1f\n" + #define ZGCODE_INC "G1 Z%.1f\n" + #define ZGCODE_DEC "G1 Z-%.1f\n" #else #ifdef INVERT_YAXIS #define LABEL_YAXIS_UP LABEL_Y_DEC @@ -19,18 +21,19 @@ #define YGCODE_UP "G1 Y%.1f\n" #define YGCODE_DOWN "G1 Y-%.1f\n" #endif -#endif + + #ifdef INVERT_ZAXIS + #define LABEL_ZAXIS_UP LABEL_Z_DEC + #define LABEL_ZAXIS_DOWN LABEL_Z_INC + #define ZGCODE_UP "G1 Z-%.1f\n" + #define ZGCODE_DOWN "G1 Z%.1f\n" + #else + #define LABEL_ZAXIS_UP LABEL_Z_INC + #define LABEL_ZAXIS_DOWN LABEL_Z_DEC + #define ZGCODE_UP "G1 Z%.1f\n" + #define ZGCODE_DOWN "G1 Z%.1f\n" + #endif -#ifdef INVERT_ZAXIS - #define LABEL_ZAXIS_UP LABEL_Z_DEC - #define LABEL_ZAXIS_DOWN LABEL_Z_INC - #define ZGCODE_UP "G1 Z%.1f\n" - #define ZGCODE_DOWN "G1 Z-%.1f\n" -#else - #define LABEL_ZAXIS_UP LABEL_Z_INC - #define LABEL_ZAXIS_DOWN LABEL_Z_DEC - #define ZGCODE_UP "G1 Z-%.1f\n" - #define ZGCODE_DOWN "G1 Z%.1f\n" #endif //1 title, ITEM_PER_PAGE item @@ -89,6 +92,7 @@ static u32 update_time = 50; // 1 seconds is 100 void menuMove(void) { KEY_VALUES key_num = KEY_IDLE; + #ifdef MENU_LIST_MODE if(infoSettings.invert_yaxis == 1){ moveItems.items[1].label.index = LABEL_Y_DEC; moveItems.items[5].label.index = LABEL_Y_INC; @@ -97,7 +101,15 @@ void menuMove(void) moveItems.items[1].label.index = LABEL_Y_INC; moveItems.items[5].label.index = LABEL_Y_DEC; } - + if(infoSettings.invert_zaxis == 1){ + moveItems.items[0].label.index = LABEL_Z_DEC; + moveItems.items[2].label.index = LABEL_Z_INC; + } + else{ + moveItems.items[0].label.index = LABEL_Z_INC; + moveItems.items[2].label.index = LABEL_Z_DEC; + } + #endif menuDrawPage(&moveItems); mustStoreCmd("G91\n"); @@ -126,7 +138,19 @@ void menuMove(void) switch(key_num) { #ifdef ALTERNATIVE_MOVE_MENU - case KEY_ICON_0: storeCmd(ZGCODE_DOWN, item_move_len[item_move_len_i]); break; + case KEY_ICON_0: + #ifdef MENU_LIST_MODE + if(infoSettings.invert_zaxis == 1){ + storeCmd(ZGCODE_DEC, item_move_len[item_move_len_i]); + } + else{ + storeCmd(ZGCODE_INC, item_move_len[item_move_len_i]); + } + #else + storeCmd(ZGCODE_DOWN, item_move_len[item_move_len_i]); break; + #endif + break; + case KEY_ICON_1: #ifdef MENU_LIST_MODE if(infoSettings.invert_yaxis == 1){ @@ -139,13 +163,27 @@ void menuMove(void) storeCmd(YGCODE_UP, item_move_len[item_move_len_i]); #endif break; - case KEY_ICON_2: storeCmd(ZGCODE_UP, item_move_len[item_move_len_i]); break; + + case KEY_ICON_2: + #ifdef MENU_LIST_MODE + if(infoSettings.invert_zaxis == 1){ + storeCmd(ZGCODE_INC, item_move_len[item_move_len_i]); + } + else{ + storeCmd(ZGCODE_DEC, item_move_len[item_move_len_i]); + } + #else + storeCmd(ZGCODE_UP, item_move_len[item_move_len_i]); break; + #endif + break; + case KEY_ICON_3: item_move_len_i = (item_move_len_i+1)%ITEM_MOVE_LEN_NUM; moveItems.items[key_num] = itemMoveLen[item_move_len_i]; menuDrawItem(&moveItems.items[key_num], key_num); break; case KEY_ICON_4: storeCmd("G1 X-%.1f\n", item_move_len[item_move_len_i]); break; + case KEY_ICON_5: #ifdef MENU_LIST_MODE if(infoSettings.invert_yaxis == 1){ diff --git a/TFT/src/User/Menu/Settings.c b/TFT/src/User/Menu/Settings.c index bf492eee0d..7d3805eae6 100644 --- a/TFT/src/User/Menu/Settings.c +++ b/TFT/src/User/Menu/Settings.c @@ -19,6 +19,8 @@ void infoSettingsReset(void) infoSettings.invert_yaxis = 0; infoSettings.move_speed = 0; infoSettings.led_color = LED_OFF; + infoSettings.invert_zaxis = 0; + } // Version infomation diff --git a/TFT/src/User/Menu/Settings.h b/TFT/src/User/Menu/Settings.h index da4bd1f22b..4c27ce8ad5 100644 --- a/TFT/src/User/Menu/Settings.h +++ b/TFT/src/User/Menu/Settings.h @@ -25,6 +25,7 @@ typedef struct uint8_t invert_yaxis; uint8_t move_speed; uint32_t led_color; + uint8_t invert_zaxis; }SETTINGS; diff --git a/platformio.ini b/platformio.ini index d2f61a5d38..9350d18e2a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -42,7 +42,7 @@ build_flags = -fmax-errors=5 -ITFT/src/User/Hal/STM32_USB_HOST_Library/Class/MSC/inc -ITFT/src/User/Hal/STM32_USB_HOST_Library/Usr/inc -ITFT/src/User/Hal/STM32_USB_OTG_Driver/inc - -DSOFTWARE_VERSION=25 + -DSOFTWARE_VERSION=25.1 [stm32f10x] default_src_filter = ${common.default_src_filter} + + +