Can I Turn the CC3000 OFF? [solved]

Sounds great @satishgn. I look forward to testing it as I am sure BDub is also.

2 Likes

Iā€™m also looking forward to this.

Thanks so much everybody for working on and fixing this issue.

2 Likes

Greetings All!

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.

Thanks,
Satish

5 Likes

@satishgn and everybody else. Thanks so much for getting this done!

Looking forward to putting it to use!

Go Spark Team Go :rocket:

1 Like

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. :smile:
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.

Did you locally load the new Firmware?

Yes I di. Padding padding.

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?

1 Like

Burst me britches! It worked. :slight_smile: I inserted the delayMicroseconds(10) at the beginning of my loop. Thanks Dave!

2 Likes

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. :frowning:

@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ā€¦

1 Like

@choosatron If you load your code via the Web Based IDE does the problem go away?

Not sure. I havenā€™t used the Web IDE for anything as of yet. Also, how would I get the project copied over from the web if it is offline?

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ā€¦ :slight_smile: Iā€™ll let everyone know my results soonā€¦

@choosatron Are you upgrading the Choosatron to run off the Spark Core now? did it have WiFi connectivity before?

@RWB It didnā€™t have WiFi before, but the Kickstarter was to use the Spark Core and add it.

@BDub & @Dave I solved the problemā€¦

Adafruitā€™s thermal library code isā€¦sloppy at best. The werenā€™t initializing a printMode value that they use all sorts of bitwise operators on, which was why after analyzing each byte sent to the printer, one this one value for one command ended up being screwy. For SOME reason it is aways 0 with WLAN, but without, it has garbage (one of the fun mysteries when you donā€™t initialize people!).

So yeahā€¦I want to put my head through a wall with how much time this ateā€¦but it is solved!

Sighā€¦

2 Likes