We got most of the above things implemented and related bugs fixed.
The 2 includes that users can use :
spark_disable_wlan.h and spark_disable_cloud.h
I just thought of adding a Spark.wlan(boolean) function which application.cpp can use to enable/disable WLAN at will.
Also we need to have new RGB Led color management:
WLAN disabled: Breathing WHITE (This works now when you include the wlan disable include)
WLAN connecting: Flashing GREEN (works now)
WLAN connected and Cloud disabled: Breathing GREEN (pending). Currently this will flash GREEN with cloud disable include.
Today we got in a WiFiClass and the following methods could be used at runtime:
WiFi.on()
WiFi.off()
WiFi.status()
On the cloud side, we already had:
Spark.connect()
Spark.disconnect()
Spark.connected()
There’s a sample code provided in the comment section of this commit:
The RGB Led would display:
Wifi Off: Breathing White
Wifi Connecting: Flashing Green
Wifi On: Breathing Green (We got an IP address here)
Cloud Connecting: Flashing Cyan
Cloud Connected: Breathing Cyan
Hope this is now inline with user requirements.
PS: When WiFi is Off at startup, the application code should use (WiFi.status()==WIFI_ON) condition before proceeding with TCP/UDP usage.
I have no idea what is up here, but when I turn off WLAN, the thermal printer settings get crazy, and text prints inverted / upside down, etc.
I’m using serial1, and it is just based sets of bytes you send to the printer to change settings. Not sure why the lack of WiFi would cause a problem there…something weird is happening over serial for sure.
This sounds familiar. I remember a discussion about sleeping the CC3000 causing the main program loop to run slightly faster without any delays at all. Maybe throw a delayMicroseconds(10), or something in your loop or between large serial writes when the cc3000 is off?
Oh what the hell…kept coding, the fix stopped working…went back to the checkin with the fix and no other changes, cleaned all, built, still not working. Why the hell did it work the first time…
@choosatron Did you change the layout of your # includes at the top of your main sketch? For me they have to be in the right place and order for everything to compile right. And don’t forget the #include application.h
No…it appears it will sometimes under certain circumstances work…I think it has to do with when the firmware is rewritten but the printer is still powered up from a previous attempt (with WiFi I think), and if it hasn’t powered off, it’ll work.
It wasn’t really working. It appeared to be because if I don’t fully power down the printer after changing from WLAN to not, the printer evidently is still configured properly and will work. The first time it is powered off and on, it will be messed up.
@Dave & @RWB So it’ll print garbage at first, but if I power down the printer without powering down the Spark Core (leave USB power in for instance), then power up the printer again…suddenly the printer works fine. Closer…
Hi @choosatron! I don't know much about this printer, but it sounds like from this you don't have to run any initialization code. If there is a way to configure it over serial (i.e. change it's modes) Perhaps on Spark Core power up, your serial is outputting garbage which is changing your printer's configuration? Garbage in, garbage out. Can you put a scope or logic analyzer on it and see what it's doing on power up?
No, it doesn’t need much. It is all optional setup. I’m now comparing the hex values getting sent over serial with WLAN and without, and finding some interesting results! There are some strange bytes without WLAN, and though the commands are correct, the values sent with the commands aren’t. For example, it sends the correct bytes to send a text formatting change command, but the value sent without WLAN will switch on all sorts of crazy options (it is a single byte, using each bit as a flag for something like upside-down text, double width, etc). I’m on an interesting track though, so should know more soon.
Also @BDub, I’ve been shopping for a scope and / or logic analyzer. With the cost involved, I would LOVE recommendations. Both on which should be a priority, and actual hardware. Let’s assume I have some money to spend (this is part of my work now) but in the hobbyist quality realm, if that makes sense… I’ll let everyone know my results soon…