verständinsproblem addressausgabe dynamische Liste?

Hallo,

ich habe eine Liste in C erstellt, dies scheint wohl zu funktionieren, allerdings habe ich ein Problem mit der Ausgabe der Adresse der einzelnen Elemente in der Liste

Zunächst rufe ich für alle Files die Funktion "appenFileName_v" auf.
zum schluss rufe ich dann noch einmal die Funktion: "printList_v" auf um zu überprüfen ob alle elemente vorhanden sind

struct fileList_ts
{
  char* name;
  struct fileList_ts* next;
};
static struct fileList_ts* fileList_ps = NULL;
static void appendFileName_v(char* value)
{
  struct fileList_ts *newElement_ps;
  if (fileList_ps == NULL) // check if there is already an element in the list
  {
    if((fileList_ps = malloc(sizeof(struct fileList_ts))) == NULL)
    {
      ESP_LOGE(TAG, "no free memory for starting list");
    }
    else
    {
      ESP_LOGI(TAG, "address fileList_ps: %p", &fileList_ps);
      fileList_ps->name = (char *)malloc(strlen(value) + 1);
      strcpy(fileList_ps->name, value);
      fileList_ps->next = NULL;
    }
  }
  else
  {
    newElement_ps = fileList_ps; // point to first element
    while(newElement_ps->next != NULL) // go to last element
    {
      newElement_ps = newElement_ps->next;
    }
    if((newElement_ps->next = malloc(sizeof(struct fileList_ts))) == NULL) // reserve memory for the new element
    {
      ESP_LOGE(TAG, "no free memory for the new element");
    }
    else
    {
      newElement_ps = newElement_ps->next; // point to new memory
      newElement_ps->name = (char *)malloc(strlen(value) + 1);
      ESP_LOGI(TAG, "address newElement: %p", &newElement_ps);
      strcpy(newElement_ps->name, value);
      newElement_ps->next = NULL;
    }
  }
}

static void printList_v(void)
{
    struct fileList_ts *pointer = fileList_ps;
    while(pointer != NULL) {
        ESP_LOGI(TAG, "printList: %p %s", &pointer, pointer->name);
        pointer = pointer->next;
   }
}


Die Ausgabe ist dann wie folg:

I (634) SD_CARD: address fileList_ps: 0x3ffb2fbc  SYSTEM~1
I (634) SD_CARD: address newElement: 0x3ffb8f10  HELLO.TXT
I (634) SD_CARD: address newElement: 0x3ffb8f10  FOO.TXT
I (634) SD_CARD: address newElement: 0x3ffb8f10  DREIECK.BMP
I (644) SD_CARD: address newElement: 0x3ffb8f10  DREIECK.PNG
I (644) SD_CARD: address newElement: 0x3ffb8f10  KREUZ.BMP
I (664) SD_CARD: address newElement: 0x3ffb8f10  TEST.BMP
I (664) SD_CARD: address newElement: 0x3ffb8f10  TEST2.BMP
I (664) SD_CARD: printList: 0x3ffb8f10 SYSTEM~1
I (664) SD_CARD: printList: 0x3ffb8f10 HELLO.TXT
I (674) SD_CARD: printList: 0x3ffb8f10 FOO.TXT
I (674) SD_CARD: printList: 0x3ffb8f10 DREIECK.BMP
I (674) SD_CARD: printList: 0x3ffb8f10 DREIECK.PNG
I (694) SD_CARD: printList: 0x3ffb8f10 KREUZ.BMP
I (694) SD_CARD: printList: 0x3ffb8f10 TEST.BMP
I (694) SD_CARD: printList: 0x3ffb8f10 TEST2.BMP

Die Namen sind also alle in der Liste drinn. Nur wundert es mich, dass die Adresse überall die selbe ist.

Code, Programmiersprache, Liste, C (Programmiersprache)

ESP32 Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled?

Hallo,

ich habe ein Problem mit meinem Code auf einem ESP32.
ich habe einen array von struct, welchen ich beschreiben möchte:

file_1.c

typedef struct{
  uint8_t green;
  uint8_t red;
  uint8_t blue;
}ledStrip_ts;
... ... ...
static ledStrip_ts lightbar_as[100];
... ... ...
      if (true == getPixelData_b(&graphicData_s.numOfCols_u32, &graphicData_s.numOfRows_u32, (uint8_t*)&lightbar_as[0]))... ... ...  

file_2.c:

