-
Notifications
You must be signed in to change notification settings - Fork 65
ESP8266: Customizing
µCNC for ESP8266 can be configured/customized to fit different ESP8266 powered boards other than Arduino WeMos D1
Jump to section
µCNC for ESP8266 can be customized either using the Web Config Tool or by manually modifing the source code files. For the latest method most configurations and pin assigning should be done in the corresponding boardmap file inside the uCNC/src/hal/boards/esp8266/ directory and then the respective board file.
An HAL pin need to be mapped to a physical IO pin. The way this is done is by defining the IO PORT and BIT. This must be performed for every used pin Digital pins are in "PORT" D and Analog pins are in "PORT" A This is similar to the general customization instructions
//set pin D2 as STEP0 (output pin)
#define STEP0_BIT 16 // assigns STEP0 pin
#define STEP0_PORT D // assigns STEP0 port
//set pin B3 as PWM0 (pwm output pin)
#define PWM0_BIT 2 // assigns PWM0 pin
#define PWM0_PORT D // assigns PWM0 pin
All input pins can have a weak pull-up activated to drive them high if unconnected. This is similar to the general customization instructions
All pins all repeatedly read by a soft polling routine. But for special function pins an interrupt driven event to force a reading and respective action can be also activated. This causes the response to be immediate and not depend on the pin reading routine cycle. For WeMos D1 mini the pin mapping can be checked here.
This is similar to the general customization instructions
By default ESP8266 uses the UART0 port. It also makes available a telnet server to be able to connect via WiFi. If not configured an ESP8266 WiFi network will be available. To access the WiFi setup connect to this network then open a browser and navigate to 192.168.4.1. Configure your home network parameters there. The device will then connect to your home WiFi and you will be able to communicate with it via telnet.
On the ESP8266 due to the lack of periferals and timers the PWM is software generated. Besides defining the IO pins nothing else is needed. Timer1 is used for this function.
This is not implemented yet.
All step and dir pins are modified inside a timer ISR (µCNC's heartbeat). In the ESP8266 only one timer Timer1 is available. It is not possible to customize the Timer used.
This is not implemented yet.
WiFi interface exposes the following system commands that can be used to configure and control WiFi:
$wifion - this enables WiFi. When this command is issued all changes made to the WiFi settings are stored.
$wifioff - this disables WiFi. When this command is issued all changes made to the WiFi settings are stored.
$wifireset - this resets all WiFi settings.
$wifisave - this saves all WiFi settings. Settings will only be in effect after disabling and enabling the WiFi.
$wifiscan - scans all available WiFi AP's.
$wifissid - gets the current defined AP SSID.
$wifissid=<ssid> - (text) sets the current defined AP SSID.
$wifipass=<pass> - (text) sets the current WiFi password.
$wifimode=<mode_number> - (number) sets the WiFi mode. 1-STA+AP, 2-STA, 3-AP
$wifiip - gets the board IP address
µCNC is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. µCNC is distributed WITHOUT ANY WARRANTY.
Also without the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
µCNC Wiki
- Home
- Basic user guide
- Porting µCNC and adding custom HAL
- Customizing the HAL file
- Adding custom Tools and Modules to µCNC
- FAQ
µCNC for ALL MCU
µCNC for AVR
µCNC for STM32F1 and STM32F4
µCNC for SAMD21
µCNC for ESP8266
µCNC for ESP32
µCNC for NXP LPC176x
µCNC for NXP RP2040