2024-01-20 17:56:00 +08:00
|
|
|
/* WiFi station Example
|
|
|
|
|
|
|
|
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, this
|
|
|
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
|
|
CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/task.h"
|
|
|
|
#include "freertos/event_groups.h"
|
|
|
|
#include "esp_system.h"
|
|
|
|
#include "esp_wifi.h"
|
|
|
|
#include "esp_event.h"
|
|
|
|
#include "esp_log.h"
|
|
|
|
#include "nvs_flash.h"
|
|
|
|
#include "driver/ledc.h"
|
|
|
|
#include "lwip/err.h"
|
|
|
|
#include "lwip/sys.h"
|
|
|
|
|
2024-01-22 03:36:10 +08:00
|
|
|
static const char *TAG = "wheel";
|
2024-01-20 17:56:00 +08:00
|
|
|
|
|
|
|
extern void can_init(void);
|
|
|
|
extern void ModBusTCPSlave_init(void);
|
|
|
|
extern void lis3dsh_fifo_stream(void);
|
|
|
|
extern void bdc_control_main(void);
|
|
|
|
extern void bdc_motor_init_all(void);
|
2024-01-22 03:36:10 +08:00
|
|
|
extern void wifi_init_sta(void);
|
2024-01-20 17:56:00 +08:00
|
|
|
|
|
|
|
void app_main(void)
|
|
|
|
{
|
|
|
|
// Initialize NVS
|
|
|
|
esp_err_t ret = nvs_flash_init();
|
|
|
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
|
|
|
|
{
|
|
|
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
|
|
ret = nvs_flash_init();
|
|
|
|
}
|
|
|
|
ESP_ERROR_CHECK(ret);
|
|
|
|
|
|
|
|
wifi_init_sta();
|
|
|
|
//can_init();
|
|
|
|
ModBusTCPSlave_init();
|
|
|
|
//bdc_control_main();
|
|
|
|
bdc_motor_init_all();
|
|
|
|
// lis3dsh_fifo_stream();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(100));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|