Skip to content

Commit 7a4386b

Browse files
committed
Updated for core changes.
Fixed alignment issue that caused hardfault on WCO changes on some platforms. May resolve issue #17.
1 parent 0c87940 commit 7a4386b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

display/i2c_interface.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,19 @@ static void jogdata_changed (jogdata_t *jogdata)
244244

245245
static void onWCOChanged (void)
246246
{
247+
machine_coords_t wco = {};
247248
uint_fast8_t idx = min(4, N_AXIS);
248-
machine_coords_t *wco = (machine_coords_t *)status_packet.msg;
249249

250250
if(on_wco_changed)
251251
on_wco_changed();
252252

253253
do {
254254
idx--;
255-
wco->values[idx] = gc_get_offset(idx, false);
255+
wco.values[idx] = gc_get_offset(idx, false);
256256
} while(idx);
257257

258+
memcpy(status_packet.msg, &wco, sizeof(machine_coords_t));
259+
258260
display_update_now();
259261

260262
msgtype = MachineMsg_WorkOffset;
@@ -386,7 +388,7 @@ static void onReportOptions (bool newopt)
386388
on_report_options(newopt);
387389

388390
if(!newopt)
389-
report_plugin("I2C Display", connected ? "0.12" : "0.12 (not connected)");
391+
report_plugin("I2C Display", connected ? "0.13" : "0.13 (not connected)");
390392
}
391393

392394
static void complete_setup (void *data)
@@ -442,7 +444,7 @@ void display_init (void)
442444
#endif
443445

444446
// delay final setup until startup is complete
445-
protocol_enqueue_foreground_task(complete_setup, NULL);
447+
task_run_on_startup(complete_setup, NULL);
446448

447449
#if KEYPAD_ENABLE
448450

@@ -455,7 +457,7 @@ void display_init (void)
455457
#endif
456458

457459
} else
458-
protocol_enqueue_foreground_task(report_warning, "I2C display not connected!");
460+
task_run_on_startup(report_warning, "I2C display not connected!");
459461
}
460462

461463
#endif // DISPLAY_ENABLE

display/i2c_leds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void display_init (void)
164164
#endif
165165

166166
} else
167-
protocol_enqueue_foreground_task(report_warning, "I2C LEDs not connected!");
167+
task_run_on_startup(report_warning, "I2C LEDs not connected!");
168168
}
169169

170170
#endif

macros.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ ISR_CODE static void ISR_FUNC(execute_macro)(uint8_t irq_port, bool is_high)
311311
command = plugin_settings.macro[idx].data;
312312
if(!(*command == '\0' || *command == IOPORT_UNASSIGNED)) { // If valid command
313313
macro_id = idx + 1;
314-
protocol_enqueue_foreground_task(run_macro, NULL); // register run_macro function to be called from foreground process.
314+
task_add_immediate(run_macro, NULL); // register run_macro function to be called from foreground process.
315315
}
316316
}
317317
}
@@ -695,7 +695,7 @@ static void macro_settings_load (void)
695695
} while(idx);
696696

697697
if(n_ok < n_macros)
698-
protocol_enqueue_foreground_task(report_warning, "Macro plugin failed to claim all needed ports!");
698+
task_run_on_startup(report_warning, "Macro plugin failed to claim all needed ports!");
699699
#endif // MACROS_ENABLE & 0x01
700700
}
701701

@@ -773,7 +773,7 @@ void macros_init (void)
773773
strcat(strcat(strcpy(format, "x("), max_length), ")");
774774

775775
} else
776-
protocol_enqueue_foreground_task(report_warning, "Macro plugin failed to initialize!");
776+
task_run_on_startup(report_warning, "Macro plugin failed to initialize!");
777777
}
778778

779779
#endif // MACROS_ENABLE

0 commit comments

Comments
 (0)