Skip to content

Commit

Permalink
feat: add support for new 91x chips
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Oct 9, 2023
1 parent d51a588 commit b6777d0
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 10 deletions.
8 changes: 7 additions & 1 deletion src/Tracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DKIcon } from './icons/DKIcon.js'
import { SIMIcon } from './icons/SIMIcon.js'
import { SoftSIMIcon } from './icons/SoftSIMIcon.js'
import { ThingyIcon } from './icons/ThingyIcon.js'
import { ThingyXIcon } from './icons/ThingyXIcon.js'
import { sortLocations } from './sortLocations.js'
import { FuelGauge } from './FuelGauge.js'

Expand Down Expand Up @@ -58,7 +59,12 @@ export const Tracker = ({ device }: { device: Device }) => {

const lastUpdateTime = lastUpdateTs(device.id) as number

const BoardIcon = brdV === 'nrf9160dk_nrf9160' ? DKIcon : ThingyIcon
const BoardIcon =
brdV?.includes('nrf9160dk') ?? false
? DKIcon
: brdV?.includes('thingy91x') ?? false
? ThingyXIcon
: ThingyIcon

return (
<>
Expand Down
28 changes: 23 additions & 5 deletions src/UpdateWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ export const UpdateWarning = ({ reported }: { reported: Reported }) => {
let needsMfwUpdate = false
let needsFwUpdate = false

const is91x = dev.brdV.includes('9161') || dev.brdV.includes('9131')

try {
needsMfwUpdate = compareVersions(MODEM_FIRMWARE_RELEASE, mfw) === 1
needsMfwUpdate =
compareVersions(
is91x ? MODEM_FIRMWARE_RELEASE_91x : MODEM_FIRMWARE_RELEASE_9160,
mfw,
) === 1
} catch {
// pass
}
Expand Down Expand Up @@ -61,15 +67,27 @@ export const UpdateWarning = ({ reported }: { reported: Reported }) => {
</a>
</abbr>
)}
{needsMfwUpdate && (
{needsMfwUpdate && !is91x && (
<abbr
title={`Modem firmware update available, device is running ${dev.modV}, release version is ${MODEM_FIRMWARE_RELEASE_9160}`}
>
<a
href="https://www.nordicsemi.com/Products/nRF9160/Download?lang=en#infotabs"
target="_blank"
>
MFW update available ({MODEM_FIRMWARE_RELEASE_9160})
</a>
</abbr>
)}
{needsMfwUpdate && !is91x && (
<abbr
title={`Modem firmware update available, device is running ${dev.modV}, release version is ${MODEM_FIRMWARE_RELEASE}`}
title={`Modem firmware update available, device is running ${dev.modV}, release version is ${MODEM_FIRMWARE_RELEASE_91x}`}
>
<a
href="https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF9160-DK/Download#infotabs"
href="https://www.nordicsemi.com/Products/nRF9161/Download?lang=en#infotabs"
target="_blank"
>
MFW update available ({MODEM_FIRMWARE_RELEASE})
MFW update available ({MODEM_FIRMWARE_RELEASE_91x})
</a>
</abbr>
)}
Expand Down
18 changes: 18 additions & 0 deletions src/icons/ThingyXIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export const ThingyXIcon = ({ ...props }) => (
<svg
width="59.000015mm"
height="59.07753mm"
viewBox="0 0 59.000015 59.07753"
version="1.1"
id="svg5"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
id="path831"
style="fill:#f48120;fill-opacity:1;stroke-width:3.20302"
d="M 5.9238281,0 C 2.65668,0 0,2.65668 0,5.9238281 V 217.35547 c 0,3.26717 2.65668,5.92969 5.9238281,5.92969 H 217.06836 c 3.26717,0 5.92383,-2.66252 5.92383,-5.92969 V 5.9238281 C 222.99219,2.65668 220.33553,0 217.06836,0 Z M 28.345703,18.898438 c 5.217988,-2.21e-4 9.448361,4.229277 9.449219,9.447265 2.21e-4,5.218751 -4.230468,9.44944 -9.449219,9.449219 -5.217988,-8.58e-4 -9.447486,-4.231231 -9.447265,-9.449219 8.56e-4,-5.217225 4.23004,-9.446409 9.447265,-9.447265 z M 111.49609,81.40625 a 30.23622,30.23622 0 0 1 30.23633,30.23633 30.23622,30.23622 0 0 1 -30.23633,30.23633 30.23622,30.23622 0 0 1 -30.236324,-30.23633 30.23622,30.23622 0 0 1 30.236324,-30.23633 z m 0,3.779297 a 26.456693,26.456693 0 0 0 -26.457028,26.457033 26.456693,26.456693 0 0 0 26.457028,26.45703 26.456693,26.456693 0 0 0 26.45703,-26.45703 26.456693,26.456693 0 0 0 -26.45703,-26.457033 z m 88.55079,56.425783 h 0.0469 c 2.58117,0 4,1.96546 4,4.75976 0,1.96549 -0.65952,3.95494 -2.05664,5.49414 l -2.01758,-1.68359 c 0.9709,-1.16034 1.5625,-2.38923 1.5625,-3.85742 0,-1.16034 -0.47071,-1.87305 -1.22851,-1.87305 h -0.0254 c -0.73408,0 -1.08596,0.45245 -1.65429,2.60742 -0.66303,2.60484 -1.3739,4.28321 -3.95508,4.28321 h -0.0273 c -2.34437,0 -3.9043,-1.89493 -3.9043,-4.52344 0,-1.89446 0.59085,-3.50226 1.63281,-4.80469 l 2.15625,1.4668 c -0.80514,1.13666 -1.28125,2.27202 -1.28125,3.36133 0,1.0893 0.49737,1.66015 1.13672,1.66015 h 0.0234 c 0.8525,0 1.1387,-0.54329 1.70703,-2.79297 0.68676,-2.62851 1.63512,-4.09765 3.88477,-4.09765 z m -10.87305,0.21289 v 15.10937 l -7.95508,7.03125 v -15.10546 z m -37.91211,0.0918 h 0.0234 5.85156 c 1.63393,0 2.88993,0.45221 3.71875,1.30468 0.71037,0.71037 1.08594,1.72784 1.08594,2.93555 v 0.0234 c 0,2.06023 -1.10823,3.36282 -2.74219,3.97851 l 3.12109,4.57032 h -3.28711 l -2.74804,-4.09375 h -2.20118 v 4.09375 h -2.82226 z m 13.23828,0 h 9.73438 v 2.55859 h -6.91407 v 2.72266 h 6.10938 v 2.55859 h -6.10938 v 4.94922 H 164.5 Z m -10.39258,2.53515 v 3.67188 h 2.83985 c 1.37346,0 2.15429,-0.73324 2.15429,-1.79883 v -0.0469 c 0,-1.2077 -0.8277,-1.82617 -2.20117,-1.82617 z m -8.88086,0.3086 c 2.10757,0 3.33985,1.39683 3.33985,3.64648 v 6.34961 h -2.77149 v -5.47266 c 0,-1.3261 -0.61799,-1.98828 -1.68359,-1.98828 -1.06565,0 -1.72852,0.68588 -1.72852,1.98828 v 5.47266 h -2.77148 v -9.82813 h 2.74805 v 1.39649 c 0.63938,-0.82877 1.47003,-1.56445 2.86718,-1.56445 z m 56.1211,8.09961 h 2.51172 v 9.77734 h -12.83594 v -9.68555 h 2.51172 v 6.86914 h 2.60351 v -6.03515 h 2.50781 v 6.03515 h 2.70118 z m -64.74219,4.09765 h 13.38086 c 0,1.77607 0.0449,3.66956 0.0449,6.17969 0,4.7361 3.24402,6.0625 5.91992,6.0625 2.65222,0 6.04102,-1.3264 6.04102,-6.0625 v -6.17969 h 13.54297 c 0.28416,1.20773 0.4973,2.48395 0.56836,3.85742 0.28416,5.32812 -1.22939,9.75917 -4.18946,17.05274 l -10.67968,26.49804 h -15.06055 l 10.1582,-24.03711 c -1.18402,0.52097 -1.92194,0.58911 -2.86914,0.66016 -7.48304,0.521 -16.50128,-5.23276 -17.33008,-17.38086 -0.16576,-2.41541 -9.5e-4,-4.63752 0.47266,-6.65039 z m 54.41797,8.26563 h 12.83594 v 2.8164 h -12.83594 z m 12.83594,4.47265 -0.002,3.29297 -4.09765,2.7461 v 2.20312 h 4.09765 v 2.81641 H 191.0234 v -5.84766 c 0,-1.63393 0.47003,-2.88774 1.29883,-3.74023 0.71046,-0.71045 1.72977,-1.0918 2.9375,-1.0918 h 0.0234 c 2.0602,0 3.36674,1.11216 3.98242,2.74609 z m -8.45508,3.2461 c -1.20771,0 -1.82227,0.85116 -1.82227,2.22461 v 2.77148 h 3.69141 v -2.83984 c 0,-1.37347 -0.73299,-2.15625 -1.82227,-2.15625 z m 5.94336,9.70898 h 2.51172 v 9.77734 h -12.83594 v -9.68554 h 2.51172 v 6.86719 h 2.60351 v -6.0625 h 2.50781 v 6.0625 h 2.70118 z m -1.35157,11.60352 h 0.0508 c 2.55748,0 3.97851,1.94227 3.97851,4.71289 0.0233,1.91812 -0.66554,3.88069 -2.03906,5.41992 l -1.99024,-1.6543 c 0.9472,-1.16034 1.56446,-2.37165 1.56446,-3.83984 0,-1.16035 -0.44928,-1.8457 -1.20703,-1.8457 h -0.0469 c -0.71037,0 -1.08816,0.45078 -1.63281,2.58203 -0.66303,2.58117 -1.37415,4.26367 -3.93164,4.26367 h -0.0547 c -2.32069,0 -3.8574,-1.87147 -3.85742,-4.5 0,-1.87076 0.59087,-3.45734 1.63281,-4.75977 l 2.13672,1.4668 c -0.78143,1.13666 -1.25781,2.25054 -1.25781,3.33984 0,1.0893 0.49365,1.6543 1.10937,1.6543 h 0.0274 c 0.85249,0 1.11528,-0.54354 1.68359,-2.76953 0.68676,-2.60488 1.60799,-4.07029 3.83398,-4.07031 z"
transform="scale(0.26458333)"
/>
</svg>
)
10 changes: 8 additions & 2 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ declare const SENTRY_DSN: string | undefined
*/
declare const FIRMWARE_RELEASE: string
/**
* Version of the Modem firmware that is considered to be the latest release
* Version of the Modem firmware that is considered to be the latest release for 9160
*
* @example '1.3.3'
*/
declare const MODEM_FIRMWARE_RELEASE: string
declare const MODEM_FIRMWARE_RELEASE_9160: string
/**
* Version of the Modem firmware that is considered to be the latest release for 9161, 9131
*
* @example '2.0.0'
*/
declare const MODEM_FIRMWARE_RELEASE_91x: string

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface ImportMeta {
Expand Down
8 changes: 6 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ if (sentryDSN === undefined) {
console.debug(chalk.yellow(`Sentry DSN`), chalk.blue(sentryDSN))
}
const firmwareRelease = process.env.FIRMWARE_RELEASE ?? '1.10.0'
const modemFirmwareRelease = process.env.MODEM_FIRMWARE_RELEASE ?? '1.3.5'
const modemFirmwareRelease9160 =
process.env.MODEM_FIRMWARE_RELEASE_9160 ?? '1.3.5'
const modemFirmwareRelease91x =
process.env.MODEM_FIRMWARE_RELEASE_91x ?? '2.0.0'

const replaceInIndex = (data: Record<string, string>) => ({
name: 'replace-in-index',
Expand Down Expand Up @@ -90,6 +93,7 @@ export default defineConfig({
SENTRY_DSN: JSON.stringify(sentryDSN),
BUILD_TIME: JSON.stringify(new Date().toISOString()),
FIRMWARE_RELEASE: JSON.stringify(firmwareRelease),
MODEM_FIRMWARE_RELEASE: JSON.stringify(modemFirmwareRelease),
MODEM_FIRMWARE_RELEASE_9160: JSON.stringify(modemFirmwareRelease9160),
MODEM_FIRMWARE_RELEASE_91x: JSON.stringify(modemFirmwareRelease91x),
},
})

0 comments on commit b6777d0

Please sign in to comment.