Compare commits
	
		
			2 Commits
		
	
	
		
			16f7d80677
			...
			fad4da3f6b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fad4da3f6b | |||
| 76cca9c1c0 | 
							
								
								
									
										
											BIN
										
									
								
								client/animations/tiny_train.gif
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								client/animations/tiny_train.gif
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 4.0 KiB | 
| @ -81,3 +81,17 @@ static const uint8_t PROGMEM spinny[][8] = { | |||||||
|     0x00, |     0x00, | ||||||
|   }, |   }, | ||||||
| }; | }; | ||||||
|  | static const uint16_t PROGMEM tiny_train_dims[] = {24, 9, 1}; | ||||||
|  | static const uint8_t PROGMEM tiny_train[][27] = { | ||||||
|  |   { | ||||||
|  |     0x00, 0x04, 0x00, | ||||||
|  |     0x00, 0x02, 0x00, | ||||||
|  |     0x01, 0xff, 0xfe, | ||||||
|  |     0x00, 0xa4, 0x94, | ||||||
|  |     0x01, 0x24, 0x92, | ||||||
|  |     0x01, 0x24, 0x92, | ||||||
|  |     0x03, 0xfc, 0xff, | ||||||
|  |     0x03, 0xff, 0xff, | ||||||
|  |     0x01, 0xb0, 0x36, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | |||||||
| @ -102,20 +102,17 @@ void setup() { | |||||||
|    |    | ||||||
|   pinMode(BUTTON_PIN, INPUT_PULLUP); |   pinMode(BUTTON_PIN, INPUT_PULLUP); | ||||||
|   attachInterrupt(BUTTON_PIN, onButtonFalling, FALLING); |   attachInterrupt(BUTTON_PIN, onButtonFalling, FALLING); | ||||||
|   /*
 |  | ||||||
|   display.print(" 5 Mannheim    sofort\n" |  | ||||||
|                 "26 Kirchheim    9 min\n" |  | ||||||
|                 " 5 Weinheim     20:13"); |  | ||||||
|   */ |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | #define QUERY_STRING "stop_id=de:08221:1225&platform=A" | ||||||
|  | 
 | ||||||
| // TODO: Error handling
 | // TODO: Error handling
 | ||||||
| String fetchDepartures() { | String fetchDepartures() { | ||||||
|   std::unique_ptr<BearSSL::WiFiClientSecure> https(new BearSSL::WiFiClientSecure); |   std::unique_ptr<BearSSL::WiFiClientSecure> https(new BearSSL::WiFiClientSecure); | ||||||
|   https->setInsecure(); |   https->setInsecure(); | ||||||
|    |    | ||||||
|   HTTPClient client; |   HTTPClient client; | ||||||
|   if (!client.begin(*https, "vrnp.beany.club", 443, "/departures?stop_id=de:08221:1225&platform=A")) { |   if (!client.begin(*https, "vrnp.beany.club", 443, "/departures?" QUERY_STRING)) { | ||||||
|     display.fillScreen(COLOR_BG); |     display.fillScreen(COLOR_BG); | ||||||
|     display.setCursor(0, 0); |     display.setCursor(0, 0); | ||||||
|     display.print("begin failed"); |     display.print("begin failed"); | ||||||
|  | |||||||
| @ -43,3 +43,4 @@ def generate_bitmap_from_gif(file: Path, fd): | |||||||
| 
 | 
 | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|     generate_bitmap_from_gif(Path("./animations/spinny.gif"), sys.stdout) |     generate_bitmap_from_gif(Path("./animations/spinny.gif"), sys.stdout) | ||||||
|  |     generate_bitmap_from_gif(Path("./animations/tiny_train.gif"), sys.stdout) | ||||||
|  | |||||||
							
								
								
									
										34
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										34
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @ -1,5 +1,23 @@ | |||||||
| { | { | ||||||
|   "nodes": { |   "nodes": { | ||||||
|  |     "flake-utils": { | ||||||
|  |       "inputs": { | ||||||
|  |         "systems": "systems" | ||||||
|  |       }, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1731533236, | ||||||
|  |         "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "numtide", | ||||||
|  |         "repo": "flake-utils", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|     "gitignore": { |     "gitignore": { | ||||||
|       "inputs": { |       "inputs": { | ||||||
|         "nixpkgs": [ |         "nixpkgs": [ | ||||||
| @ -38,9 +56,25 @@ | |||||||
|     }, |     }, | ||||||
|     "root": { |     "root": { | ||||||
|       "inputs": { |       "inputs": { | ||||||
|  |         "flake-utils": "flake-utils", | ||||||
|         "gitignore": "gitignore", |         "gitignore": "gitignore", | ||||||
|         "nixpkgs": "nixpkgs" |         "nixpkgs": "nixpkgs" | ||||||
|       } |       } | ||||||
|  |     }, | ||||||
|  |     "systems": { | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1681028828, | ||||||
|  |         "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", | ||||||
|  |         "owner": "nix-systems", | ||||||
|  |         "repo": "default", | ||||||
|  |         "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "nix-systems", | ||||||
|  |         "repo": "default", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "root": "root", |   "root": "root", | ||||||
|  | |||||||
							
								
								
									
										87
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										87
									
								
								flake.nix
									
									
									
									
									
								
							| @ -3,57 +3,58 @@ | |||||||
| 
 | 
 | ||||||
|   inputs = { |   inputs = { | ||||||
|     nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; |     nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||||||
|  |     flake-utils.url = "github:numtide/flake-utils"; | ||||||
|     gitignore = { |     gitignore = { | ||||||
|       url = "github:hercules-ci/gitignore.nix"; |       url = "github:hercules-ci/gitignore.nix"; | ||||||
|       inputs.nixpkgs.follows = "nixpkgs"; |       inputs.nixpkgs.follows = "nixpkgs"; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   outputs = { self, nixpkgs, gitignore }: |   outputs = { self, nixpkgs, flake-utils, gitignore }: flake-utils.lib.eachDefaultSystem (system: | ||||||
|   let |     let | ||||||
|     system = "x86_64-linux"; |       pkgs = import nixpkgs { inherit system; }; | ||||||
|     pkgs = nixpkgs.legacyPackages.${system}; |  | ||||||
| 
 | 
 | ||||||
|     vrnp-static = pkgs.buildGoModule { |       vrnp-static = pkgs.buildGoModule { | ||||||
|       pname = "vrnp"; |         pname = "vrnp"; | ||||||
|       version = "0.0.5"; |         version = "0.0.5"; | ||||||
|       vendorHash = null; |         vendorHash = null; | ||||||
| 
 | 
 | ||||||
|       # For building the package, we use only the files not ignored by Git as inputs. |         # For building the package, we use only the files not ignored by Git as inputs. | ||||||
|       # Also, flake.nix and flake.lock are not included to avoid annoying rebuilds when |         # Also, flake.nix and flake.lock are not included to avoid annoying rebuilds when | ||||||
|       # working on them. |         # working on them. | ||||||
|       src = pkgs.lib.cleanSourceWith { |         src = pkgs.lib.cleanSourceWith { | ||||||
|         src = gitignore.lib.gitignoreSource ./.; |           src = gitignore.lib.gitignoreSource ./.; | ||||||
|         filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock"; |           filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock"; | ||||||
|       }; |  | ||||||
| 
 |  | ||||||
|       # Avoid linking against libc |  | ||||||
|       CGO_ENABLED = 0; |  | ||||||
|     }; |  | ||||||
|   in { |  | ||||||
|     devShell.${system} = pkgs.mkShellNoCC { |  | ||||||
|       packages = [ |  | ||||||
|         pkgs.go |  | ||||||
|         (pkgs.python3.withPackages (ps: with ps; [ pillow ])) |  | ||||||
|       ]; |  | ||||||
|     }; |  | ||||||
|     packages.${system} = { |  | ||||||
|       default = vrnp-static; |  | ||||||
|       image-meta = pkgs.runCommand "vrnp-version" {} '' |  | ||||||
|         mkdir -p $out |  | ||||||
|         echo -n ${vrnp-static.version} > $out/version |  | ||||||
|         echo -n git.pbrinkmeier.de/paul/vrnp:${vrnp-static.version} > $out/name |  | ||||||
|       ''; |  | ||||||
|       image = pkgs.dockerTools.buildImage { |  | ||||||
|         name = "git.pbrinkmeier.de/paul/vrnp"; |  | ||||||
|         tag = vrnp-static.version; |  | ||||||
|         copyToRoot = pkgs.buildEnv { |  | ||||||
|           name = "vrnp-root"; |  | ||||||
|           paths = [ vrnp-static pkgs.cacert ]; |  | ||||||
|           pathsToLink = [ "/bin" "/etc" ]; |  | ||||||
|         }; |         }; | ||||||
|         config.Cmd = [ "${vrnp-static}/bin/vrnp" ]; | 
 | ||||||
|  |         # Avoid linking against libc | ||||||
|  |         CGO_ENABLED = 0; | ||||||
|       }; |       }; | ||||||
|     }; |     in { | ||||||
|   }; |       devShell = pkgs.mkShell { | ||||||
|  |         packages = [ | ||||||
|  |           pkgs.go | ||||||
|  |           (pkgs.python3.withPackages (ps: with ps; [ pillow ])) | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |       packages = { | ||||||
|  |         default = vrnp-static; | ||||||
|  |         image-meta = pkgs.runCommand "image-meta" {} '' | ||||||
|  |           mkdir -p $out | ||||||
|  |           echo -n ${vrnp-static.version} > $out/version | ||||||
|  |           echo -n git.pbrinkmeier.de/paul/vrnp:${vrnp-static.version} > $out/name | ||||||
|  |         ''; | ||||||
|  |         image = pkgs.dockerTools.buildImage { | ||||||
|  |           name = "git.pbrinkmeier.de/paul/vrnp"; | ||||||
|  |           tag = vrnp-static.version; | ||||||
|  |           copyToRoot = pkgs.buildEnv { | ||||||
|  |             name = "vrnp-root"; | ||||||
|  |             paths = [ vrnp-static pkgs.cacert ]; | ||||||
|  |             pathsToLink = [ "/bin" "/etc" ]; | ||||||
|  |           }; | ||||||
|  |           config.Cmd = [ "${vrnp-static}/bin/vrnp" ]; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     } | ||||||
|  |   ); | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user