Software

# The source code

The s2.x software versions require completely new hardware version, h2.0. They are not compatible with older hardware versions (h1.x)!

The project is now hosted on github.com:

https://github.com/pulsar123/Fast-Stacker

Stable releases on github:

https://github.com/pulsar123/Fast-Stacker/releases

**Warning**: if you get the package from github, you will have to create a folder "stacker", and then move all the files inside that folder.

The older versions are still available here:

http://pulsar124.wikia.com/wiki/Old\_versions

Use the official Arduino IDE to compile the code and upload it to your microprocessor:

https://www.arduino.cc/en/Main/Software

To add support to ESP8266 microcontrollers to your Arduuino IDE, go to File > Preferences in the IDE, and enter the following link into the “Additional Boards Manager URLs” field: http://arduino.esp8266.com/stable/package\_esp8266com\_index.json . Then go to Tools > Board > Boards Manager, and press install button for the “ESP8266 by ESP8266 Community“ option. After that pick the appropriate board: go to Tools > Board, and pick "LOLIN(WEMOS) D1 R2 & mini". **Make sure to choose the correct CPU frequency: Tools > CPU Frequency > 160 MHz** (the default one is 80 MHz). Set the Upload speed to 512000. You should choose the option "All Flash Content" under Tools > Erase setting on Arduino IDE after each software upgrade, and for your very first install.

**Important**: due to some annoying properties of ESP8266 microcontrollers, you can upload software to the controller unit only if the rail (motor unit) is attached to the controller via Cat5 cable. Also, the limiter switches should not be in ON (triggered) position. This is due to the fact that the pin D8 (used to read the state of the limiting switches) cannot be in HIGH state at boot time. (And if you disconnect the rail, or one of the limiting switches is On, D8 will be in HIGH state.)

In my code I am using the following publicly available libraries for Arduino

* TFT\_eSPI - fast library for ST7735 TFT display (https://github.com/Bodmer/TFT\_eSPI); copy the customized file User\_Setup.h to the library's folder
* MCP23S17 Class for Arduino (included, customized; https://playground.arduino.cc/Main/MCP23S17/)
* Keypad library (included, customized): http://playground.arduino.cc/Code/KeypadTdu

For the TFT\_eSPI library - you have to create a file *User\_Setup.h* with the following lines inside the library folder (it is C:\Users\XXX\Documents\Arduino\libraries\TFT\_eSPI-master on my Windows machine; replace XXX with your user name):

```
#define ST7735_DRIVER      // Define additional parameters below for this display
#define TFT_WIDTH  128
#define TFT_HEIGHT 160
#define ST7735_BLACKTAB
#define TFT_CS   PIN_D0  // Chip select control pin D8
#define TFT_DC   PIN_D4  // Data Command control pin
#define TFT_RST  -1    // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define SPI_FREQUENCY  40000000
#define SPI_READ_FREQUENCY  20000000
#define SPI_TOUCH_FREQUENCY  2500000

```

# Customizing my code

There are some macro parameters in stacker.h file which you might have to modify: