mirror of
https://github.com/Crocmagnon/display-epaper.git
synced 2024-11-21 05:28:03 +01:00
change temp display
This commit is contained in:
parent
0d991a2771
commit
6206898fb1
3 changed files with 7 additions and 11 deletions
1
go.mod
1
go.mod
|
@ -14,7 +14,6 @@ require (
|
||||||
require (
|
require (
|
||||||
github.com/carlmjohnson/requests v0.24.2
|
github.com/carlmjohnson/requests v0.24.2
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||||
golang.org/x/text v0.18.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require golang.org/x/net v0.27.0 // indirect
|
require golang.org/x/net v0.27.0 // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -12,8 +12,6 @@ golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw=
|
||||||
golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM=
|
golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM=
|
||||||
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
|
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
|
||||||
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
|
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
|
||||||
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
|
|
||||||
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
|
||||||
periph.io/x/conn/v3 v3.7.0 h1:f1EXLn4pkf7AEWwkol2gilCNZ0ElY+bxS4WE2PQXfrA=
|
periph.io/x/conn/v3 v3.7.0 h1:f1EXLn4pkf7AEWwkol2gilCNZ0ElY+bxS4WE2PQXfrA=
|
||||||
periph.io/x/conn/v3 v3.7.0/go.mod h1:ypY7UVxgDbP9PJGwFSVelRRagxyXYfttVh7hJZUHEhg=
|
periph.io/x/conn/v3 v3.7.0/go.mod h1:ypY7UVxgDbP9PJGwFSVelRRagxyXYfttVh7hJZUHEhg=
|
||||||
periph.io/x/host/v3 v3.8.2 h1:ayKUDzgUCN0g8+/xM9GTkWaOBhSLVcVHGTfjAOi8OsQ=
|
periph.io/x/host/v3 v3.8.2 h1:ayKUDzgUCN0g8+/xM9GTkWaOBhSLVcVHGTfjAOi8OsQ=
|
||||||
|
|
15
img.go
15
img.go
|
@ -11,8 +11,6 @@ import (
|
||||||
"github.com/Crocmagnon/display-epaper/weather"
|
"github.com/Crocmagnon/display-epaper/weather"
|
||||||
"github.com/llgcode/draw2d"
|
"github.com/llgcode/draw2d"
|
||||||
"github.com/llgcode/draw2d/draw2dimg"
|
"github.com/llgcode/draw2d/draw2dimg"
|
||||||
"golang.org/x/text/cases"
|
|
||||||
"golang.org/x/text/language"
|
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"log"
|
"log"
|
||||||
|
@ -100,10 +98,11 @@ func drawWeather(gc *draw2dimg.GraphicContext, wthr *weather.Prevision) {
|
||||||
log.Println("Failed to draw weather icon:", err)
|
log.Println("Failed to draw weather icon:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
text(gc, formatTemp("Act", wthr.Current.Temp), 18, 120, 45)
|
text(gc, formatTemp(wthr.Current.Temp), 23, leftX, 120)
|
||||||
text(gc, formatTemp("Max", daily.Temp.Max), 18, 240, 45)
|
|
||||||
text(gc, fmt.Sprintf("Pluie : %v%%", int(math.Round(daily.Pop))), 18, 120, 80)
|
text(gc, "max "+formatTemp(daily.Temp.Max), 18, 120, 45)
|
||||||
text(gc, cases.Title(language.French).String(dailyWeather.Description), 18, 120, 115)
|
text(gc, fmt.Sprintf("pluie %v%%", int(math.Round(daily.Pop*100))), 18, 120, 80)
|
||||||
|
text(gc, dailyWeather.Description, 18, 120, 115)
|
||||||
}
|
}
|
||||||
|
|
||||||
func drawWeatherIcon(gc *draw2dimg.GraphicContext, dailyWeather weather.Weather) error {
|
func drawWeatherIcon(gc *draw2dimg.GraphicContext, dailyWeather weather.Weather) error {
|
||||||
|
@ -123,8 +122,8 @@ func drawWeatherIcon(gc *draw2dimg.GraphicContext, dailyWeather weather.Weather)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatTemp(name string, temp float64) string {
|
func formatTemp(temp float64) string {
|
||||||
return fmt.Sprintf("%v : %v°C", name, int(math.Round(temp)))
|
return fmt.Sprintf("%v°C", int(math.Round(temp)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func drawVelov(gc *draw2dimg.GraphicContext, station *transports.Station, yOffset float64) {
|
func drawVelov(gc *draw2dimg.GraphicContext, station *transports.Station, yOffset float64) {
|
||||||
|
|
Loading…
Reference in a new issue