Skip to content

Commit

Permalink
change pedal update task to core 1
Browse files Browse the repository at this point in the history
others move to core 0 for ESPNow
  • Loading branch information
tcfshcrw committed Jul 30, 2024
1 parent d96c0c7 commit d196038
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 51 deletions.
1 change: 1 addition & 0 deletions ESP32/include/ESPNOW_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
uint8_t Clu_mac[] = {0x36, 0x33, 0x33, 0x33, 0x33, 0x32};
uint8_t Gas_mac[] = {0x36, 0x33, 0x33, 0x33, 0x33, 0x33};
uint8_t Brk_mac[] = {0x36, 0x33, 0x33, 0x33, 0x33, 0x34};
uint8_t Host_mac[] = {0x36, 0x33, 0x33, 0x33, 0x33, 0x35};
uint8_t* Recv_mac;
uint16_t ESPNow_send=0;
uint16_t ESPNow_recieve=0;
Expand Down
58 changes: 7 additions & 51 deletions ESP32/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void setup()
NULL, /* parameter of the task */
1, /* priority of the task */
&Task1, /* Task handle to keep track of created task */
0); /* pin task to core 1 */
1); /* pin task to core 1 */
delay(500);

xTaskCreatePinnedToCore(
Expand All @@ -510,7 +510,7 @@ void setup()
NULL,
1,
&Task2,
1);
0);
delay(500);

#ifdef ISV_COMMUNICATION
Expand All @@ -523,7 +523,7 @@ void setup()
NULL,
1,
&Task3,
1);
0);
delay(500);
#endif

Expand Down Expand Up @@ -559,7 +559,7 @@ void setup()
NULL,
1,
&Task4,
1);
0);
delay(500);
}
#endif
Expand Down Expand Up @@ -632,7 +632,7 @@ void setup()
NULL,
1,
&Task5,
1);
0);
delay(500);

#endif
Expand All @@ -642,51 +642,7 @@ void setup()
dap_calculationVariables_st.rudder_brake_status=false;
if(dap_config_st.payLoadPedalConfig_.OTA_flag==0)
{
/*
WiFi.mode(WIFI_MODE_STA);
Serial.print("MAC Address: ");
Serial.println(WiFi.macAddress());
if(dap_config_st.payLoadPedalConfig_.pedal_type==0)
{
esp_wifi_set_mac(WIFI_IF_STA, &Clu_mac[0]);
}
if(dap_config_st.payLoadPedalConfig_.pedal_type==1)
{
esp_wifi_set_mac(WIFI_IF_STA, &Brk_mac[0]);
}
if(dap_config_st.payLoadPedalConfig_.pedal_type==2)
{
esp_wifi_set_mac(WIFI_IF_STA, &Gas_mac[0]);
}
delay(300);
Serial.print("new MAC Address: ");
Serial.println(WiFi.macAddress());
ESPNow.init();
Serial.println("wait for ESPNOW initialized");
delay(10000);
if(dap_config_st.payLoadPedalConfig_.pedal_type==1)
{
Recv_mac=Gas_mac;
}
if(dap_config_st.payLoadPedalConfig_.pedal_type==2)
{
Recv_mac=Brk_mac;
}
if(ESPNow.add_peer(Recv_mac)== ESP_OK)
{
ESPNOW_status=true;
Serial.println("Sucess to add peer");
}
else
{
ESPNOW_status=false;
Serial.println("Fail to add peer");
}
ESPNow.reg_recv_cb(onRecv);
ESPNow.reg_send_cb(OnSent);
*/

xTaskCreatePinnedToCore(
ESPNOW_SyncTask,
"ESPNOW_update_Task",
Expand All @@ -695,7 +651,7 @@ void setup()
NULL,
1,
&Task6,
1);
0);
delay(500);


Expand Down

0 comments on commit d196038

Please sign in to comment.