Skip to content

Commit 1db8e13

Browse files
Merge pull request #2510 from FarmBot/staging
v15.22.3
2 parents 0b5b482 + 2c41843 commit 1db8e13

8 files changed

Lines changed: 125 additions & 80 deletions

File tree

Gemfile.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
action_text-trix (2.1.16)
4+
action_text-trix (2.1.17)
55
railties
66
actioncable (8.1.2)
77
actionpack (= 8.1.2)
@@ -115,7 +115,7 @@ GEM
115115
delayed_job_active_record (4.1.11)
116116
activerecord (>= 3.0, < 9.0)
117117
delayed_job (>= 3.0, < 5)
118-
devise (5.0.2)
118+
devise (5.0.3)
119119
bcrypt (~> 3.0)
120120
orm_adapter (~> 0.1)
121121
railties (>= 7.0)
@@ -196,7 +196,7 @@ GEM
196196
prism (>= 1.3.0)
197197
rdoc (>= 4.0.0)
198198
reline (>= 0.4.2)
199-
json (2.19.1)
199+
json (2.19.2)
200200
jsonapi-renderer (0.2.2)
201201
jwt (3.1.2)
202202
base64
@@ -218,7 +218,7 @@ GEM
218218
activesupport (>= 4)
219219
railties (>= 4)
220220
request_store (~> 1.0)
221-
loofah (2.25.0)
221+
loofah (2.25.1)
222222
crass (~> 1.0.2)
223223
nokogiri (>= 1.12.0)
224224
mail (2.9.0)
@@ -360,14 +360,14 @@ GEM
360360
rspec-mocks (3.13.8)
361361
diff-lcs (>= 1.2.0, < 2.0)
362362
rspec-support (~> 3.13.0)
363-
rspec-rails (8.0.3)
363+
rspec-rails (8.0.4)
364364
actionpack (>= 7.2)
365365
activesupport (>= 7.2)
366366
railties (>= 7.2)
367-
rspec-core (~> 3.13)
368-
rspec-expectations (~> 3.13)
369-
rspec-mocks (~> 3.13)
370-
rspec-support (~> 3.13)
367+
rspec-core (>= 3.13.0, < 5.0.0)
368+
rspec-expectations (>= 3.13.0, < 5.0.0)
369+
rspec-mocks (>= 3.13.0, < 5.0.0)
370+
rspec-support (>= 3.13.0, < 5.0.0)
371371
rspec-support (3.13.7)
372372
rspec_junit_formatter (0.6.0)
373373
rspec-core (>= 2, < 4, != 2.12.0)
@@ -409,7 +409,7 @@ GEM
409409
useragent (0.16.11)
410410
warden (1.2.9)
411411
rack (>= 2.0.9)
412-
webmock (3.26.1)
412+
webmock (3.26.2)
413413
addressable (>= 2.8.0)
414414
crack (>= 0.3.2)
415415
hashdiff (>= 0.4.0, < 2.0.0)

bun.lock

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/initializers/mutations.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require Rails.root.join("app/lib/mutations/hstore_filter")
2+
13
MUTATIONS_DEFAULTS = Mutations::DefaultErrorMessageCreator::MESSAGES
24

35
# I don't like the errors that mutations provides for :before and :after,

frontend/three_d_garden/__tests__/fps_probe_test.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from "react";
22
import { render } from "@testing-library/react";
33
import * as threeFiber from "@react-three/fiber";
4-
import { countSceneObjects, FPSProbe } from "../fps_probe";
4+
import { countSceneObjects, FPSProbe, REPORT_EVERY_N } from "../fps_probe";
55

