Is it safe to call main() from anywhere?

Go To Last Post
59 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, what do you mean by "static" mode, and "change that static mode"?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As opposed to dynamic HTML, where I suppose the AVR would have to be involved in handling every request.

I'll have to ask this right out, so as to establish on what level we should discuss this: Are you aware of the functionality of the HTTP protocol? E.g. (just as a litmus paper) do you know the difference between a GET and a POST request?

Example on a dynamic scenario: Lets say you have ten temperature detectors and you want to be able to serve pages presenting any one of those temperatures to browsers requesting such. The request would typically look like:

http://my.server.org/temperature...

The thing serving a page will get the last part (the parameter telling it which temperature to serve), and from that construct the HTML response. Now, the WiFly module could not do that - it does not know what detectors are attached to your AVR, let alone how to handle them. It would have to be your AVR that constructs the responses dynamically for each request that comes in.

The typical static HTML case is that there are no parameters, and that the HTML content is constructed on beforehand, before the requests come in. In this scenario, the handling of the requests can be done by the WiFly module alone. "Static" does not mean that the reply can never change, it means that it is not constructed dynamically per each request.

Now, to continue, this is where my speculations start (since I have not come to grasp even what the problem you are having is): You are constructing such a static page, and pump it up to the WiFly module that is the HTTP server. It happily serves requests. But you want the page to be "live" so you upload a new version of it, say, every minute. The problem you are experiencing has to do with the WiFly serving a request and you at the same time are uploading a new HTTP content to it.

Am I getting close?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Based on different POST input from the browser, the AVR parses the data and makes a different webpage. I'm debugging it constantly, but if youre lucky you could see what i mean: tkurowski.dyndns.org

It takes about 5 seconds to load, and before you start clicking your heart away to turn the light on an off, note that you have to wait about 5 seconds before pressing either of the buttons between page loads.

Browser request sends a "GET" for the site data, browser request sends a "GET" for the site icon.

Browser request sends a "POST" when you click either of the buttons.

If youre interested in my HTML code:
Delays are required because I can't know if data is ready to be sent, or if it has all been sent. 2 seconds before and after seems to work nicely.

void sendWebsite()
{
	bool lightStatus = false;

	//Check the LED status
	if (PIND & 0b10000000) lightStatus = true;

	_delay_ms(2000);

//this part re-written for your reading ease:



html



Light:
Current state: if (lightStatus) uartSendString("ON\r\n"); else uartSendString("OFF\r\n");
/html _delay_ms(2000); }

Does this shed some light for you?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And the only problems I have:

if you refresh the site then it can screw up (depending on number of times and frequency of hitting refresh)

added delay loops because I cant know when information is ready to be sent

added delay loops because I cant know when information has been sent

browser requests after the page has loaded (sometimes it requests twice, sometimes it requests favicon), causing the connection to be locked up - this means you have to wait 5-10 seconds between pressing anything on the site.

Nothing can really be resolved. Some module enhancements would make things good, but I cant guarantee they will ever come :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Does this shed some light for you?


Not much. I don't get the mix of C and HTML. Looks like PHP turned inside out. Sort of..

Quote:
Browser request sends a "GET" for the site data, browser request sends a "GET" for the site icon.

What do you mean by "site data"?
Quote:
I can't know if data is ready to be sent, or if it has all been sent.

This is still a confusing question to me. If you have the data the you must surely know if it is ready for sending or not. This might just be a language thing - I am good at English but tend to try to read tech descriptions in a fairly formal way.

What I suggest is this: You do a description of what is happening, step by step. For each step, make it clear what pieces of the system is involved, what is going on etc.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Does this shed some light for you?


Not much. I don't get the mix of C and HTML. Looks like PHP turned inside out. Sort of..

Quote:
Browser request sends a "GET" for the site data, browser request sends a "GET" for the site icon.

What do you mean by "site data"?
Quote:
I can't know if data is ready to be sent, or if it has all been sent.

This is still a confusing question to me. If you have the data the you must surely know if it is ready for sending or not. This might just be a language thing - I am good at English but tend to try to read tech descriptions in a fairly formal way.

What I suggest is this: You do a description of what is happening, step by step. For each step, make it clear what pieces of the system is involved, what is going on etc. Then maybe we can wrestle this down. Right now I'm just getting more and more confused as to what the problem might be.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would LOVE to show you, but after trying to edit the post for 10 minutes, I still cant figure out why it wont let me post and instead shows up with the bad request page. Not a single percent sign either ..... what else can't there be?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here we go. This text file has my desired response post:

http://dl.dropbox.com/u/1682276/desiredPost.txt

Pages