@@ -49,7 +49,7 @@ void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
4949
5050 initialized = true ;
5151
52- SERIAL_ECHOLNPGM (" Setting up encoder on " , AS_CHAR (axis_codes[ encoderAxis] ), " axis, addr = " , address);
52+ SERIAL_ECHOLNPGM (" Setting up encoder on " , AS_CHAR (AXIS_CHAR ( encoderAxis) ), " axis, addr = " , address);
5353
5454 position = get_position ();
5555}
@@ -67,7 +67,7 @@ void I2CPositionEncoder::update() {
6767 /*
6868 if (trusted) { //commented out as part of the note below
6969 trusted = false;
70- SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(axis_codes[ encoderAxis] ), " axis encoder. Disengaging error correction until module is trusted again.");
70+ SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(AXIS_CHAR( encoderAxis) ), " axis encoder. Disengaging error correction until module is trusted again.");
7171 }
7272 */
7373 return ;
@@ -92,7 +92,7 @@ void I2CPositionEncoder::update() {
9292 if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
9393 trusted = true;
9494
95- SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(axis_codes[ encoderAxis] ), " axis has been fault-free for set duration, reinstating error correction.");
95+ SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(AXIS_CHAR( encoderAxis) ), " axis has been fault-free for set duration, reinstating error correction.");
9696
9797 //the encoder likely lost its place when the error occurred, so we'll reset and use the printer's
9898 //idea of where it the axis is to re-initialize
@@ -172,7 +172,7 @@ void I2CPositionEncoder::update() {
172172 float sumP = 0 ;
173173 LOOP_L_N (i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i];
174174 const int32_t errorP = int32_t (sumP * RECIPROCAL (I2CPE_ERR_PRST_ARRAY_SIZE));
175- SERIAL_CHAR (axis_codes[ encoderAxis] );
175+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
176176 SERIAL_ECHOLNPGM (" : CORRECT ERR " , errorP * planner.mm_per_step [encoderAxis], " mm" );
177177 babystep.add_steps (encoderAxis, -LROUND (errorP));
178178 errPrstIdx = 0 ;
@@ -192,7 +192,7 @@ void I2CPositionEncoder::update() {
192192 if (ABS (error) > I2CPE_ERR_CNT_THRESH * planner.settings .axis_steps_per_mm [encoderAxis]) {
193193 const millis_t ms = millis ();
194194 if (ELAPSED (ms, nextErrorCountTime)) {
195- SERIAL_CHAR (axis_codes[ encoderAxis] );
195+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
196196 SERIAL_ECHOLNPGM (" : LARGE ERR " , error, " ; diffSum=" , diffSum);
197197 errorCount++;
198198 nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS;
@@ -212,7 +212,7 @@ void I2CPositionEncoder::set_homed() {
212212 homed = trusted = true ;
213213
214214 #ifdef I2CPE_DEBUG
215- SERIAL_CHAR (axis_codes[ encoderAxis] );
215+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
216216 SERIAL_ECHOLNPGM (" axis encoder homed, offset of " , zeroOffset, " ticks." );
217217 #endif
218218 }
@@ -223,15 +223,15 @@ void I2CPositionEncoder::set_unhomed() {
223223 homed = trusted = false ;
224224
225225 #ifdef I2CPE_DEBUG
226- SERIAL_CHAR (axis_codes[ encoderAxis] );
226+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
227227 SERIAL_ECHOLNPGM (" axis encoder unhomed." );
228228 #endif
229229}
230230
231231bool I2CPositionEncoder::passes_test (const bool report) {
232232 if (report) {
233233 if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM (" Warning. " );
234- SERIAL_CHAR (axis_codes[ encoderAxis] );
234+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
235235 serial_ternary (H == I2CPE_MAG_SIG_BAD, F (" axis " ), F (" magnetic strip " ), F (" encoder " ));
236236 switch (H) {
237237 case I2CPE_MAG_SIG_GOOD:
@@ -252,7 +252,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) {
252252 error = ABS (diff) > 10000 ? 0 : diff; // Huge error is a bad reading
253253
254254 if (report) {
255- SERIAL_CHAR (axis_codes[ encoderAxis] );
255+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
256256 SERIAL_ECHOLNPGM (" axis target=" , target, " mm; actual=" , actual, " mm; err=" , error, " mm" );
257257 }
258258
@@ -262,7 +262,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) {
262262int32_t I2CPositionEncoder::get_axis_error_steps (const bool report) {
263263 if (!active) {
264264 if (report) {
265- SERIAL_CHAR (axis_codes[ encoderAxis] );
265+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
266266 SERIAL_ECHOLNPGM (" axis encoder not active!" );
267267 }
268268 return 0 ;
@@ -287,7 +287,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
287287 errorPrev = error;
288288
289289 if (report) {
290- SERIAL_CHAR (axis_codes[ encoderAxis] );
290+ SERIAL_CHAR (AXIS_CHAR ( encoderAxis) );
291291 SERIAL_ECHOLNPGM (" axis target=" , target, " ; actual=" , encoderCountInStepperTicksScaled, " ; err=" , error);
292292 }
293293
@@ -657,7 +657,7 @@ void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units,
657657 else {
658658 if (noOffset) {
659659 const int32_t raw_count = encoders[idx].get_raw_count ();
660- SERIAL_CHAR (axis_codes[ encoders[idx] .get_axis ()], ' ' );
660+ SERIAL_CHAR (AXIS_CHAR ( encoders[idx) .get_axis ()], ' ' );
661661
662662 for (uint8_t j = 31 ; j > 0 ; j--)
663663 SERIAL_ECHO ((bool )(0x00000001 & (raw_count >> j)));
@@ -712,7 +712,7 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const
712712 // and enable it (it will likely have failed initialization on power-up, before the address change).
713713 const int8_t idx = idx_from_addr (newaddr);
714714 if (idx >= 0 && !encoders[idx].get_active ()) {
715- SERIAL_CHAR (axis_codes[ encoders[idx] .get_axis ()]);
715+ SERIAL_CHAR (AXIS_CHAR ( encoders[idx) .get_axis ()]);
716716 SERIAL_ECHOLNPGM (" axis encoder was not detected on printer startup. Trying again." );
717717 encoders[idx].set_active (encoders[idx].passes_test (true ));
718718 }
@@ -814,7 +814,7 @@ void I2CPositionEncodersMgr::M860() {
814814
815815 if (I2CPE_idx == 0xFF ) {
816816 LOOP_LOGICAL_AXES (i) {
817- if (!I2CPE_anyaxis || parser.seen_test (axis_codes[i] )) {
817+ if (!I2CPE_anyaxis || parser.seen_test (AXIS_CHAR (i) )) {
818818 const uint8_t idx = idx_from_axis (AxisEnum (i));
819819 if ((int8_t )idx >= 0 ) report_position (idx, hasU, hasO);
820820 }
@@ -841,7 +841,7 @@ void I2CPositionEncodersMgr::M861() {
841841
842842 if (I2CPE_idx == 0xFF ) {
843843 LOOP_LOGICAL_AXES (i) {
844- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
844+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
845845 const uint8_t idx = idx_from_axis (AxisEnum (i));
846846 if ((int8_t )idx >= 0 ) report_status (idx);
847847 }
@@ -869,7 +869,7 @@ void I2CPositionEncodersMgr::M862() {
869869
870870 if (I2CPE_idx == 0xFF ) {
871871 LOOP_LOGICAL_AXES (i) {
872- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
872+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
873873 const uint8_t idx = idx_from_axis (AxisEnum (i));
874874 if ((int8_t )idx >= 0 ) test_axis (idx);
875875 }
@@ -900,7 +900,7 @@ void I2CPositionEncodersMgr::M863() {
900900
901901 if (I2CPE_idx == 0xFF ) {
902902 LOOP_LOGICAL_AXES (i) {
903- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
903+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
904904 const uint8_t idx = idx_from_axis (AxisEnum (i));
905905 if ((int8_t )idx >= 0 ) calibrate_steps_mm (idx, iterations);
906906 }
@@ -976,7 +976,7 @@ void I2CPositionEncodersMgr::M865() {
976976
977977 if (!I2CPE_addr) {
978978 LOOP_LOGICAL_AXES (i) {
979- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
979+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
980980 const uint8_t idx = idx_from_axis (AxisEnum (i));
981981 if ((int8_t )idx >= 0 ) report_module_firmware (encoders[idx].get_address ());
982982 }
@@ -1007,7 +1007,7 @@ void I2CPositionEncodersMgr::M866() {
10071007
10081008 if (I2CPE_idx == 0xFF ) {
10091009 LOOP_LOGICAL_AXES (i) {
1010- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
1010+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
10111011 const uint8_t idx = idx_from_axis (AxisEnum (i));
10121012 if ((int8_t )idx >= 0 ) {
10131013 if (hasR)
@@ -1045,7 +1045,7 @@ void I2CPositionEncodersMgr::M867() {
10451045
10461046 if (I2CPE_idx == 0xFF ) {
10471047 LOOP_LOGICAL_AXES (i) {
1048- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
1048+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
10491049 const uint8_t idx = idx_from_axis (AxisEnum (i));
10501050 if ((int8_t )idx >= 0 ) {
10511051 const bool ena = onoff == -1 ? !encoders[I2CPE_idx].get_ec_enabled () : !!onoff;
@@ -1081,7 +1081,7 @@ void I2CPositionEncodersMgr::M868() {
10811081
10821082 if (I2CPE_idx == 0xFF ) {
10831083 LOOP_LOGICAL_AXES (i) {
1084- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
1084+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
10851085 const uint8_t idx = idx_from_axis (AxisEnum (i));
10861086 if ((int8_t )idx >= 0 ) {
10871087 if (newThreshold != -9999 )
@@ -1115,7 +1115,7 @@ void I2CPositionEncodersMgr::M869() {
11151115
11161116 if (I2CPE_idx == 0xFF ) {
11171117 LOOP_LOGICAL_AXES (i) {
1118- if (!I2CPE_anyaxis || parser.seen (axis_codes[i] )) {
1118+ if (!I2CPE_anyaxis || parser.seen (AXIS_CHAR (i) )) {
11191119 const uint8_t idx = idx_from_axis (AxisEnum (i));
11201120 if ((int8_t )idx >= 0 ) report_error (idx);
11211121 }
0 commit comments