From aea725b308764012b780513d5f95369867e81838 Mon Sep 17 00:00:00 2001 From: suraj151 Date: Thu, 6 Feb 2020 20:34:00 +0530 Subject: [PATCH] update readme --- README.md | 10 ++++------ .../{testing/testing.ino => EwStack/EwStack.ino} | 4 ++++ library.properties | 10 +++++----- src/config/Common.h | 3 ++- src/service_provider/WiFiServiceProvider.cpp | 4 ++-- src/service_provider/WiFiServiceProvider.h | 4 ++-- src/utility/TaskScheduler.cpp | 14 +++++++------- 7 files changed, 26 insertions(+), 23 deletions(-) rename examples/{testing/testing.ino => EwStack/EwStack.ino} (54%) diff --git a/README.md b/README.md index f445e46..7e02112 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,8 @@ Ewings Framework is cover all essential things to build ESP8266 IoT applications easily. Basically it is designed on the top of arduino-esp8266 layer to make things easy to understand for developers. - **Ewings Esp8266 Framework Structure** - ![Ewings Esp8266 Framework Structure](doc/ewings_stack.jpg) ESP8266 Wi-Fi SoC offers a complete and self-contained Wi-Fi networking solution. When the ESP8266 hosts application, it boots up directly from an external flash. @@ -25,9 +23,10 @@ Ewings framework sits on the top of these Arduino libraries. So the whole struct ## Usage clone or download source, copy folder to esp8266 libraries path ( in windows 10 generally path is like ==> C:\Users\suraj\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.2\libraries...) and restart the arduino ide. now in arduino ide navigate to File->Examples->EwingsEsp8266Stack->testing example compile and upload. -**Note** that installed version of esp8266 should be > 2.6.x. 2.6.2 or greater is recommended. you can check your installed esp8266 version in tools->boards->board manager. -**for now** : if you are uploading it first time in device then press flash key on nodemcu board for upto 10 seconds after 18-20 seconds from device initialize to load first default settings. device will get reset to default settings and restart. +**Note** that installed version of esp8266 should be > 2.6.x. 2.6.2 or greater is recommended. you can check your installed esp8266 version in tools->boards->board manager (type "esp" in top search bar). + +**for now** : if you are uploading it first time in device then wait for 5 seconds(default station connect timeout on start) and then press flash key on nodemcu board for upto 6-7 seconds to load first default settings. device will get reset to default settings and restart. * after initialing device completely check in pc/mobile wifi list if **esp8266Stack** name appear. * select it and enter default password **espStack@8266**. @@ -36,9 +35,8 @@ clone or download source, copy folder to esp8266 libraries path ( in windows 10 * now you will able to see below menu options ![Local Portal](doc/portal_home_menu.jpg) -you can play with all settings. you can make custom default configs by making changes in files of src/config folder. -got to wifi settings and change the default station ssid, password to connect to your station. you can also change ssid and password for access point. device will reset once after you submit wifi settings, i.e. you have to reconnect device. +you can play with all settings. you can modify configs by making changes in files of src/config folder. Go to wifi settings and change the default station ssid, password to connect to your station. you can also change ssid and password for access point. device will reset once after you submit wifi settings, i.e. you have to reconnect device. **Note** that by default session will active for 300 seconds once login, you can change its timeout in server config file. diff --git a/examples/testing/testing.ino b/examples/EwStack/EwStack.ino similarity index 54% rename from examples/testing/testing.ino rename to examples/EwStack/EwStack.ino index f3fb611..0f98e2d 100644 --- a/examples/testing/testing.ino +++ b/examples/EwStack/EwStack.ino @@ -1,3 +1,7 @@ +/* stack initialize the services in setup and + * should serve in loop continueously + */ + #include void setup() { diff --git a/library.properties b/library.properties index 9043ca1..11a7fdb 100644 --- a/library.properties +++ b/library.properties @@ -1,10 +1,10 @@ -name=EwingsEsp8266Stack +name=esp8266-framework version=1.0 author=Suraj I. -maintainer=Suraj I. -sentence=testing [project] -paragraph= +maintainer=Suraj I. +sentence=esp8266 framework stack for easy configurable applications +paragraph=esp8266 framework stack for easy configurable applications category=Communication -url= +url=https://github.com/Suraj151/esp8266-framework architectures=esp8266 dot_a_linkage=true diff --git a/src/config/Common.h b/src/config/Common.h index 33fe7ae..0094346 100644 --- a/src/config/Common.h +++ b/src/config/Common.h @@ -66,6 +66,7 @@ extern "C" { /** * @define wifi & internet connectivity check cycle durations */ +#define WIFI_STATION_CONNECT_ATTEMPT_TIMEOUT 5 // will try to connect within this seconds #define WIFI_CONNECTIVITY_CHECK_DURATION 10000 #define INTERNET_CONNECTIVITY_CHECK_DURATION WIFI_CONNECTIVITY_CHECK_DURATION @@ -96,7 +97,7 @@ extern "C" { #define MAX_EVENT_CALLBACK_TASKS MAX_SCHEDULABLE_TASKS /** - * callback type + * Define required callback type */ typedef std::function CallBackIntArgFn; typedef std::function CallBackVoidArgFn; diff --git a/src/service_provider/WiFiServiceProvider.cpp b/src/service_provider/WiFiServiceProvider.cpp index 3af6912..842acbf 100644 --- a/src/service_provider/WiFiServiceProvider.cpp +++ b/src/service_provider/WiFiServiceProvider.cpp @@ -180,7 +180,7 @@ bool WiFiServiceProvider::configure_wifi_station( wifi_config_table* _wifi_crede while ( ! this->wifi->isConnected() ) { delay(999); - if( _wait%8 == 0 ){ + if( _wait%7 == 0 ){ #ifdef EW_SERIAL_LOG Log(F("\ntrying reconnect")); #endif @@ -209,7 +209,7 @@ bool WiFiServiceProvider::configure_wifi_station( wifi_config_table* _wifi_crede }else if( this->wifi->status() == WL_NO_SSID_AVAIL ){ #ifdef EW_SERIAL_LOG Log(_wifi_credentials->sta_ssid); - Logln(F(" Not Found/reachable. Make sure it's availability in range.")); + Logln(F(" Not Found/reachable. Make sure it's availability.")); #endif }else if( this->wifi->status() == WL_CONNECT_FAILED ){ #ifdef EW_SERIAL_LOG diff --git a/src/service_provider/WiFiServiceProvider.h b/src/service_provider/WiFiServiceProvider.h index 2bacedb..2caab95 100644 --- a/src/service_provider/WiFiServiceProvider.h +++ b/src/service_provider/WiFiServiceProvider.h @@ -34,9 +34,9 @@ class WiFiServiceProvider : public ServiceProvider { } /** - * @var uint8_t|16 wifi_connection_timeout + * @var uint8_t wifi_connection_timeout */ - uint8_t wifi_connection_timeout=14; + uint8_t wifi_connection_timeout = WIFI_STATION_CONNECT_ATTEMPT_TIMEOUT; /** * @var uint8_t array temperory mac buffer diff --git a/src/utility/TaskScheduler.cpp b/src/utility/TaskScheduler.cpp index cccf83e..ad6a3a3 100644 --- a/src/utility/TaskScheduler.cpp +++ b/src/utility/TaskScheduler.cpp @@ -126,7 +126,7 @@ void TaskScheduler::handle_tasks(){ for (uint16_t i = 0; i < _task_count; i++) _priority_indices[i] = i; for (uint16_t i = 0; i < _task_count; i++) { for (uint16_t j = i + 1; j < _task_count; j++) { - if ( this->_tasks[i]._task_priority < this->_tasks[i]._task_priority ) { + if ( this->_tasks[i]._task_priority < this->_tasks[j]._task_priority ) { std::swap(_priority_indices[i], _priority_indices[j]); } } @@ -231,12 +231,12 @@ int TaskScheduler::get_unique_task_id( ){ void TaskScheduler::printTaskSchedulerLogs(){ Logln(F("\nTasks : ")); - Log(F("id"));Log("\t"); - Log(F("priority"));Log("\t"); - Log(F("duration"));Log("\t"); - Log(F("last_ms"));Log("\t\t"); - Log(F("execute_ms"));Log("\t"); - Log(F("max_attempts"));Logln(); + Log(F("id\t")); + Log(F("priority\t")); + Log(F("duration\t")); + Log(F("last_ms\t\t")); + Log(F("execute_ms\t")); + Log(F("max_attempts\n")); for ( int i = 0; i < this->_tasks.size(); i++) { Log(this->_tasks[i]._task_id);Log("\t");