From 0b973f8201a45ea5276eeae266715007dfea6cab Mon Sep 17 00:00:00 2001 From: c3ma Date: Wed, 31 May 2023 22:06:20 +0200 Subject: [PATCH] added icons --- client/src/broken_clouds.bmp | Bin 0 -> 4938 bytes client/src/few_clouds.bmp | Bin 0 -> 2762 bytes client/src/main.rs | 39 ++++++++++++++++++++++++++------ client/src/mist.bmp | Bin 0 -> 4938 bytes client/src/rain.bmp | Bin 0 -> 4938 bytes client/src/scattered_clouds.bmp | Bin 0 -> 4938 bytes client/src/shower.bmp | Bin 0 -> 4938 bytes client/src/snow.bmp | Bin 0 -> 4938 bytes client/src/thunderstorm.bmp | Bin 0 -> 4938 bytes 9 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 client/src/broken_clouds.bmp create mode 100644 client/src/few_clouds.bmp create mode 100644 client/src/mist.bmp create mode 100644 client/src/rain.bmp create mode 100644 client/src/scattered_clouds.bmp create mode 100644 client/src/shower.bmp create mode 100644 client/src/snow.bmp create mode 100644 client/src/thunderstorm.bmp diff --git a/client/src/broken_clouds.bmp b/client/src/broken_clouds.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8b9112deeddcd9d8d9e2d7cf07d7c09bc782653d GIT binary patch literal 4938 zcmeHJF%H5o3=BL07IqdU9?=B}iG{DQ@&aDP&x#d;sX}sg8bz&2A`-dw`R?L^M0YuF zonH?+@3ar^y>dIBe{P)HA9?$PKYHi* z14uG?VAZb3%t1SllhRbWzXryc7oL(JOF9dTU1d>afw3-Cjci7kDmMfWC$C|W<4>i^ S-v*Hr6$zx&f;NF^C-4Gx(_+v7 literal 0 HcmV?d00001 diff --git a/client/src/few_clouds.bmp b/client/src/few_clouds.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b6c3fd58d4eb1a3e443b0e808cd0f237fdb99d65 GIT binary patch literal 2762 zcmds%c~nhn7{-4kNhEWIj2SXz2$@SsrbxyjL?knrB0@4GGS8HZWgf~Dg-97H4dyX3 zB~<3&oZUJ5Y^Pdx-F5FDcinHDz4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PfzFFyLV({Wbpp|dp>;lz{igt$;`|o zD=Ula>})=L`o!nYpZW6T3tzu}<=eM!eE(o+mQYHToMTewOVk%>E zW)vsQS0}tSu_^+InH(y4!B1^8sZ^yC1{UL`8mXU-XFq(xa3pNg77oxk$m)+q+aKTw?TzXyH; DuYg9| literal 0 HcmV?d00001 diff --git a/client/src/main.rs b/client/src/main.rs index 4c54ee9..0923c62 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -105,6 +105,12 @@ impl DrawTarget for UdpDisplay { } } +fn renderWeatherIcon(display: &mut UdpDisplay, icon: &[u8]){ + let icon_image = Bmp::from_slice(icon).unwrap(); + Image::new(&icon_image, Point::new((IMAGE_WIDTH-40) as i32, 0)).draw(display).unwrap(); + +} + fn renderWeather(display: &mut UdpDisplay ,data: &Option>){ let text_style = MonoTextStyle::new(&FONT_6X10, BinaryColor::On); @@ -125,10 +131,31 @@ fn renderWeather(display: &mut UdpDisplay ,data: &Option { - let sun_icon = include_bytes!("sun.bmp"); - let sun_icon_image = Bmp::from_slice(sun_icon).unwrap(); - Image::new(&sun_icon_image, Point::new((IMAGE_WIDTH-40) as i32, 0)).draw(display).unwrap(); - + renderWeatherIcon(display, include_bytes!("sun.bmp")); + }, + "02" => { + renderWeatherIcon(display, include_bytes!("few_clouds.bmp")); + }, + "03" => { + renderWeatherIcon(display, include_bytes!("scattered_clouds.bmp")); + }, + "04" => { + renderWeatherIcon(display, include_bytes!("broken_clouds.bmp")); + }, + "09" => { + renderWeatherIcon(display, include_bytes!("shower.bmp")); + }, + "10" => { + renderWeatherIcon(display, include_bytes!("rain.bmp")); + }, + "11" => { + renderWeatherIcon(display, include_bytes!("thunderstorm.bmp")); + }, + "13" => { + renderWeatherIcon(display, include_bytes!("snow.bmp")); + }, + "50" => { + renderWeatherIcon(display, include_bytes!("mist.bmp")); }, _ => { println!("Missing icon for {short_icon_code}"); @@ -167,11 +194,9 @@ fn send_package(ipaddress: String, data: &Option> // .into_styled(PRIMITIVE_STYLE) // .draw(&mut display) // .unwrap(); - - renderWeather(&mut display, data); - + package[1..PACKAGE_LENGTH].copy_from_slice(&display.image); diff --git a/client/src/mist.bmp b/client/src/mist.bmp new file mode 100644 index 0000000000000000000000000000000000000000..02304d8b53cb000a7562bbc08b54840ae05f3742 GIT binary patch literal 4938 zcmeHHF%H5o3^Y6e7IqdU9?=B}iG{DQ@&aDP&x#cX6A|QIB2uK_s7YP>eAis64yWUq z!npBz<++Pgs( z1Mc%YpMv|`x6gjQ9iJ~BZqwb#$CFERscUS?DCOpqW(;yJ8P!rD#S5*?Y*&Q}!6*_D zWiY~tU{YO)Cs&)+uBPNTQoFcChGsa(Gif!C8J{PSOw@kfkd_ovt(%f?jPuBwzO`3B j{z@0z@^?3@E*Z2^!fjDbBv5iAKzQmfA4Th^{;lf){v&GS literal 0 HcmV?d00001 diff --git a/client/src/rain.bmp b/client/src/rain.bmp new file mode 100644 index 0000000000000000000000000000000000000000..727c81dd8bb735f0eec491f66418e257d610c011 GIT binary patch literal 4938 zcmeHGF%H5o3=BL07IqdU9?=B}iG{DQ@&aDP&x#eJ(Aw6;)E!Vs)I{<5d{?__cR6oU zUJp9&v=8sSO1q3dH!1CpyfcuGJ|%u~)Sa%kPtJE+`)G~TCeS7jnn2&vuR2-+p->~E z0{YvPh#=@tmk5MHjR+k<5ZNCLb5Emz>lOqeLTXAQ)lR8IREbc_RtZ&8CTJaJVWGtp ziqujsG@@CSe?DyI=VPW*jc8bBS{BRV>@-KN!pb-s@ugZ4H}y?0=rt_Qw#G+Xq%SvX zwq}CEK}GIB9Hb(ST#LnVcA7hBR%NRMvi5LFk6)2NUvuf079_6qP0%ba&4MgQu~9hz u(@g0%H)&PSufwle6?78*&6mdFX?flumu~@NL8_DoFKi*spk^yy*aTh{l558R literal 0 HcmV?d00001 diff --git a/client/src/scattered_clouds.bmp b/client/src/scattered_clouds.bmp new file mode 100644 index 0000000000000000000000000000000000000000..171c920dbfbcb659421b53b26b7103a568809287 GIT binary patch literal 4938 zcmeH{F>V4u3`GZy08M(DR2*WPNJunXg_aZKRJqy48l#V8&v?8RQJNXCE8Fw@zj3k4 z^>QrreAD|u&*$^mm5*BgIh1lb^HU4;wU)xank`?q`|BU!Xza?NF)VF%fy8O~w02rZt4=sf zNGOgMqducN&*F8_2Qa$0e7Xj=RLdD&r@{chr-%W5dXro-3DSwdbkXva>NS~oxdd=e zb6DI;1c{bXya+KzxfqfO6&gSx0aR#`AE7E>2*yH_=pZm?HK`fIQqlyx++uVfr#*G9 zo)C;h#WvnhN9c(N&2wRyG};5ax%q&4n95DS l9BT7;5}3ddKNW3kTR9bm*ixcsD~3bNz5R!lS>d5KZ~;zat%U#p literal 0 HcmV?d00001 diff --git a/client/src/snow.bmp b/client/src/snow.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9138b668ba1dd1f3088731ac89d5c647bff9e05b GIT binary patch literal 4938 zcmchSK~BR^3`7G*fDL;#tT;qBNJwnB3R_OVskmABiqXTJah#L}sx}(WJde}E%k%9t ze?G?Zef%E2e^=Ap?0?=&)BR)oW@COFrzyVkba;Aw`^mPc>uuONb(}xz+}=do9nZas zPx}1d`CVsDDt+I7TjY8*;j&>CXUWDKa@UjQIVy zw1qE1+DOIsagf<;7KspfF?1OXQ%JBJg(;-eWCHGUC^;(vZq{K+(JVGmS#_4#lsC~?CrY>}Z=$jalf@x0MKnwkQ38WA1g3~! z#Efw@TCHt>^5TVNys$r)Y9SqHqJRM!;kCnY9;}HPMz$cc5GFW{OnNdLx?BPC zl*om^0?3;Pygd~%u1K4hyoq35)dQq`;TDVr1Y3wEf+@w)BEASIAr*ghj77m{E5#Bl zen0x%@|Kvn(;ITSQRn_x$+ezttX;)uh7?CeunR@h<`O^TOy>8}es{0tzUP1boxj6{ GcfSCcrNp!V literal 0 HcmV?d00001 diff --git a/client/src/thunderstorm.bmp b/client/src/thunderstorm.bmp new file mode 100644 index 0000000000000000000000000000000000000000..ca2420e5897b636af12afd0d4181c26d05d9b8d8 GIT binary patch literal 4938 zcmeH}Jr2S!421(nfQ6lfi9>WjLSo@6tek*TakJvaV66N&cB-@pHKLK@JipKJM0YuF zonH^w@9-Vo-^%TL{<(2(f5gux{MI{%KY!{@*W33_7p--&MYT*|wh8opO^*jGKyjav zPDBc(p>rI>{MfVs4)WMx>~$+BFFJDp5QC$>2P-#bRipJyk}_ZgN0Mm*Udv;sH61l9 zuHoi94!FVG6tW07;