board_control.cc 931 B

1234567891011121314151617181920212223242526272829303132
  1. #include <freertos/FreeRTOS.h>
  2. #include <freertos/timers.h>
  3. #include <freertos/task.h>
  4. #include <esp_log.h>
  5. #include "board.h"
  6. #include "boards/common/wifi_board.h"
  7. #include "boards/esp32-s3-touch-amoled-1.8/config.h"
  8. #include "iot/thing.h"
  9. #define TAG "BoardControl"
  10. namespace iot {
  11. class BoardControl : public Thing {
  12. public:
  13. BoardControl() : Thing("BoardControl", "当前 AI 机器人管理和控制") {
  14. // 修改重新配网
  15. methods_.AddMethod("ResetWifiConfiguration", "重新配网", ParameterList(),
  16. [this](const ParameterList& parameters) {
  17. ESP_LOGI(TAG, "ResetWifiConfiguration");
  18. auto board = static_cast<WifiBoard*>(&Board::GetInstance());
  19. if (board && board->GetBoardType() == "wifi") {
  20. board->ResetWifiConfiguration();
  21. }
  22. });
  23. }
  24. };
  25. } // namespace iot
  26. DECLARE_THING(BoardControl);