{"action":"created","issue":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/4872","repository_url":"https://api.github.com/repos/MarlinFirmware/Marlin","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/4872/labels{/name}","comments_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/4872/comments","events_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/4872/events","html_url":"https://github.com/MarlinFirmware/Marlin/issues/4872","id":178658347,"number":4872,"title":"Easy way to free up 750 bytes of RAM","user":{"login":"Roxy-3D","id":8404322,"avatar_url":"https://avatars.githubusercontent.com/u/8404322?v=3","gravatar_id":"","url":"https://api.github.com/users/Roxy-3D","html_url":"https://github.com/Roxy-3D","followers_url":"https://api.github.com/users/Roxy-3D/followers","following_url":"https://api.github.com/users/Roxy-3D/following{/other_user}","gists_url":"https://api.github.com/users/Roxy-3D/gists{/gist_id}","starred_url":"https://api.github.com/users/Roxy-3D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roxy-3D/subscriptions","organizations_url":"https://api.github.com/users/Roxy-3D/orgs","repos_url":"https://api.github.com/users/Roxy-3D/repos","events_url":"https://api.github.com/users/Roxy-3D/events{/privacy}","received_events_url":"https://api.github.com/users/Roxy-3D/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Discussion:%20Developers","name":"Discussion: Developers","color":"FF77AA"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-09-22T16:28:55Z","updated_at":"2016-09-25T00:40:34Z","closed_at":null,"body":"@thinkyhead   Scott, I shrank the RAM foot print of the UBL branch by well over half of a KB of memory by defining two macros and changing stuff to use them.   After #define'ing the macros I searched for ECHO(\" and ECHOPAIR(\" and converted all of those to ECHOPGM(\" and ECHOPAIRPGM(\".   \r\n\r\nIts a really easy way to free up a chunk of RAM in RC-7 if you are so inclined.\r\n\r\n```cpp\r\n#define SERIAL_PROTOCOLPAIRPGM(name, value) SERIAL_ECHOPAIRPGM(name, value)\r\n#define SERIAL_ECHOPAIRPGM(name,value) do{ SERIAL_ECHOPGM(name); SERIAL_ECHO(value);} while(0);\r\n```\r\nThere are a bunch of shorter strings that happen again and again.  Things like \" , \" and \" X=\"   I bet one of the compiler experts can tell us how to set a flag to make only one copy of the string get stored in the flash memory.   That might shrink the program size by a little bit.\r\n"},"comment":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/comments/249395620","html_url":"https://github.com/MarlinFirmware/Marlin/issues/4872#issuecomment-249395620","issue_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/4872","id":249395620,"user":{"login":"Roxy-3D","id":8404322,"avatar_url":"https://avatars.githubusercontent.com/u/8404322?v=3","gravatar_id":"","url":"https://api.github.com/users/Roxy-3D","html_url":"https://github.com/Roxy-3D","followers_url":"https://api.github.com/users/Roxy-3D/followers","following_url":"https://api.github.com/users/Roxy-3D/following{/other_user}","gists_url":"https://api.github.com/users/Roxy-3D/gists{/gist_id}","starred_url":"https://api.github.com/users/Roxy-3D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roxy-3D/subscriptions","organizations_url":"https://api.github.com/users/Roxy-3D/orgs","repos_url":"https://api.github.com/users/Roxy-3D/repos","events_url":"https://api.github.com/users/Roxy-3D/events{/privacy}","received_events_url":"https://api.github.com/users/Roxy-3D/received_events","type":"User","site_admin":false},"created_at":"2016-09-25T00:40:34Z","updated_at":"2016-09-25T00:40:34Z","body":"> A 2-byte integer is also fine, as it certainly cuts down the storage needs. But obviously 1µm of accuracy (or, as 2:14 fixed-point, 16384ths of a mm, 0.06µm) is overkill. If we enforced a maximum deviation of 2mm (rather than 4mm), then the accuracy with a single byte goes up to +- 1/128th of a mm, or ~8µm, which again is more than enough for FDM.\r\n\r\nMostly, I'm resisting the 1/64mm idea because I want Marlin to still be used by those Graffiti people that are using spray cans instead of extruders.  And really...  It wouldn't be that hard to have an option that controlled whether we compress to two bytes or 1 byte.   It would only be in a few places in the code.   (I fully understand the need not to burn up memory needlessly!)\r\n\r\n> A 2-byte integer is also fine, as it certainly cuts down the storage needs. But obviously 1µm of accuracy (or, as 2:14 fixed-point, 16384ths of a mm, 0.06µm) is overkill. If we enforced a maximum deviation of 2mm (rather than 4mm), then the accuracy with a single byte goes up to +- 1/128th of a mm, or ~8µm, which again is more than enough for FDM.\r\n\r\nOne question:   Isn't what I suggested 5:10 with 1 bit used for the sign?   I was thinking if I had 3 decimal places of precision (.001) that could handle any hardware that is going to show up in the next couple of years.   And if I did that, that would imply I could go as big as +/- 32.000  which would be 5 bits of significand.   In floating point numbers there is an implied 1 bit that they don't include in the storage.  But this is kind of a fixed point numbers so I don't think I get the benefit of that 'implied 1 bit'.\r\n\r\n> Mainly I'm thinking of chopping this down because I need to manage a 16x16 mesh (256 points) in my current project.\r\n\r\nWow!   I certainly understand where you are coming from!   But one problem is the bigger the bed, the more the height is going to change across the bed.   If you can really have only 2mm of height difference across a big bed, we can drop it to one byte.   I'm just a little worried that is going to be too restrictive.\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"Roxy-3D"}}