master
Jan Umbach 2023-08-11 13:18:34 +02:00
parent 828ee2428f
commit c97fd6a080
7 changed files with 131 additions and 0 deletions

2
CMakeLists.txt Normal file
View File

@ -0,0 +1,2 @@
idf_component_register(SRCS "src/jannex.c" "src/ota.c"
INCLUDE_DIRS "include")

71
Kconfig.projbuild Normal file
View File

@ -0,0 +1,71 @@
menu "Jannex Configuration"
config ESP_WIFI_SSID
string "WiFi SSID"
default "myssid"
help
SSID (network name) for the example to connect to.
config ESP_WIFI_PASSWORD
string "WiFi Password"
default "mypassword"
help
WiFi password (WPA or WPA2) for the example to use.
config ESP_WIFI_AP
bool "Create AP when no Wifi values are entered"
default n
help
Create AP when no Wifi values are entered.
config ESP_OTA_SERVER
string "OTA Server domain"
default ""
help
Enter the URL
choice FIRMWARE_BRANCH
prompt "Select branch"
default SELECTION_MASTER
help
Choose default branch.
config SELECTION_MASTER
bool "master"
config SELECTION_BETA
bool "beta"
config SELECTION_STABLE
bool "stable"
config SELECTION_PRODUCTION
bool "production"
config SELECTION_CUSTOM
bool "Enter custom branch"
endchoice
config FIRMWARE_BRANCH_CUSTOM
string "Enter branch name"
depends on SELECTION_CUSTOM
help
Enter custom branch
config FIRMWARE_UPDATE_SCAN
default 10
bool "Scan interval for updates"
help
Scans the ota server for new updates.
config FIRMWARE_UPDATE_SCAN_SECONDS
default 10
int "Scan interval for updates (in Seconds)"
depends on FIRMWARE_UPDATE_SCAN
help
Enter 0 to disable
endmenu

2
idf_component.yml Normal file
View File

@ -0,0 +1,2 @@
version: '0.0.1'
description: 'This is a test component'

15
include/jannex.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#ifndef CONFIG_ESP_WIFI_SSID
#error "WIFI SSID is not defined!"
#endif
static const char *jannexTAG = "JANNEX";
void initJannex();
void updateJannex();

1
include/ota.h Normal file
View File

@ -0,0 +1 @@
void checkForUpdatesAndInstall(void *parameter);

20
src/jannex.c Normal file
View File

@ -0,0 +1,20 @@
#include "jannex.h"
#include "ota.h"
#include <string.h>
#include "esp_log.h"
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void initJannex()
{
ESP_LOGI(jannexTAG, "LUL");
}
void updateJannex()
{
xTaskCreate(&checkForUpdatesAndInstall, "checkForUpdatesAndInstall", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}

20
src/ota.c Normal file
View File

@ -0,0 +1,20 @@
#include "jannex.h"
void checkForUpdatesAndInstall(void *parameter)
{
while (1)
{
printf("Task is running\n");
#ifdef CONFIG_FIRMWARE_UPDATE_SCAN_SECONDS
if (CONFIG_FIRMWARE_UPDATE_SCAN_SECONDS >= 1)
{
vTaskDelay(pdMS_TO_TICKS(CONFIG_FIRMWARE_UPDATE_SCAN_SECONDS * 1000)); // Delay for 1000 milliseconds
}
else
#endif
{
vTaskDelete(NULL);
}
}
}