This commit is contained in:
peli 2021-02-25 10:17:03 -08:00
Родитель e0cb53b9c6
Коммит 99b92fe532
5 изменённых файлов: 19 добавлений и 10 удалений

Просмотреть файл

@ -1,4 +1,4 @@
import React, { useContext } from "react"
import React, { CSSProperties, useContext } from "react"
import clsx from 'clsx';
import { makeStyles, Container, Hidden, Box, useMediaQuery } from '@material-ui/core';
// tslint:disable-next-line: no-submodule-imports
@ -46,6 +46,15 @@ export const MOBILE_TOOLS_DRAWER_WIDTH = 18;
export const MOBILE_BREAKPOINT = "sm"
export const MEDIUM_BREAKPOINT = "md"
function useJacdacBackgroundImage(): CSSProperties {
const theme = useTheme();
const background = `<svg viewBox='0 0 24 24' xmlns="http://www.w3.org/2000/svg' fill-rule='evenodd' clip-rule='evenodd' stroke-linejoin='round' stroke-miterlimit='2'><path fill='${theme.palette.background.paper}' d='M14.535 2.731c0-.841-.83-1.524-1.85-1.524h-1.152c-1.022 0-1.85.683-1.85 1.524V21.27c0 .841.828 1.524 1.85 1.524h1.152c1.02 0 1.85-.683 1.85-1.524V2.73zM20.648 4.9c0-.841-.829-1.524-1.85-1.524h-1.152c-1.021 0-1.85.683-1.85 1.524v16.369c0 .841.829 1.524 1.85 1.524h1.152c1.021 0 1.85-.683 1.85-1.524V4.899zM8.205 2.73c0-.841-.83-1.524-1.85-1.524H5.201c-1.02 0-1.85.683-1.85 1.524V21.27c0 .841.83 1.524 1.85 1.524h1.152c1.022 0 1.85-.683 1.85-1.524V2.73zM5.779 18.958a1.501 1.501 0 11-.002 3.003 1.501 1.501 0 01.002-3.003zm6.33 0a1.501 1.501 0 11-.001 3.003 1.501 1.501 0 010-3.003zm6.113 0a1.501 1.501 0 11-.002 3.003 1.501 1.501 0 01.002-3.003z' /></svg>`;
return {
background: `url("data:image/svg+xml;charset=UTF-8,${background}")`,
backgroundSize: "cover"
}
}
const useStyles = makeStyles((theme) => createStyles({
root: {
display: 'flex',
@ -273,6 +282,8 @@ function LayoutWithContext(props: LayoutProps) {
const { hideMainMenu = false, hideUnderConstruction = false } = frontmatter || {};
const classes = useStyles();
const backgroundCss = useJacdacBackgroundImage();
const { darkMode } = useContext(DarkModeContext)
const { drawerType, toolsMenu } = useContext(AppContext)
useFirmwareBlobs();
@ -299,7 +310,7 @@ function LayoutWithContext(props: LayoutProps) {
</>
return (
<div className={clsx(darkMode, classes.root)}>
<div className={clsx(darkMode, classes.root)} style={backgroundCss}>
<header>
<SEO />
</header>

@ -1 +1 @@
Subproject commit 654beb80a1056cdf89d1367e53bb228df50ea70a
Subproject commit ec18b3e91202f31c6a5165fe3acb11ce2eaad71b

@ -1 +1 @@
Subproject commit 747d08263687cd5ab091656e1726aa9478e8598c
Subproject commit 3e28295a7d9ce4fe1b45be13a32acf2d5a3e04d1

Просмотреть файл

@ -3,7 +3,7 @@ import {
ArcadeGamepadButton,
CharacterScreenTextDirection,
CharacterScreenVariant,
DistanceVariant, LedPixelVariant, PotentiometerVariant, RelayReg, RelayVariant, ServoVariant,
DistanceVariant, LedPixelVariant, PotentiometerVariant, RelayReg, RelayVariant,
SRV_ACCELEROMETER, SRV_ARCADE_GAMEPAD, SRV_BAROMETER, SRV_BUTTON, SRV_BUZZER, SRV_CHARACTER_SCREEN,
SRV_DISTANCE, SRV_E_CO2, SRV_HUMIDITY, SRV_LED_PIXEL, SRV_MATRIX_KEYPAD,
SRV_MOTOR, SRV_POTENTIOMETER,
@ -92,19 +92,16 @@ export const SG90_RESPONSE_SPEED = 0.12; // deg/60deg
const microServoOptions = {
stallTorque: SG90_STALL_TORQUE, // kg/cm
responseSpeed: SG90_RESPONSE_SPEED, // s/60deg
variant: ServoVariant.PositionalRotation
}
const microServo270Options = {
stallTorque: SG90_STALL_TORQUE, // kg/cm
responseSpeed: SG90_RESPONSE_SPEED, // s/60deg
variant: ServoVariant.PositionalRotation,
minAngle: -135,
maxAngle: 135
}
const microServo360Options = {
stallTorque: SG90_STALL_TORQUE, // kg/cm
responseSpeed: SG90_RESPONSE_SPEED * 2, // s/60deg
variant: ServoVariant.PositionalRotation,
minAngle: -180,
maxAngle: 180
}

Просмотреть файл

@ -1,3 +1,4 @@
import Flags from "./flags";
import { Proto, Transport } from "./hf2";
import {
delay, PromiseQueue, write32, write16, read32, uint8ArrayToString, fromHex, bufferConcat, fromUTF8
@ -130,8 +131,8 @@ export class CMSISProto implements Proto {
let currSend: SendItem
for (; ;) {
const now = Date.now()
if (this.lastXchg && now - this.lastXchg > 50) {
console.error("slow xchg: " + (now - this.lastXchg) + "ms")
if (Flags.diagnostics && this.lastXchg && now - this.lastXchg > 50) {
console.warn("slow xchg: " + (now - this.lastXchg) + "ms")
}
this.lastXchg = now