66
describe("FPSProbe", () => {
77
let useFrameSpy: jest.SpyInstance;
88
let useThreeSpy: jest.SpyInstance;
99

1010
beforeEach(() => {
11+
window.logStore = undefined;
1112
useFrameSpy = jest.spyOn(threeFiber, "useFrame")
1213
.mockImplementation(jest.fn());
1314
useThreeSpy = jest.spyOn(threeFiber, "useThree")
@@ -92,6 +93,27 @@ describe("FPSProbe", () => {
9293
nowSpy.mockRestore();
9394
});
9495

96+
it("logs an fps report every nth probe", () => {
97+
let t = 0;
98+
const nowSpy = jest.spyOn(performance, "now").mockImplementation(() => {
99+
t += 2000;
100+
return t;
101+
});
102+
window.logStore = { log: jest.fn() };
103+
render(<FPSProbe />);
104+
const frameHandler = useFrameSpy.mock.calls[0][0] as () => void;
105+
for (let i = 0; i < 100; i++) {
106+
frameHandler();
107+
frameHandler();
108+
}
109+
expect(window.logStore.log).toHaveBeenCalledWith(
110+
"3D Garden FPS",
111+
{ average: 1, best: 1, total: REPORT_EVERY_N, worst: 1 },
112+
"info",
113+
);
114+
nowSpy.mockRestore();
115+
});
116+
95117
it("counts scene objects", () => {
96118
const objects = [
97119
{ isMesh: true, type: "Mesh", name: "soil" },

frontend/three_d_garden/bot/components/bounds.tsx

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import React from "react";
22
import { Config } from "../../config";
3-
import { Line } from "@react-three/drei";
4-
import { Group } from "../../components";
3+
import { Box, Edges } from "@react-three/drei";
4+
import { Group, MeshBasicMaterial } from "../../components";
55
import {
66
threeSpace,
77
zero as zeroFunc,
8-
extents as extentsFunc,
9-
zZero as zZeroFunc,
108
zDir as zDirFunc,
119
} from "../../helpers";
1210
import { DistanceIndicator } from "../../elements";
11+
import { BackSide } from "three";
1312

1413
export interface BoundsProps {
1514
config: Config;
@@ -19,33 +18,33 @@ export const Bounds = (props: BoundsProps) => {
1918
const {
2019
bedLengthOuter, bedWidthOuter, x, y, z,
2120
zAxisLength, columnLength, beamLength, bounds,
22-
bedXOffset, bedYOffset,
21+
bedXOffset, bedYOffset, botSizeX, botSizeY, botSizeZ,
2322
} = props.config;
24-
const zZero = zZeroFunc(props.config);
2523
const zDir = zDirFunc(props.config);
2624
const zero = zeroFunc(props.config);
27-
const extents = extentsFunc(props.config);
28-
const zDip = (x: number, y: number): [number, number, number][] => [
29-
[x, y, extents.z],
30-
[x, y, zero.z],
31-
[x, y, extents.z],
32-
];
3325
return <Group name={"bounds-and-distances"}>
34-
<Line name={"bounds"}
26+
<Box name={"bounds"}
3527
visible={bounds}
36-
color={"white"}
37-
points={[
38-
[zero.x, zero.y, zero.z],
39-
[zero.x, extents.y, zero.z],
40-
[extents.x, extents.y, zero.z],
41-
[extents.x, zero.y, zero.z],
42-
[zero.x, zero.y, zero.z],
43-
...zDip(zero.x, zero.y),
44-
...zDip(zero.x, extents.y),
45-
...zDip(extents.x, extents.y),
46-
...zDip(extents.x, zero.y),
47-
[zero.x, zero.y, extents.z],
48-
]} />
28+
position={[
29+
zero.x + botSizeX / 2,
30+
zero.y + botSizeY / 2,
31+
zero.z - botSizeZ / 2,
32+
]}
33+
args={[
34+
botSizeX,
35+
botSizeY,
36+
botSizeZ,
37+
]}>
38+
<MeshBasicMaterial
39+
side={BackSide}
40+
depthWrite={false}
41+
transparent={true}
42+
opacity={0} />
43+
<Edges
44+
lineWidth={1.1}
45+
color={"white"}
46+
threshold={1} />
47+
</Box>
4948
<Group visible={props.config.zDimension}>
5049
<DistanceIndicator
5150
start={{
@@ -56,7 +55,7 @@ export const Bounds = (props: BoundsProps) => {
5655
end={{
5756
x: threeSpace(0, bedLengthOuter),
5857
y: threeSpace(bedWidthOuter, bedWidthOuter),
59-
z: zZero - z + zAxisLength,
58+
z: zero.z - z + zAxisLength,
6059
}} />
6160
</Group>
6261
<Group visible={props.config.distanceIndicator == "beamLength"}>
@@ -90,12 +89,12 @@ export const Bounds = (props: BoundsProps) => {
9089
start={{
9190
x: threeSpace(x + 100, bedLengthOuter) + bedXOffset,
9291
y: threeSpace(y, bedWidthOuter) + bedYOffset,
93-
z: zZero - zDir * z,
92+
z: zero.z - zDir * z,
9493
}}
9594
end={{
9695
x: threeSpace(x + 100, bedLengthOuter) + bedXOffset,
9796
y: threeSpace(y, bedWidthOuter) + bedYOffset,
98-
z: zZero - zDir * z + zAxisLength,
97+
z: zero.z - zDir * z + zAxisLength,
9998
}} />
10099
</Group>
101100
</Group>;

frontend/three_d_garden/fps_probe.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ const formatTopCounts = (
5555
return entries.map(([key, value]) => `${key}: ${value}`).join(", ");
5656
};
5757

58+
export const REPORT_EVERY_N = 60;
59+
5860
export const FPSProbe = () => {
5961
const frameCount = React.useRef(0);
6062
const lastTime = React.useRef<number | undefined>(undefined);
63+
const reportCount = React.useRef(0);
64+
const samples = React.useRef<number[]>([]);
6165
const { gl, scene } = useThree();
6266

6367
React.useEffect(() => {
@@ -77,6 +81,7 @@ export const FPSProbe = () => {
7781
if (now - lastTime.current >= 1000) {
7882
const elapsed = (now - lastTime.current) / 1000;
7983
const fps = frameCount.current / elapsed;
84+
samples.current.push(fps);
8085
const { calls, triangles, points, lines } = gl.info.render;
8186
const { geometries, textures } = gl.info.memory;
8287
const sceneCounts = countSceneObjects(scene as Scene);
@@ -103,6 +108,18 @@ export const FPSProbe = () => {
103108
.map(([key, value]) => `${key}: ${value}`)
104109
.join("\n");
105110
console.log(linesToLog);
111+
reportCount.current += 1;
112+
const doReport = !(reportCount.current % REPORT_EVERY_N);
113+
const average = Math.round(samples.current
114+
.reduce((sum, sample) => sum + sample, 0) / samples.current.length);
115+
const report = {
116+
best: Math.round(Math.max(...samples.current)),
117+
worst: Math.round(Math.min(...samples.current)),
118+
average,
119+
total: samples.current.length,
120+
};
121+
doReport && window.logStore?.log("3D Garden FPS", report, "info");
122+
console.log(report);
106123
frameCount.current = 0;
107124
lastTime.current = now;
108125
}

lib/tasks/api.rake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,17 @@ namespace :api do
152152
src = "node_modules/monaco-editor/min/vs"
153153
dst = "public/assets/monaco"
154154
lua_src = "node_modules/monaco-editor/esm/vs"
155-
lua = "basic-languages/lua"
156-
sh "mkdir -p public/assets/"
157-
sh "cp -r #{src} #{dst}"
158-
sh "rm -rf #{dst}/*language*"
159-
sh "mkdir #{dst}/basic-languages"
160-
sh "cp -r #{lua_src}/#{lua} #{dst}/#{lua}"
155+
sh "mkdir -p public/assets/monaco"
156+
sh "cp -r #{src}/assets #{dst}"
157+
sh "cp -r #{src}/editor #{dst}"
158+
sh "cp -r #{src}/basic-languages #{dst}"
159+
sh "cp -r #{src}/loader.js #{dst}"
160+
sh "cp -r #{src}/workers-*.js #{dst}"
161+
sh "cp -r #{src}/monaco.contribution-*.js #{dst}"
162+
sh "cp -r #{src}/editor.api-*.js #{dst}"
163+
sh "cp -r #{src}/nls.messages-loader.js #{dst}"
164+
sh "cp -r #{src}/lua-*.js #{dst}"
165+
sh "cp -r #{lua_src}/basic-languages/lua #{dst}/basic-languages"
161166
end
162167

163168
desc "Serve javascript assets (via Bun bundler)."

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"mqtt": "mqtt/dist/mqtt.esm.js"
3636
},
3737
"dependencies": {
38-
"@blueprintjs/core": "6.9.1",
39-
"@blueprintjs/select": "6.1.3",
38+
"@blueprintjs/core": "6.10.0",
39+
"@blueprintjs/select": "6.1.4",
4040
"@monaco-editor/react": "4.7.0",
4141
"@react-spring/three": "10.0.3",
4242
"@react-three/drei": "10.7.7",
@@ -61,7 +61,7 @@
6161
"farmbot": "15.9.3",
6262
"fengari": "0.1.5",
6363
"fengari-web": "0.1.4",
64-
"i18next": "25.8.17",
64+
"i18next": "25.8.18",
6565
"lodash": "4.17.23",
6666
"markdown-it": "14.1.1",
6767
"markdown-it-emoji": "3.0.0",
@@ -80,7 +80,7 @@
8080
"redux": "5.0.1",
8181
"redux-immutable-state-invariant": "2.1.0",
8282
"redux-thunk": "3.1.0",
83-
"rollbar": "3.0.0",
83+
"rollbar": "3.1.0",
8484
"suncalc": "1.9.0",
8585
"takeme": "0.12.0",
8686
"three": "0.183.2",
@@ -89,7 +89,7 @@
8989
},
9090
"devDependencies": {
9191
"@eslint/js": "10.0.1",
92-
"@happy-dom/global-registrator": "20.8.3",
92+
"@happy-dom/global-registrator": "20.8.4",
9393
"@react-three/eslint-plugin": "0.1.2",
9494
"@testing-library/dom": "10.4.1",
9595
"@testing-library/jest-dom": "6.9.1",
@@ -99,9 +99,9 @@
9999
"@types/jest": "30.0.0",
100100
"@types/readable-stream": "4.0.23",
101101
"@types/suncalc": "1.9.2",
102-
"@typescript-eslint/eslint-plugin": "8.57.0",
103-
"@typescript-eslint/parser": "8.57.0",
104-
"happy-dom": "20.8.3",
102+
"@typescript-eslint/eslint-plugin": "8.57.1",
103+
"@typescript-eslint/parser": "8.57.1",
104+
"happy-dom": "20.8.4",
105105
"eslint": "10.0.3",
106106
"eslint-plugin-eslint-comments": "3.2.0",
107107
"eslint-plugin-import": "2.32.0",

0 commit comments

Comments
 (0)