I also found Fysetc's code to be a bit uh... crap? is about the nicest thing I can say about it. The board it awful. FlashAir did this all inside an SD card. Why so clunky Fysetc? anyway...
I did rewrite their code to better suit using it for CPAP.
I ditched the gcode - don't need it.
Removed writing to eeprom. I crashed it several times trying to use gcode and having it write to the eeprom. It would just RST over and over. Luckily there is code to erase the eeprom.
changed the behavior of the built in LED.
Added static IP
Checks for WiFi connection every 5 minutes and tries to reconnect if it disconnects.
In fact, I made it so all you need to do is drop in your CONFIG file from FlashAir into the root of the SD and it will read in that to setup the card. No more SETUP.INI.
At the moment it will read in:
[WLANSD] ;(This section is not needed if you use DHCP)
DHCP_Enabled=No
IP_Address=192.168.0.8
Subnet_Mask=255.255.255.0
Default_Gateway=192.168.0.1
[Vendor]
LED=OFF
APPNAME=AirSense10
APPSSID=wifi SSID
APPNETWORKKEY=>wifi password
;---
- APPNAME becomes the network hostname of the card.
- If it doesn't find "DHCP_Enabled", finds "DHCP_Enabled=Yes" ,or has DHCP_Enabled=No but without the necessary IP_Address= set, it will just connect with DHCP. Basically the way FlashAir does out of the box with just setting APPSSID/APPNETWORKKEY.
- Default Gateway is not really needed but if omitted, ESP's wifi will create a gateway IP for you. It will use the first 3 octets of your IP and default the 4th to .1 That suits most people but could be an issue for others. Nothing in the code goes outside the network anyway.
- The LED is initially a Configuration indicator. Reading in the CONFIG file and connecting to WiFi. It then becomes a WiFi connected indicator. It can be set to ON, OFF, or BLINK. Set in CONFIG.
- On is on steady, the whole time it is connected. In your face. I would never use this mode but someone may get off on red LEDs next to their bed at night.
- Off will see the LED blink when connecting and after connecting to WiFi will stay lit for 5 seconds and then shut off. Never to be seen again unless you lose WiFi connection. Then rinse and repeat.
- Blink is a modified version of what their default was. Every 5 seconds it will very briefly (25ms) flash. I haven't tested it in the dark yet to see how annoying it will be but I can barely see it when it is on my desk. The LED won't even reach full output. If you have ever flashed this card you can pretty much get an idea of the flash rate. Except once every 5 seconds. This is the default if LED=ON|OFF is not in CONFIG.
- Adding ability to select 802.11B, G, or N for STA. According to Fysetc, B gives the greatest range but is the slowest and consumes more power. G is middle of the road in range/speed/power consumption. N is the fastest but with the shortest range and lowest power. As written above, the default for Fysetc is N. I'll use WLANAPMODE in CONFIG for both STA and if added later, AP.
- Add code to reduce the TX power to bare minimum to reach the router. Have it adjust up or down or just use a value specified in CONFIG. Possibly when webDav is accessed changed the power to full for fastest transfer. Assuming it can be changed on-the-fly and not restart of WiFi. I am guessing this is similar to FlashAir's NOISE_CANCEL. Less rf around my head at night please.
- Have the LED flash when WebDav is accessed. Like an activity indicator. The Jury in my head is still deliberating on this one.
- Adding AP support. Currently the Fysetc runs in STA with 802.11N but I read somewhere that AP uses B or G. I never use AP but someone might.
I wanted to learn Binary so I enrolled in Binary 101. I seemed to have missed the first four courses.
Stick it to the man, Download OSCAR and take back control of your data!
Thanks Ian. Like I didn't have enough Honey-Do projects to tackle.