2 Commits

Author SHA1 Message Date
9d3b64744f example: add .gitignore
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-11-20 09:05:46 +09:00
42b99f6527 example: add plot option
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-11-20 09:02:06 +09:00
6 changed files with 6 additions and 46 deletions

View File

@@ -78,12 +78,3 @@ sudo apt install nodejs npm nanopb
2. Check the serial monitor logs to find the IP address assigned to the device in STA mode, or the default AP address (usually `192.168.4.1`). 2. Check the serial monitor logs to find the IP address assigned to the device in STA mode, or the default AP address (usually `192.168.4.1`).
3. Open a web browser and navigate to the device's IP address. 3. Open a web browser and navigate to the device's IP address.
4. You should now see the ODROID Remote control panel. 4. You should now see the ODROID Remote control panel.
## Docs
- Hardkernel WiKi: [https://wiki.odroid.com/accessory/powermate](https://wiki.odroid.com/accessory/powermate)
## Repo
- Hardkernel Github: [https://github.com/hardkernel/odroid-powermate](https://github.com/hardkernel/odroid-powermate)
- Original Repo: [https://github.com/shinys000114/odroid-powermate](https://github.com/shinys000114/odroid-powermate)

View File

@@ -1,7 +1,7 @@
import argparse import argparse
import matplotlib.dates as mdates import matplotlib.dates as mdates
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import os
import pandas as pd import pandas as pd
@@ -88,7 +88,7 @@ def plot_power_data(csv_path, output_path, plot_types):
def main(): def main():
parser = argparse.ArgumentParser(description="Generate a plot from an Odroid PowerMate CSV log file.") parser = argparse.ArgumentParser(description="Generate a plot from an Odroid Smart Power CSV log file.")
parser.add_argument("input_csv", help="Path to the input CSV log file.") parser.add_argument("input_csv", help="Path to the input CSV log file.")
parser.add_argument("output_image", help="Path to save the output plot image (e.g., plot.png).") parser.add_argument("output_image", help="Path to save the output plot image (e.g., plot.png).")
parser.add_argument( parser.add_argument(

View File

@@ -8,6 +8,5 @@
void wifi_init_sta(void); void wifi_init_sta(void);
void wifi_init_ap(void); void wifi_init_ap(void);
void initialize_sntp(void); void initialize_sntp(void);
void wifi_set_auto_reconnect(bool enable);
#endif // ODROID_POWER_MATE_PRIV_WIFI_H #endif // ODROID_POWER_MATE_PRIV_WIFI_H

View File

@@ -81,14 +81,6 @@ void wifi_scan_aps(wifi_ap_record_t** ap_records, uint16_t* count)
*count = 0; *count = 0;
*ap_records = NULL; *ap_records = NULL;
wifi_set_auto_reconnect(false);
wifi_ap_record_t ap_info;
if (esp_wifi_sta_get_ap_info(&ap_info) != ESP_OK)
{
esp_wifi_disconnect();
}
// Start scan, this is a blocking call // Start scan, this is a blocking call
if (esp_wifi_scan_start(NULL, true) == ESP_OK) if (esp_wifi_scan_start(NULL, true) == ESP_OK)
{ {
@@ -108,16 +100,6 @@ void wifi_scan_aps(wifi_ap_record_t** ap_records, uint16_t* count)
} }
} }
} }
wifi_set_auto_reconnect(true);
if (esp_wifi_sta_get_ap_info(&ap_info) != ESP_OK)
{
if (!nconfig_value_is_not_set(WIFI_SSID))
{
wifi_connect();
}
}
} }
esp_err_t wifi_get_current_ap_info(wifi_ap_record_t* ap_info) esp_err_t wifi_get_current_ap_info(wifi_ap_record_t* ap_info)

View File

@@ -16,13 +16,9 @@
#include "wifi.h" #include "wifi.h"
#include "indicator.h" #include "indicator.h"
static bool s_auto_reconnect = true;
static const char* TAG = "WIFI"; static const char* TAG = "WIFI";
void wifi_set_auto_reconnect(bool enable) { s_auto_reconnect = enable; }
static void wifi_event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) static void wifi_event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data)
{ {
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STACONNECTED) if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STACONNECTED)
@@ -50,18 +46,10 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, int32_t e
} }
else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED)
{ {
led_set(LED_BLU, BLINK_TRIPLE); led_set(LED_RED, BLINK_TRIPLE);
wifi_event_sta_disconnected_t* event = (wifi_event_sta_disconnected_t*)event_data; wifi_event_sta_disconnected_t* event = (wifi_event_sta_disconnected_t*)event_data;
ESP_LOGW(TAG, "Disconnected from AP, reason: %s", wifi_reason_str(event->reason)); ESP_LOGW(TAG, "Disconnected from AP, reason: %s", wifi_reason_str(event->reason));
// ESP-IDF will automatically try to reconnect by default.
if (event->reason != WIFI_REASON_ASSOC_LEAVE)
{
if (s_auto_reconnect && !nconfig_value_is_not_set(WIFI_SSID))
{
ESP_LOGI(TAG, "Connection lost, attempting to reconnect...");
esp_wifi_connect();
}
}
} }
else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP)
{ {