Skip to content

Commit

Permalink
20240707
Browse files Browse the repository at this point in the history
- Changed file delete icon - fix #82
- Modify some Chinese words #84 - Thanks @yzwudong 🏆
- Update ru.json #79 - Thanks @valery7373 🏆
  • Loading branch information
xyzroe committed Jul 7, 2024
1 parent 1c2c33b commit 7d066aa
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
43 changes: 39 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void NetworkEvent(WiFiEvent_t event)
{
const char *wifiKey = "WiFi";
const char *ethKey = "ETH";

//esp_err_t result5;
switch (event)
{
case ARDUINO_EVENT_ETH_START: // 18: // SYSTEM_EVENT_ETH_START:
Expand Down Expand Up @@ -293,6 +293,27 @@ void NetworkEvent(WiFiEvent_t event)
WiFi.dnsIP().toString().c_str());
checkDNS(true);
LOGD("WiFi TX %s", String(WiFi.getTxPower()));

/*result5 = esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);
if (result5 == ESP_OK)
{
Serial.println("Wi-Fi protocol set successfully.");
}
else
{
Serial.printf("Error setting Wi-Fi protocol: %d\n", result5);
}
uint8_t cur_mode;
esp_wifi_get_protocol(WIFI_IF_STA, &cur_mode);
Serial.print("Current Wi-Fi protocol: ");
if (cur_mode & WIFI_PROTOCOL_11B)
Serial.print("802.11b ");
if (cur_mode & WIFI_PROTOCOL_11G)
Serial.print("802.11g ");
if (cur_mode & WIFI_PROTOCOL_11N)
Serial.print("802.11n ");
Serial.println();*/
break;
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: // SYSTEM_EVENT_STA_DISCONNECTED:
LOGD("%s STA DISCONNECTED", wifiKey);
Expand Down Expand Up @@ -365,8 +386,14 @@ void connectWifi()
}
WiFi.persistent(false);

// TO-DO protocol and power setup via GUI
esp_wifi_set_protocol(WIFI_IF_STA, networkCfg.wifiMode);
/*uint8_t cur_mode;
esp_wifi_get_protocol(WIFI_IF_STA, &cur_mode);
Serial.print("wifi mode ");
String result = "";
result += String(cur_mode, DEC);
Serial.println(result);
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N); // networkCfg.wifiMode); // WIFI_PROTOCOL_11B | ); //*/

if ((strlen(networkCfg.wifiSsid) >= 2) && (strlen(networkCfg.wifiPass) >= 8))
{
Expand Down Expand Up @@ -402,6 +429,15 @@ void connectWifi()
WiFi.setAutoReconnect(true);
WiFi.setTxPower(networkCfg.wifiPower);
LOGD("WiFi TX %s", String(WiFi.getTxPower()));
/*esp_err_t result = esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);
if (result == ESP_OK)
{
Serial.println("Wi-Fi protocol set successfully.");
}
else
{
Serial.printf("Error setting Wi-Fi protocol: %d\n", result);
}*/
LOGD("WiFi.begin");
}
else
Expand Down Expand Up @@ -625,7 +661,6 @@ void setup()
setup1wire(check1wire());

LOGI("done");

}

WiFiClient client[10];
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// AUTO GENERATED FILE
#ifndef VERSION
#define VERSION "20240612"
#define VERSION "20240707"
#endif
5 changes: 3 additions & 2 deletions src/websrc/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,15 @@ serial:

function fillFileTable(files) {
const icon_file = `<svg class="card_icon file_icon" viewBox="0 0 16 16"><use xlink:href="icons.svg#file" /></svg>`;
const icon_del = `<svg class="card_icon del_icon" viewBox="0 0 16 16"><use xlink:href="icons.svg#magic" /></svg>`;
//const icon_del = `<svg class="card_icon del_icon" viewBox="0 0 16 16"><use xlink:href="icons.svg#magic" /></svg>`;
const icon_del = `❌`;
files.forEach((elem) => { //.slice(0, files.length - 1)
if (elem.size > 0) {
let $row = $("<tr>").appendTo("#filelist")
$("<td class='col-min-width'>" + icon_file + "</td>").appendTo($row);
$("<td><a href='#config_file' onClick=\"readFile(event, '" + elem.filename + "');\">" + elem.filename + "</a></td>").appendTo($row);
$("<td>" + elem.size + "B</td>").appendTo($row);
$("<td class='text-end col-min-width'><a href='' onClick=\"delFile(event, '" + elem.filename + "');\">" + icon_del + "</a></td>").appendTo($row);
$("<td class='text-end col-min-width'><a href='' style='text-decoration: none !important;' onClick=\"delFile(event, '" + elem.filename + "');\">" + icon_del + "</a></td>").appendTo($row);
}
});
}
Expand Down

0 comments on commit 7d066aa

Please sign in to comment.