Re: [PIC] Learning C
smplx <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.pic |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 19 Nov 2024, Harold Hallikainen wrote: > > > On Tue, November 19, 2024 6:44 pm, Justin Richards wrote: > >> An example is the choice of an esp8266 dynamically or statically >> generating >> table elements of a web page. >> >> Statically means I have to update two or more sections of code to make >> changes, where as dynamically requires making changing to only one >> section. >> >> The static option is more obvious and readable when later revisited but >> onerous to make changes where the dynamic code is quicker, less error >> prone but more obfuscated. >> > > I've used the Microchip TCP/IP stack a lot in several products. In these > products, there is a command interpreter that accepts commands over TCP > and a web interface that also has controls. At first, I was using standard > HTML FORM stuff and GET queries for the web interface, but I found I was > writing everything twice. Once for the command interpreter and once for > the web interface. In the last several products, I've put javascript in > the web interface that POSTS text commands that are then passed to the > same command interpreter that accepts commands over TCP. I only have to > write the code once! > Have you considered changing your CLI so that it can also receive requests from your HTML forms? Writing Common Gateway Interface (CGI) programs in C is very simple and stright forward. It might obviate the need to add javascript to you web pages. Friendly Regards Sergio Masci