perf: restore ChibiOS sweep and display timing

pull/166/head
PhysicistJohn 1 week ago
parent 9a84753a38
commit 76d60c15f6

@ -526,7 +526,10 @@ void ili9341_init(void)
LCD_CS_HIGH;
}
static void ili9341_setWindow(uint8_t cmd, uint16_t x, uint16_t y, uint16_t w, uint16_t h){
// Every DMA region starts here; keep command setup inlined on the rendering
// path without enabling strict aliasing for the legacy display code.
static void __attribute__((optimize("O3,no-strict-aliasing")))
ili9341_setWindow(uint8_t cmd, uint16_t x, uint16_t y, uint16_t w, uint16_t h){
// Any LCD exchange start from this
#ifdef __USE_DISPLAY_DMA__
dmaChannelWaitCompletionRxTx();
@ -663,8 +666,11 @@ void ili9341_bulk_finish(void){
}
#endif
// Copy part of spi_buffer to region, no wait completion after if buffer count !=1
#ifndef ili9341_bulk_continue
void ili9341_bulk_continue(int x, int y, int w, int h)
#ifndef ili9341_bulk_continue
// This runs once per dirty plot cell. Keep the DMA handoff inlined so a held
// self-test screen is not slower than the historical display pipeline.
void __attribute__((optimize("O3,no-strict-aliasing")))
ili9341_bulk_continue(int x, int y, int w, int h)
{
ili9341_bulk_finish(); // Wait DMA
ili9341_DMA_bulk(x, y, w, h, ili9341_get_cell_buffer()); // Send new cell data
@ -783,7 +789,10 @@ void ili9341_set_rotation(uint8_t r)
send_command(ILI9341_MEMORY_ACCESS_CONTROL, 1, &r);
}
void ili9341_blitBitmap(int x, int y, int width, int height, const uint8_t *b)
// Text drawing calls this once per glyph. Inline the DMA setup on this hot
// path while retaining the aliasing rules used by the rest of the release.
void __attribute__((optimize("O3,no-strict-aliasing")))
ili9341_blitBitmap(int x, int y, int width, int height, const uint8_t *b)
{
pixel_t *buf = spi_buffer;
uint8_t bits = 0;

@ -5301,33 +5301,37 @@ static bool sweep(bool break_on_operation)
}
}
}
systime_t local_sweep_time = sa_ST2US(chVTGetSystemTimeX() - start_of_sweep_timestamp);
if (setting.actual_sweep_time_us > ONE_SECOND_TIME)
local_sweep_time = setting.actual_sweep_time_us;
if (
#ifdef TINYSA4
progress_bar &&
#endif
show_bar && (( local_sweep_time > ONE_SECOND_TIME && (i & 0x07) == 0) /* || ( local_sweep_time > ONE_SECOND_TIME*10)*/ ) )
show_bar && (i & 0x07) == 0)
{
int pos = i * (WIDTH+1) / sweep_points;
ili9341_set_background(LCD_SWEEP_LINE_COLOR);
ili9341_fill(OFFSETX, CHART_BOTTOM+1, pos, 1); // update sweep progress bar
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX+pos, CHART_BOTTOM+1, WIDTH-pos, 1);
if (local_sweep_time > 10 * ONE_SECOND_TIME) {
plot_into_index(measured);
redraw_request |= REDRAW_CELLS | REDRAW_BATTERY | REDRAW_INBETWEEN;
// plot trace and other indications as raster
draw_all(true); // flush markmap only if scan completed to prevent
}
// The progress bar is only updated every eighth point. Avoid reading and
// converting the system timer on the other seven points of fast sweeps.
systime_t local_sweep_time = sa_ST2US(chVTGetSystemTimeX() - start_of_sweep_timestamp);
if (setting.actual_sweep_time_us > ONE_SECOND_TIME)
local_sweep_time = setting.actual_sweep_time_us;
if (local_sweep_time > ONE_SECOND_TIME) {
int pos = i * (WIDTH+1) / sweep_points;
ili9341_set_background(LCD_SWEEP_LINE_COLOR);
ili9341_fill(OFFSETX, CHART_BOTTOM+1, pos, 1); // update sweep progress bar
ili9341_set_background(LCD_BG_COLOR);
ili9341_fill(OFFSETX+pos, CHART_BOTTOM+1, WIDTH-pos, 1);
if (local_sweep_time > 10 * ONE_SECOND_TIME) {
plot_into_index(measured);
redraw_request |= REDRAW_CELLS | REDRAW_BATTERY | REDRAW_INBETWEEN;
// plot trace and other indications as raster
draw_all(true); // flush markmap only if scan completed to prevent
}
#ifdef __SWEEP_RESTART__
if (MODE_OUTPUT(setting.mode) && (setting.level_sweep != 0 || get_sweep_frequency(ST_SPAN) != 0))
refresh_sweep_menu(i);
if (MODE_OUTPUT(setting.mode) && (setting.level_sweep != 0 || get_sweep_frequency(ST_SPAN) != 0))
refresh_sweep_menu(i);
#endif
}
}
// ----------------------- debug avoid --------------------------------
if (debug_avoid) {

Loading…
Cancel
Save

Powered by TurnKey Linux.