Ok Here is the code I used. It draws a graph with html5 and jscript. Then it fills the graph.
It was the idea to execute a
bfill.emit_p(PSTR("ctx.lineTo(pq+$D,$D);"),x,y);
for each point in the code in a loop and fetch the data out of the RAM
This code just has a few lines of the ctx.lineTo satement after each other to simulate the loop.
Increasing the size of byte Ethernet::buffer[6000]; has no effect. This was compiled for a ATMEGA2560 so a buffer of 6000 should be ok.
I'm now looking at the UIPEthernet code.
// This is a demo of the RBBB running as webserver with the Ether Card
// 2010-05-28 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
static byte myip[] = { 192,168,1,203 };
byte Ethernet::buffer[6000];
BufferFiller bfill;
void setup () {
Serial.begin(115200);
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");
ether.staticSetup(myip);
}
static word homePage() {
int x=1200;
int y=300;
int pq=30;
int xGrid=20;
int yGrid=30;
int lineWidth=2;
int xGridNumStart=10;
int xGridNumInc=10;
int yGridNumStart=1000;
int yGridNumInc=20;
int fontSize=9;
int xVal=0;
int yVal=0;
bfill = ether.tcpOffset();
//HTML HEADER
bfill.emit_p(PSTR(
"HTTP/1.0 200 OK\r\n"
"Content-Type: text/html\r\n"
"Pragma: no-cache\r\n"
"\r\n"
// "<meta http-equiv='refresh' content='1'/>"
"<title>Navtex Stat</title>"
"<!DOCTYPE html>"
"<html>"
"<body>"
"")); //,h/10, h%10, m/10, m%10, s/10, s%10);
//HTML PAGE
bfill.emit_p(PSTR(
"<canvas id='myCanvas' width='$D' height='$D' style='border:1px solid #c3c3c3;'>"
"Your browser does not support the HTML5 canvas tag."
"</canvas>"
"
"),x,y);
//HTML START SCRIPT
bfill.emit_p(PSTR("<script>"));
//DRAW TABLE AND FILL IT
bfill.emit_p(PSTR(
"var canvas=document.getElementById('myCanvas');"
"var ctx=canvas.getContext('2d');"
"var x=$D;"
"var y=$D;"
"var pq=$D;"
"var xGrid=$D;"
"var yGrid=$D;"
"var lineW=$D;"
"var xGridNumStart=$D;"
"var xGridNumInc=$D;"
"var yGridNumStart=$D;"
"var yGridNumInc=$D;"
"ctx.font='$Dpx Veranda';"
"var gridNum=0;"
"ctx.beginPath();"
"ctx.moveTo(pq,pq);"
"ctx.lineTo(pq,y-pq);"
"ctx.lineWidth=lineW;"
"ctx.strokeStyle = 'black';"
"ctx.stroke();"
"ctx.beginPath();"
"ctx.moveTo(pq,y-pq);"
"ctx.lineTo(x-pq, y-pq);"
"ctx.lineWidth=lineW;"
"ctx.strokeStyle = 'black';"
"ctx.stroke();"
"ctx.beginPath();"
"gridNum=xGridNumStart;"
"for(var num=pq+xGrid;num<x-pq;num=num+xGrid){"
"ctx.moveTo(num,y-pq);"
"ctx.lineTo(num,pq);"
"ctx.fillText(gridNum.toString(),num-(xGrid/3),y-pq/2);"
"gridNum += xGridNumInc;"
"}"
"gridNum=yGridNumStart;"
"for(var num=pq+yGrid;num<y-pq;num=num+yGrid){"
"ctx.moveTo(pq,y-num);"
"ctx.lineTo(x-pq,y-num);"
"ctx.fillText(gridNum.toString(),2,y-num);"
"gridNum += yGridNumInc;"
"}"
"ctx.lineWidth=1;"
"ctx.strokeStyle = 'grey';"
"ctx.stroke();"
//End draw draph
//Start draw data
"ctx.beginPath();"
"ctx.moveTo(pq,y-pq);"
"ctx.lineTo(pq+30,37);"
"ctx.lineTo(pq+50,49);"
"ctx.lineTo(pq+70,86);"
"ctx.lineTo(pq+90,103);"
"ctx.lineTo(pq+110,67);"
"ctx.lineTo(pq+130,97);"
// "ctx.lineTo(pq+150,37);"
// "ctx.lineTo(pq+170,49);"
// "ctx.lineTo(pq+190,124);"
// "ctx.lineTo(pq+200,235);"
),x,y,pq,xGrid,yGrid,lineWidth,xGridNumStart,xGridNumInc,yGridNumStart,yGridNumInc,fontSize);
bfill.emit_p(PSTR(
"ctx.lineWidth=3;"
"ctx.strokeStyle = 'green';"
"ctx.stroke();"
""
//CLOSE PAGE
"</script>"
""
"</body>"
"</html>"));
;
return bfill.position();
}
void loop () {
word len = ether.packetReceive();
word pos = ether.packetLoop(len);
if (pos) // check if valid tcp data is received
ether.httpServerReply(homePage()); // send web page data
}