la10compat.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // la10compat: LA10->LA15 conversion
  2. //
  3. // When the current mode is UNKNOWN autodetection is active and any K<10
  4. // will set the mode to LA15, LA10 is set otherwise. When LA10
  5. // compatbility mode is active the K factor is converted to a LA15
  6. // equivalent (that is, the return value is always a LA15 value).
  7. //
  8. // E-jerk<2 is also bumped in LA10 mode to restore the the printing speed
  9. // to values comparable to existing settings.
  10. //
  11. // Once the interpretation mode has been set it is kept until the mode
  12. // is explicitly reset. This is done to handle transparent fallback for
  13. // old firmware revisions in combination with the following gcode
  14. // sequence:
  15. //
  16. // M900 K0.01 ; set LA15 value (interpreted by any firmware)
  17. // M900 K10 ; set LA10 value (ignored by LA15 firmware)
  18. //
  19. // A LA15 firmware without this module will only parse the first
  20. // correctly, rejecting the second. A LA10 FW will parse both, but keep
  21. // the last value. Since the LA15 value, if present, corresponds to the
  22. // truth value, the compatibility stub needs to "lock" onto the first
  23. // seen value for the current print.
  24. //
  25. // The mode needs to be carefully reset for each print in order for
  26. // diffent versions of M900 to be interpreted independently.
  27. #pragma once
  28. enum __attribute__((packed)) LA10C_MODE
  29. {
  30. LA10C_UNKNOWN = 0,
  31. LA10C_LA15 = 1,
  32. LA10C_LA10 = 2
  33. };
  34. // Explicitly set/get/reset the interpretation mode for la10c_value()
  35. void la10c_mode_change(LA10C_MODE mode);
  36. LA10C_MODE la10c_mode_get();
  37. static inline void la10c_reset() { la10c_mode_change(LA10C_UNKNOWN); }
  38. // Return a LA15 K value according to the supplied value and mode
  39. float la10c_value(float k);
  40. // Return an updated LA15 E-jerk value according to the current mode
  41. float la10c_jerk(float j);