{"action":"created","issue":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3894","repository_url":"https://api.github.com/repos/MarlinFirmware/Marlin","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3894/labels{/name}","comments_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3894/comments","events_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3894/events","html_url":"https://github.com/MarlinFirmware/Marlin/issues/3894","id":157066674,"number":3894,"title":"Pre-processor bug ?","user":{"login":"lrpirlet","id":11609661,"avatar_url":"https://avatars.githubusercontent.com/u/11609661?v=3","gravatar_id":"","url":"https://api.github.com/users/lrpirlet","html_url":"https://github.com/lrpirlet","followers_url":"https://api.github.com/users/lrpirlet/followers","following_url":"https://api.github.com/users/lrpirlet/following{/other_user}","gists_url":"https://api.github.com/users/lrpirlet/gists{/gist_id}","starred_url":"https://api.github.com/users/lrpirlet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrpirlet/subscriptions","organizations_url":"https://api.github.com/users/lrpirlet/orgs","repos_url":"https://api.github.com/users/lrpirlet/repos","events_url":"https://api.github.com/users/lrpirlet/events{/privacy}","received_events_url":"https://api.github.com/users/lrpirlet/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Bug:%20Potential%20?","name":"Bug: Potential ?","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/milestones/53","html_url":"https://github.com/MarlinFirmware/Marlin/milestones/1.1.0","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/milestones/53/labels","id":1726554,"number":53,"title":"1.1.0","description":"","creator":{"login":"jbrazio","id":264365,"avatar_url":"https://avatars.githubusercontent.com/u/264365?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrazio","html_url":"https://github.com/jbrazio","followers_url":"https://api.github.com/users/jbrazio/followers","following_url":"https://api.github.com/users/jbrazio/following{/other_user}","gists_url":"https://api.github.com/users/jbrazio/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrazio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrazio/subscriptions","organizations_url":"https://api.github.com/users/jbrazio/orgs","repos_url":"https://api.github.com/users/jbrazio/repos","events_url":"https://api.github.com/users/jbrazio/events{/privacy}","received_events_url":"https://api.github.com/users/jbrazio/received_events","type":"User","site_admin":false},"open_issues":28,"closed_issues":72,"state":"open","created_at":"2016-04-23T11:44:07Z","updated_at":"2016-05-30T05:07:35Z","due_on":"2016-05-31T23:00:00Z","closed_at":null},"comments":10,"created_at":"2016-05-26T20:02:35Z","updated_at":"2016-05-30T06:47:13Z","closed_at":null,"body":"I am trying to port my https://github.com/lrpirlet/Marlin/tree/motorized_mesh_bed_leveling_for_LRP and to try it with the https://github.com/Sebastianv650/MarlinRC_LIN_ADVANCE... This for the background info...\r\nBTW, @Sebastianv650, thanks for that very nice algorithm...\r\n\r\nAnyway, a diff of my configuration.h from the default in RCBugfix shows \r\n```diff\r\n$ git diff\r\ndiff --git a/Marlin/Configuration.h b/Marlin/Configuration.h\r\nindex a79b38e..d68b6ee 100644\r\n--- a/Marlin/Configuration.h\r\n+++ b/Marlin/Configuration.h\r\n@@ -1126,6 +1126,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l\r\n // If unsure, leave commented / disabled\r\n //\r\n //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command\r\n+#define NUM_SERVOS 1 //lrp\r\n\r\n // Servo Endstops\r\n //\r\n@@ -1136,11 +1137,14 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l\r\n //#define Y_ENDSTOP_SERVO_NR 2\r\n //#define Z_ENDSTOP_SERVO_NR 0\r\n //#define SERVO_ENDSTOP_ANGLES {{0,0}, {0,0}, {70,0}} // X,Y,Z Axis Extend and Retract angles\r\n+#define Z_ENDSTOP_SERVO_NR 0\r\n+#define SERVO_ENDSTOP_ANGLES {{0,0}, {0,0}, {70,0}} // X,Y,Z Axis Extend and Retract angles\r\n\r\n // Servo deactivation\r\n //\r\n // With this option servos are powered only during movement, then turned off to prevent jitter.\r\n //#define DEACTIVATE_SERVOS_AFTER_MOVE\r\n+#define DEACTIVATE_SERVOS_AFTER_MOVE\r\n\r\n #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)\r\n   // Delay (in microseconds) before turning the servo off. This depends on the servo speed.\r\n```\r\nI compile that in ARDUINO 1.6.8 (installed on my new computer, not an upgrade or update) and upload it to my printer...\r\n\r\nG28... G28 start it's usual dance, the servo deploy, G28 goes down till the z-probe touch the bed twice, servo trys to stow... **power loss on the hardware...** I know, too much power drain by the servo, I need to give the servo enough z height so that it does not get blocked...\r\n\r\nso, I jump in the code... and change the following that must have been written by @Roxy-3DPrintBoard ...\r\n```diff\r\ndiff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp\r\nindex b3c302d..9809dbd 100644\r\n--- a/Marlin/Marlin_main.cpp\r\n+++ b/Marlin/Marlin_main.cpp\r\n@@ -2161,19 +2161,26 @@ static void homeaxis(AxisEnum axis) {\r\n     current_position[axis] = 0;\r\n     sync_plan_position();\r\n\r\n-    #if ENABLED(Z_PROBE_SLED)\r\n-      #define _Z_SERVO_TEST       (axis != Z_AXIS)      // deploy Z, servo.move XY\r\n-      #define _Z_PROBE_SUBTEST    false                 // Z will never be invoked\r\n-      #define _Z_DEPLOY           (dock_sled(false))\r\n-      #define _Z_STOW             (dock_sled(true))\r\n-    #elif SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)\r\n-      #define _Z_SERVO_TEST       (axis != Z_AXIS)      // servo.move XY\r\n-      #define _Z_PROBE_SUBTEST    false                 // Z will never be invoked\r\n-      #define _Z_DEPLOY           (deploy_z_probe())\r\n-      #define _Z_STOW             (stow_z_probe())\r\n-    #elif HAS_SERVO_ENDSTOPS\r\n-      #define _Z_SERVO_TEST       true                  // servo.move X, Y, Z\r\n-      #define _Z_PROBE_SUBTEST    (axis == Z_AXIS)      // Z is a probe\r\n+    #if ENABLED(Z_PROBE_SLED)\r\n+      #define _Z_SERVO_TEST       (axis != Z_AXIS)      // deploy Z, servo.move XY\r\n+      #define _Z_PROBE_SUBTEST    false                 // Z will never be invoked\r\n+      #define _Z_DEPLOY           (dock_sled(false))\r\n+      #define _Z_STOW             (dock_sled(true))\r\n+    #elif SERVO_LEVELING\r\n+      #define _Z_SERVO_TEST       (axis != Z_AXIS)      // servo.move XY\r\n+      #define _Z_PROBE_SUBTEST    false                 // Z will never be invoked\r\n+      #define _Z_DEPLOY           (raise_z_for_servo(); deploy_z_probe()) // raise away from the bed before deploying\r\n+      #define _Z_STOW             (raise_z_for_servo(); stow_z_probe())   // or stowing the servo\r\n+    #elif ENABLED(FIX_MOUNTED_PROBE)\r\n+      #define _Z_SERVO_TEST       (axis != Z_AXIS)      // servo.move XY\r\n+      #define _Z_PROBE_SUBTEST    false                 // Z will never be invoked\r\n+      #define _Z_DEPLOY           (deploy_z_probe())\r\n+      #define _Z_STOW             (stow_z_probe())\r\n+    #elif HAS_SERVO_ENDSTOPS\r\n+      #define _Z_SERVO_TEST       true                  // servo.move X, Y, Z\r\n+      #define _Z_PROBE_SUBTEST    (axis == Z_AXIS)      // Z is a probe\r\n     #endif\r\n\r\n     if (axis == Z_AXIS) {\r\n```\r\n\r\nThat compiles without any problem, I download it to the printer... **same behavior**\r\noops...\r\n\r\nSo I scratch my hair, look around in the code... Yes this is normal, ```raise_z_for_servo();``` needs ```AUTO_BED_LEVELING_FEATURE``` to be defined...\r\nSO I will edit right and left to...  wait a minute... stop... think... observe... read it all..\r\n\r\nThe servo should never have moved at all since ```deploy_z_probe()```implies  ```AUTO_BED_LEVELING_FEATURE``` \r\n\r\nSorry, this is too much for me... Do I face a preprocessor error??\r\n\r\nNow, to avoid compiling that, would it be a good idea to put in sanitycheck.h something such as ```#error on defined (HAS_Z_ENDSTOP_SERVO) and disabled(AUTO_BED_LEVELING_FEATURE)``` (using the correct syntax that I have not figured yet)\r\n\r\n@thinkyhead , you have always been supportive, what do you think? ( I want to learn). ( I am an old engineeer, but not a C or C++ programmer, I wrote mickey mouse program on PDP 11 and Vax if that tells you some and some Z80 asm code)\r\n\r\nThat said,  I would really appreciate to see my name associate with the solution.. I spend quite a few hours frustration on this one... I will probably NOT touch my computer before June, and I feel we should NOT leave that like that.... Unless I missed something obvious that I should know. "},"comment":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/comments/222423044","html_url":"https://github.com/MarlinFirmware/Marlin/issues/3894#issuecomment-222423044","issue_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3894","id":222423044,"user":{"login":"Blue-Marlin","id":17075493,"avatar_url":"https://avatars.githubusercontent.com/u/17075493?v=3","gravatar_id":"","url":"https://api.github.com/users/Blue-Marlin","html_url":"https://github.com/Blue-Marlin","followers_url":"https://api.github.com/users/Blue-Marlin/followers","following_url":"https://api.github.com/users/Blue-Marlin/following{/other_user}","gists_url":"https://api.github.com/users/Blue-Marlin/gists{/gist_id}","starred_url":"https://api.github.com/users/Blue-Marlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blue-Marlin/subscriptions","organizations_url":"https://api.github.com/users/Blue-Marlin/orgs","repos_url":"https://api.github.com/users/Blue-Marlin/repos","events_url":"https://api.github.com/users/Blue-Marlin/events{/privacy}","received_events_url":"https://api.github.com/users/Blue-Marlin/received_events","type":"User","site_admin":false},"created_at":"2016-05-30T06:47:13Z","updated_at":"2016-05-30T06:47:13Z","body":"@lrpirlet \r\nI'd try something like\r\n```diff\r\n@@ -2319,10 +2319,18 @@ static void homeaxis(AxisEnum axis) {\r\n     #if HAS_SERVO_ENDSTOPS\r\n       if (_Z_SERVO_TEST && servo_endstop_id[axis] >= 0) {\r\n         #if ENABLED(DEBUG_LEVELING_FEATURE)\r\n           if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM(\"> SERVO_ENDSTOPS > Stow with servo.move()\");\r\n         #endif\r\n+\r\n+        #ifndef Z_RAISE_AFTER_PROBING\r\n+          #define Z_RAISE_AFTER_PROBING 15 // your number\r\n+        #endif\r\n+        current_position[Z_AXIS] = Z_RAISE_AFTER_PROBING;\r\n+        line_to_current_position();\r\n+        stepper.synchronize();\r\n+\r\n         servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][1]);\r\n         if (_Z_PROBE_SUBTEST) endstops.enable_z_probe(false);\r\n       }\r\n     #endif\r\n```"}}
{"actor":{"display_login":"Blue-Marlin"}}