Class FirmwareRelease

java.lang.Object
org.emrick.project.dev.FirmwareRelease

public class FirmwareRelease extends Object
The Heltec Receiver firmware published from the firmware repo's main branch to the Emrick Flash site (the same files the web flasher uses). Releases are downloaded into the user's Emrick Designer folder (firmware/receiver/<commit>/) so a previously downloaded version can still be flashed without internet.
  • Field Details

    • MANIFEST_URL

      public static final String MANIFEST_URL
      See Also:
    • GSON

      private static final com.google.gson.Gson GSON
    • HTTP

      private static final HttpClient HTTP
    • latestKnown

      private static FirmwareRelease latestKnown
    • lastProblem

      private static String lastProblem
    • manifest

      private final FirmwareRelease.Manifest manifest
    • directory

      private final File directory
    • fromCacheOnly

      private final boolean fromCacheOnly
  • Constructor Details

  • Method Details

    • commit

      public String commit()
    • date

      public String date()
    • version

      public String version()
      Returns:
      e.g. "abc1234 (10-03-2026)"
    • isFromCacheOnly

      public boolean isFromCacheOnly()
      Returns:
      true when the latest release couldn't be checked and this is the newest downloaded one
    • parts

      public List<FirmwareRelease.Part> parts()
    • file

      public File file(FirmwareRelease.Part part)
    • latestKnown

      public static FirmwareRelease latestKnown()
      Returns:
      the most recent release found by fetchLatest() this session (or the newest cached one)
    • cacheRoot

      private static File cacheRoot()
    • fetchLatest

      public static FirmwareRelease fetchLatest() throws IOException
      Checks the flash site for the latest release and downloads it if it isn't cached yet. If the site can't be reached, falls back to the newest release downloaded before.
      Returns:
      the release to flash
      Throws:
      IOException - if the site can't be reached and nothing was ever downloaded
    • lastProblem

      public static String lastProblem()
      Returns:
      why the last check for the latest firmware failed, in plain words, or null if it succeeded
    • describe

      private static String describe(Exception cause)
    • cachedFallback

      private static FirmwareRelease cachedFallback(Exception cause) throws IOException
      Throws:
      IOException
    • newestCached

      private static FirmwareRelease newestCached()
      Returns:
      the cached release with the newest date, or null if nothing complete is cached
    • validate

      private static void validate(FirmwareRelease.Manifest m)
    • isComplete

      private static boolean isComplete(File dir, FirmwareRelease.Manifest m)
    • download

      private static void download(FirmwareRelease.Manifest manifest, File dir) throws IOException
      Downloads every part into a temporary folder, verifies checksums, then moves it into place.
      Throws:
      IOException
    • downloadFile

      static void downloadFile(String url, File dest) throws IOException
      Throws:
      IOException
    • sha256

      static String sha256(File file) throws IOException
      Throws:
      IOException
    • deleteRecursively

      static void deleteRecursively(File f)