From 12f478a8efda0960d4454cb8354e555499451828 Mon Sep 17 00:00:00 2001
From: dequis <dx@dxzone.com.ar>
Date: Fri, 9 Jun 2023 20:24:03 +0200
Subject: [PATCH] display: cleanup, reformat, remove unused stuff

---
 components/badge23/display.c                 | 74 +++-----------------
 components/badge23/include/badge23/display.h |  1 -
 2 files changed, 8 insertions(+), 67 deletions(-)

diff --git a/components/badge23/display.c b/components/badge23/display.c
index b8c5da869b..3944dfd7a7 100644
--- a/components/badge23/display.c
+++ b/components/badge23/display.c
@@ -10,56 +10,24 @@
 #include <string.h>
 #include <math.h>
 
-#include "badge23/scope.h"
 #include "esp_system.h"
 
 #include "../../usermodule/uctx/uctx/ctx.h"
 
 volatile Ctx *the_ctx = NULL;
 
-uint16_t *pixels;
-
-typedef struct leds_cfg {
-    bool active_paddles[10];
-} display_cfg_t;
-
-static QueueHandle_t display_queue = NULL;
-static void display_task(TimerHandle_t aaaaa);
-//static void display_task(void* arg);
-
-static void _display_init() {
-    GC9A01_Init();
-    //    GC9A01_Screen_Load(0,0,240,240,pixels);
-    GC9A01_Update();
-    
-	
-	
-    /*
-    display_queue = xQueueCreate(1, sizeof(display_cfg_t));
-    TaskHandle_t handle;
-    xTaskCreate(&display_task, "Display", 4096, NULL, configMAX_PRIORITIES - 3, &handle);
-    */
-    
-    /* SCOPE TASK
-    TimerHandle_t aa = xTimerCreate("Display", pdMS_TO_TICKS(100), pdTRUE, (void *) 0, *display_task);
-    if( xTimerStart(aa, 0 ) != pdPASS )
-    {
-    }
-    */
-}
-
 
 void display_ctx_init() {
-	the_ctx = ctx_new_for_framebuffer(
+    the_ctx = ctx_new_for_framebuffer(
         ScreenBuff,
         GC9A01_Width,
         GC9A01_Height,
         GC9A01_Width * 2,
         CTX_FORMAT_RGB565_BYTESWAPPED
     );
-	
-	// rotate by 180 deg and translate x and y by 120 px to have (0,0) at the center of the screen
-	ctx_apply_transform(the_ctx,-1,0,120,0,-1,120,0,0,1);
+
+    // rotate by 180 deg and translate x and y by 120 px to have (0,0) at the center of the screen
+    ctx_apply_transform(the_ctx,-1,0,120,0,-1,120,0,0,1);
 }
 
 void display_update(){
@@ -78,35 +46,9 @@ void display_fill(uint16_t col){
     GC9A01_FillRect(0, 0, 240, 240, col);
 }
 
-void display_draw_scope(){
-    //display_cfg_t  display_;
-    uint16_t line[240];
-    /*
-    printf("waiting...\n");
-    xQueueReceive(display_queue, &display_, portMAX_DELAY);
-    printf("go...\n");
-    */
-    //uint32_t t0 = esp_log_timestamp();
-    begin_scope_read();
-
-    for(int y=0; y<240; y++){
-        read_line_from_scope(&(line[0]), y);
-        memcpy(&ScreenBuff[y * 240], line, sizeof(line));
-    }
-    end_scope_read();
-
-    //uint32_t td = esp_log_timestamp() - t0;
-    // printf("it took %lu\n", td);
-    display_update();
-
-}
-//static void display_task(void* arg) {
-static void display_task(TimerHandle_t aaaaa) {
-    display_draw_scope();
-}
-
-void display_init() { 
-	_display_init(); 
-	display_ctx_init();
+void display_init() {
+    GC9A01_Init();
+    GC9A01_Update();
+    display_ctx_init();
 }
 
diff --git a/components/badge23/include/badge23/display.h b/components/badge23/include/badge23/display.h
index 213257aa07..e5f2d6e4aa 100644
--- a/components/badge23/include/badge23/display.h
+++ b/components/badge23/include/badge23/display.h
@@ -6,7 +6,6 @@
 
 void display_init();
 void display_ctx_init();
-void display_draw_scope();
 void display_update();
 void display_draw_pixel(uint8_t x, uint8_t y, uint16_t col);
 uint16_t display_get_pixel(uint8_t x, uint8_t y);
-- 
GitLab