General area when it fits no where else

Moderator: Mmiscool

User avatar
By aphawk
#55646 Mmiscool,

There are some strange problem.
I have an program that works ok even in this new firmware, but using the old syntax :

oledcls and not oled.cls()
oledprint variable,0,1 and not oled.print(variable,0,1)


If I change to the new syntax, my displays goes all black.

I noted that with the new syntax, oled.print("hello",0,0) don't works and make the display crazy, but using the old version oledprint "hello",0,0 works ok.

If I use the new oled.font(10) , I can't print correctly one variable after some text prints.

Other thing .... with different font sizes, what are the correct dimension for the x and y coordinates, or better yet, what is the size of the screen in terms of columns and lines for each font size ?

And at last, If I use one graphics command, like oled.rect , the last x coordinate for the display is fixed as the last coordinate that was drawn in that command. Even text can't be showed after that coordinate. And the oledcls can't fix this situation. This command must make a full reset of the display, blanking it all, AND fixing the correct size for columns and lines. Today this is not done this way.

By example, if I use oled.rect.fill(30,30,50,50) , I can't print nothing after the midle of the screen ( at X axis ), even if I use the oledcls .
User avatar
By Mmiscool
#55647 Is the variable you are printing a string or number.

If it is a number try using oled.print(str(number),1,1)
User avatar
By RyanC
#55648 Tried MMis' program and was able to recreate the results successfully. Really satisfying to have that finally working now. You're the man, thanks a lot :). For anyone wondering, the OLED section of the language reference pages are in a bit of disarray at the moment. Some of them give tft in the examples, some of them have misappropriated periods, etc. Kinda just have to play around with it until that gets straightened out.

Cheers
User avatar
By aphawk
#55651 Mmiscool,

This is the code I'm using, is my personal Weatherstation, for the city of São Paulo, Brasil, and is working with the new firmware :

Code: Select allmemclear
cls
gmt = -3
aux_unix = gmt * 3600
time.setup(gmt,1)
delay 6000
oledcls
oledprint "SP",0,0
gosub [PEGADADOS]
button "FIM",[SAIDA]
TIMER 61000,[RUNPROGRAM]
WAIT

[RUNPROGRAM]
gosub [PEGADADOS]
WAIT


[PEGADADOS]
query = "api.openweathermap.org/data/2.5/weather?q=Sao_Paulo,br&lang=pt&units=metric&appid=My_ID"
ret = wget(query)
desc = json(ret,"weather.description")
if len(desc) > 16 then
desc = left(desc,16)
end if
temp1 = json(ret,"main.temp")
temp2 = instr(temp1,".")
if temp2 > 0 then
temp3 = temp2 + 1
temp1 = left(temp1,temp3)
end if
temp_min = json(ret,"main.temp_min")
temp2 = instr(temp_min,".")
if temp2 > 0 then
temp3 = temp2 + 1
temp_min = left(temp_min,temp3)
end if
temp_max = json(ret,"main.temp_max")
temp2 = instr(temp_max,".")
if temp2 > 0 then
temp3 = temp2 + 1
temp_max = left(temp_max,temp3)
end if
press = json(ret,"main.pressure")
humid = json(ret,"main.humidity")
wind1 = json(ret,"wind.speed")
wind2 = json(ret,"wind.deg")
wind1 = wind1 * 3.6
wind1 = int(wind1)
ton = json(ret,"sunrise")
toff = json(ret,"sunset")
t1 = val(ton) + aux_unix
t2 = val(toff) + aux_unix
t1a = str(t1)
t2a = str(t2)
t1b = unixtime(t1a,"hour:min")
t2b = unixtime(t2a,"hour:min")
tim = json(ret,"dt")
tim = tim + aux_unix
tim = unixtime(tim)
name = json(ret,"sys.name")
hora = time("hour:min:sec")
oledprint "        ",4,0
oledprint hora,4,0
oledprint desc,0,1
oledprint "Temp Tmin Tmax",0,2
oledprint "                ",0,3
oledprint temp1,0,3
oledprint temp_min,5,3
oledprint temp_max,10,3
oledprint "Humi Pres  Vent",0,4
oledprint "                ",0,5
oledprint humid,0,5
oledprint press,5,5
oledprint wind1,11,5
oledprint "                ",0,7
oledprint "Nascer Por",0,6
oledprint t1b,0,7
oledprint t2b,7,7
return

[SAIDA]
timer 0
end


Some of the variables have a integer, others have a string.

I tried replacing all the OLED commands with the new syntax, but the program don't worked.

I will try more things tomorrow.