ESP3D Lib  1.0
3D Printer WiFi Library
esp3dlib.cpp
Go to the documentation of this file.
1 /*
2  This file is part of ESP3DLib library for 3D printer.
3 
4  ESP3D Firmware for 3D printer is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  ESP3D Firmware for 3D printer is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this Firmware. If not, see <http://www.gnu.org/licenses/>.
16 
17  This firmware is using the standard arduino IDE with module to support ESP8266/ESP32:
18  https://github.com/esp8266/Arduino
19  https://github.com/espressif/arduino-esp32
20 
21  Latest version of the code and documentation can be found here :
22  https://github.com/luc-github/ESP3D
23 
24  Main author: luc lebosse
25 
26 */
27 #include "esplibconfig.h"
28 
29 #if ENABLED(ESP3D_WIFISUPPORT)
30 #include "esp3dlib.h"
31 #include "wificonfig.h"
32 #include MARLIN_PATH(core/serial.h)
33 
35 
36 void WiFiTaskfn( void * parameter )
37 {
38  wifi_config.wait(100); // Yield to other tasks
40  for(;;) {
42  wifi_config.wait(0); // Yield to other tasks
43  }
44  vTaskDelete( NULL );
45 }
46 
47 
48 //Contructor
50 {
51 
52 }
53 
54 //Begin which setup everything
55 void Esp3DLib::init()
56 {
57  xTaskCreatePinnedToCore(
58  WiFiTaskfn, /* Task function. */
59  "WiFi Task", /* name of task. */
60  10000, /* Stack size of task */
61  NULL, /* parameter of the task */
62  1, /* priority of the task */
63  NULL, /* Task handle to keep track of created task */
64  0 /* Core to run the task */
65  );
66 }
67 //Parse command
68 bool Esp3DLib::parse(char * cmd)
69 {
70  String scmd = cmd;
71  if (scmd.startsWith("[ESP")) {
72  SERIAL_ECHO_START();
73  SERIAL_ECHOLNPAIR("it is ESP command:", cmd);
74  return true;
75  } else {
76  return false;
77  }
78 
79 }
80 #endif //ESP3D_WIFISUPPORT
wifi_config
WiFiConfig wifi_config
WiFiConfig::begin
static void begin()
Esp3DLib::Esp3DLib
Esp3DLib()
Esp3DLib::init
void init()
Initializes the task used by esp3dlib.
WiFiConfig::handle
static void handle()
esp3dlib
Esp3DLib esp3dlib
You must call esp3dlib.init() before using this variable.
esplibconfig.h
esp3dlib.h
wificonfig.h
Esp3DLib::parse
bool parse(char *cmd)
WiFiConfig::wait
static void wait(uint32_t milliseconds)
Esp3DLib
Definition: esp3dlib.h:29