bool getPixelData_b(uint32_t* numOfCols_pu32, uint32_t* numOfRows_pu32, uint8_t* pixelData_pu8)
{
.... .... ....
                bmpColorData_ps = bmpGetGraphicData_v(numOfCols_pu32, numOfRows_pu32);
                ESP_LOGI(TAG, "%p    numOfCols_pu32: %lu  numOfRows_pu32: %lu", bmpColorData_ps, *numOfCols_pu32, *numOfRows_pu32);
... ... ...
                uint32_t counter1 = 0;
                uint32_t counter2 = 0;
                uint32_t counter3 = 0;
                uint32_t y = 0;
                for(uint32_t x=0; x<(*numOfRows_pu32); x++)
                {
                    for(y=0; y<(*numOfCols_pu32); y++)
                    {
                        pixelData_pu8[counter1++] = bmpColorData_ps[counter2].green;
                        pixelData_pu8[counter1++] = bmpColorData_ps[counter2].red;
                        pixelData_pu8[counter1++] = bmpColorData_ps[counter2].blue;
                        ESP_LOGI(TAG, "r: 0x%02X    g: 0x%02X    b: 0x%02X", pixelData_pu8[counter3+1], pixelData_pu8[counter3], pixelData_pu8[counter3+2]);
                        counter2++;
                        counter3+=3;
                    }
                    counter2 += (4 - (y%4));    // Compression = 0 (BI_RGB): Bilddaten sind unkomprimiert, bedeutet
                                                // "Jede Bildzeile ist durch rechtsseitiges Auffüllen mit Nullen auf ein 
                                                // ganzzahliges Vielfaches von 4 Bytes ausgerichtet." (Wikipedia)
                }
... ... ...

Laut Ausgabe (und das ist richtig, sind es 14x14 pixel.
105 Elemente werden geschrieben, dann bekomme ich den Error.
Doch eigentlich ist mein Buffer doch 100 Elemente * 3 Byte (uint8_t red, green, blue). Also 300 Byte.

Als Ausgabe bekomme ich dann:

I (1414) GRAPHIC: r: 0xFF    g: 0xFF    b: 0xFF
I (1414) GRAPHIC: r: 0xFF    g: 0xFF    b: 0xED
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.


Core  0 register dump:
PC      : 0x400d836e  PS      : 0x00060730  A0      : 0x800d7e4e  A1      : 0x3ffbcf70
A2      : 0x3ffb2e38  A3      : 0x0000013b  A4      : 0x3ffb2e3c  A5      : 0x00000007
A6      : 0x00000077  A7      : 0x0000013b  A8      : 0x0000013d  A9      : 0x3ffb2f74
A10     : 0x00000165  A11     : 0x3ffb2f78  A12     : 0xc0ee0164  A13     : 0x00000586
A14     : 0x3f403a78  A15     : 0x000000ff  SAR     : 0x00000004  EXCCAUSE: 0x0000001c
EXCVADDR: 0xc0ee0164  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffd




Backtrace: 0x400d836b:0x3ffbcf70 0x400d7e4b:0x3ffbcfc0 0x400d7f3c:0x3ffbcff0 0x40088075:0x3ffbd020
--- 0x400d836e: getPixelData_b at C:/Projekte/ESP32/leuchtstab/main/graphic.c:101


--- 0x400014fd: strlen in ROM
--- 0x4000150d: strlen in ROM


--- 0x400d836b: getPixelData_b at C:/Projekte/ESP32/leuchtstab/main/graphic.c:101
--- 0x400d7e4b: lightbarExec_v at C:/Projekte/ESP32/leuchtstab/main/lightbar.c:116
--- 0x400d7f3c: lightbarTask_v at C:/Projekte/ESP32/leuchtstab/main/lightbar.c:184 (discriminator 1)
--- 0x40088075: vPortTaskWrapper at C:/Espressif/frameworks/esp-idf-v5.4/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

Wenn ich nur ein 3x2 pixel bild nehme, funktioniert es ohne probleme.

Code, C (Programmiersprache), ESP32

onclick-event auf webseite mittels python triggern?

Hallo,

ich habe auf einer Webseite eine Tabelle mit verschiedenen Einträgen.
Wenn ich einen Eintrag anklicke, wird eine Funktion aufgerufen

<td onclick="handleRestart(1,3)">xxxxxxxx</td>

Diese Funktion (handleRestart) kann sehe ich auch im Quelltext.

function handleRestart(neu, idx) {
	if (!idx) idx = 1;
	if (neu > 0) {
		jQuery.getJSON( url + "&callback=?", {
			quizSelection: idx
		}, function( retVal ) {
		  quiz = retVal;
		  if (quiz.error && quiz.error == "forbidden") {
			  handleServerError();
		  }
		  quiz.fragenPointer = 0;
		  anzFalsch = 0;
			jQuery("#frageContainer").html(renderQuestion(quiz.fragen[quiz.fragenIds[quiz.fragenPointer]]));
		  renderStats();
	  });
	} else {
	  quiz.fragenPointer = 0;
		anzFalsch = 0;
		for (i= 0; i < quiz.fragenIds.length; i++) {
			quiz.fragen[quiz.fragenIds[i]].answer = -1;
		}
		jQuery("#frageContainer").html(renderQuestion(quiz.fragen[quiz.fragenIds[quiz.fragenPointer]]));
		renderStats();
	}
}

Gibt es eine Möglichkeit mittels Python die Seite aufzurufen und dann die Funktion aus dem Python-script zu triggern?

Mittels "requests" kann ich ja http-requests schicken. Aber gibt es auch eine möglichkeit, wenn ich die Seite geladen habe

z.B.

 r = requests.get('webseite')

die Funktion (handleRestart) zu triggern?

Es gäbe noch weiter Funktionen, die ich dann aufrufen möchte, aber das denke ich ist dann ähnlich.

Wenn ich in der Tabelle auf einen Eintrag klicke, bekomme ich ein Quiz.
Im Quelltext wird durch ein Funktionsaufruf eine .json geholt. Diese würde ich mir gerne ansehen und evtl. Daten rausholen. Ziel ist es alle Fragen des Quiz zu bekommen, ohne händisch durchzugehen und diese aufzuschreiben.

HTML, Webseite, JavaScript, Code, Programmiersprache, Python, Python 3
Weitere Inhalte können nur Nutzer sehen, die bei uns eingeloggt sind.