Hi,
I'm trying to port my projects to Visual Micro
I can't get it to work.
the error message i get is:
Server.h:29: note void TbuildwebPage() previously defined here I figured out that the problem is that within the function initServerSite a call is made to the function Tbuildwebpage which is below in the code.
in Arduino IDE this problem can be avoided to define the functions in the fcode (see the first 3 code lines)
(It's not possible to set all the functions in the right order because they are ordered in different arduino files.)
I hope there is a solution for these problems, so i can try Visual Micro.
void TbuildwebPage();
void SetWebIO();
void SetTVon();
void initServerSite() {
WS.on("sitename", TbuildwebPage);
WS.on("sitename", SetWebIO);
WS.on("sitename", SetTVon);
}
void SetTVon() {
forceTVon = true;
}
void SetWebIO() {
int Adress = WS.arg("a").toInt();
int IO = WS.arg("i").toInt();
if (Adress == RS_ATSPANEL) {
addATSAreatoBuff(IO, C_TOGGLE);
}
else {
addOutputtoBuff(Adress, IO,C_TOGGLE);
}
String Output ="<html><head><meta http-equiv='refresh' content='5;url=sitename'/></head><body>Setting Area/Output: <b>" +String(IO) + "</b><br>Bus-Address: <b>" + String(Adress) +"</b><br>Action: <b>" + "TOGGLE" + "</b><br><br>wait for refresh</body></html>";
WS.send(200, "text/html", Output );
}
void TbuildwebPage() {
String Website = '250%';</script><table border='0'>";
File myFile = SD.open("/Settings/IOlist.ini");
bool state;
String imgurl;
String imgname;
while (myFile.available()) {
char RawAdress[2] = {myFile.read(),myFile.read()};
int IOadress = hexToDec(&RawAdress[0],2);
String IOnum = myFile.readStringUntil(',');
if (IOnum == "A") { //Speciale IO (douchefan)
}
String IOname = readFileLine(myFile);
if (IOadress == RS_ATSPANEL) {
state = GetSetIOstatus(IOadress, C_AREA, IOnum.toInt());
imgname = (state == true) ? "img" : "img";
}
else {
state = GetSetIOstatus(IOadress, C_OUTPUT, IOnum.toInt());
imgname = (state == true) ? "img" : "img";
}
Website += "<tr><td><img src='http://sitename + imgname + "'></td><td><a href='/site?a=" + String(IOadress) + "&i=" + IOnum + "'>" + IOname + "</a></td></tr>";
}
Website += "</table></body></html>";
Serial.println(Website);
WS.send(200, "text/html", Website);
}