{"action":"closed","issue":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3410","repository_url":"https://api.github.com/repos/MarlinFirmware/Marlin","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3410/labels{/name}","comments_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3410/comments","events_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3410/events","html_url":"https://github.com/MarlinFirmware/Marlin/issues/3410","id":146446213,"number":3410,"title":"MIN_POS & negative values after homing","user":{"login":"pflugj","id":17050757,"avatar_url":"https://avatars.githubusercontent.com/u/17050757?v=3","gravatar_id":"","url":"https://api.github.com/users/pflugj","html_url":"https://github.com/pflugj","followers_url":"https://api.github.com/users/pflugj/followers","following_url":"https://api.github.com/users/pflugj/following{/other_user}","gists_url":"https://api.github.com/users/pflugj/gists{/gist_id}","starred_url":"https://api.github.com/users/pflugj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pflugj/subscriptions","organizations_url":"https://api.github.com/users/pflugj/orgs","repos_url":"https://api.github.com/users/pflugj/repos","events_url":"https://api.github.com/users/pflugj/events{/privacy}","received_events_url":"https://api.github.com/users/pflugj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Status:%20Inactive","name":"Status: Inactive","color":"eeeeee"},{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Support:%20Configuration","name":"Support: Configuration","color":"006b75"},{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Support:%20Documentation","name":"Support: Documentation","color":"006b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-06T21:51:46Z","updated_at":"2016-05-04T14:36:15Z","closed_at":"2016-05-04T14:36:15Z","body":"Hi\r\n...first of all: \"THANKS for this nice piece of software and all your hard work!!\r\n\r\nI am using RC5 at the moment and have some problems with the following. \r\nTo take care of the bed offset, I did configure \"**negative Y_MIN_POS**\" like so\r\n```cpp\r\n// Travel limits after homing (units are in mm)\r\n#define X_MIN_POS 0\r\n#define Y_MIN_POS **-30**\r\n#define Z_MIN_POS 0\r\n#define X_MAX_POS 200\r\n#define Y_MAX_POS 200\r\n#define Z_MAX_POS 300\r\n```\r\nAfter homing x and y manually with Pronterface the LCD shows\r\n```\r\nx:000.0 y:030.0 z:   5\r\n```\r\ny: should show \"y:**-**030.0\" here am I right?\r\n\r\nThe 2nd thing I noted:\r\nMy Z-Probe sensor is 30mm behind the nozzle, that is why I adjusted the Y-Endstop and therefore the Y-MIN_POS, to make sure the Probe can reach any part of the bed as well as the nozzle.\r\n   \r\nWhen issuing a G28 command I get\r\n```\r\nx:100.0 **y:055.0** z:   0.85\r\n```\r\ny should be at position \"70.0\" = \"Probe\" in centre of bed\r\nI have enabled\r\n```cpp\r\n#define Z_SAFE_HOMING\r\n#define Z_SAFE_HOMING_X_POINT ((X_MIN_POS + X_MAX_POS) / 2) \r\n#define Z_SAFE_HOMING_Y_POINT ((Y_MIN_POS + Y_MAX_POS) / 2) \r\n```\r\nIt looks like the Z-Safe home does not take care of the negative numbers \r\n`(-30 + 200) = ONLY \"170\"` and should be `200` in my opinion with the negative `Y_MIN_POS` \r\nso somehow `(-30+200 ) / 2 + (-30)  = **55**`  is calculated here\r\n\r\nSo I think adding an \"#if\" condition would be the right way to correct for this:\r\nin case of a negative `MIN_POS`  the value should be calculated as `MAX_POS / 2`\r\nSo I have changed the code like this:\r\n```cpp\r\n#if ENABLED(Z_SAFE_HOMING)\r\n   #if ( X_MIN_POS < 0 )\r\n       #define Z_SAFE_HOMING_X_POINT  (X_MAX_POS) / 2)\r\n       #else\r\n       #define Z_SAFE_HOMING_X_POINT ((X_MIN_POS + X_MAX_POS) / 2)\r\n   #endif\r\n\r\n   #if ( Y_MIN_POS < 0 )\r\n       #define Z_SAFE_HOMING_Y_POINT  (Y_MAX_POS / 2)\r\n       #else\r\n       #define Z_SAFE_HOMING_Y_POINT ((Y_MIN_POS + Y_MAX_POS) / 2 )\r\n   #endif\r\n#endif\r\n```\r\nThis changed the `G28` Home position to `Y: 070`\r\nmeaning the \"Probe\" is now exactly in the centre of the bed at `Y=100`\r\nI think that is the correct value.\r\n\r\nPlease check if this ok.\r\n\r\nHey and thanks again for all your hard work\r\ncheers\r\nJurgen"}}