Skip to content

Commit 0897f17

Browse files
move soil height default from seeder to db
1 parent 0b37fbe commit 0897f17

File tree

8 files changed

+12
-37
lines changed

8 files changed

+12
-37
lines changed

app/mutations/devices/seeders/abstract_seeder.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class AbstractSeeder
3333
:settings_default_map_size_y,
3434
:settings_device_name,
3535
:settings_change_firmware_config_defaults,
36-
:settings_soil_height,
3736
:settings_firmware,
3837
:settings_gantry_height,
3938
:settings_hide_sensors,
@@ -86,9 +85,7 @@ def initialize(device)
8685
@device = device
8786
end
8887

89-
def settings_hide_sensors
90-
device.web_app_config.update!(hide_sensors: false)
91-
end
88+
def settings_hide_sensors; end
9289

9390
def peripherals_lighting
9491
add_peripheral(7, ToolNames::LIGHTING)
@@ -209,11 +206,6 @@ def settings_default_map_size_x; end
209206
def settings_default_map_size_y; end
210207
def settings_device_name; end
211208
def settings_change_firmware_config_defaults; end
212-
def settings_soil_height; end
213-
214-
def settings_soil_height
215-
device.fbos_config.update!(soil_height: -500)
216-
end
217209

218210
def settings_three_d; end
219211

app/mutations/devices/seeders/none.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def sequences_grid; end
3535
def sequences_dispense_water; end
3636
def settings_default_map_size_x; end
3737
def settings_default_map_size_y; end
38-
def settings_soil_height; end
3938
def settings_gantry_height; end
4039
def settings_firmware; end
4140
def settings_hide_sensors; end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class ChangeSoilHeightDefault < ActiveRecord::Migration[6.1]
2+
def change
3+
change_column_default(:fbos_configs, :soil_height, from: 0, to: -500)
4+
end
5+
end

db/structure.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ CREATE TABLE public.fbos_configs (
576576
update_channel character varying(7) DEFAULT 'stable'::character varying,
577577
boot_sequence_id integer,
578578
safe_height integer DEFAULT 0,
579-
soil_height integer DEFAULT 0,
579+
soil_height integer DEFAULT '-500'::integer,
580580
gantry_height integer DEFAULT 0,
581581
default_axis_order character varying(10) DEFAULT 'xy,z;high'::character varying
582582
);
@@ -3987,6 +3987,7 @@ INSERT INTO "schema_migrations" (version) VALUES
39873987
('20250502201109'),
39883988
('20250514203443'),
39893989
('20250722234106'),
3990-
('20250802174543');
3990+
('20250802174543'),
3991+
('20250925195004');
39913992

39923993

frontend/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export namespace ToolTips {
174174
soil height measurements, run a sequence with the MEASURE SOIL HEIGHT
175175
command in a grid over your garden. Alternatively, use a ruler to
176176
manually measure the height at various locations in the garden and add
177-
corresponding soil height points from the points panel. (default: 0)`);
177+
corresponding soil height points from the points panel. (default: -500)`);
178178

179179
export const DEFAULT_AXIS_ORDER =
180180
trim(`Default axis order for movement. (default: X and Y together)`);

frontend/settings/fbos_settings/__tests__/default_values_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { getModifiedClassName } from "../default_values";
1818

1919
describe("getModifiedClassName()", () => {
2020
it("returns class name", () => {
21-
expect(getModifiedClassName("soil_height", 0, "arduino")).toEqual("");
21+
expect(getModifiedClassName("soil_height", -500, "arduino")).toEqual("");
2222
expect(getModifiedClassName("soil_height", 1, "arduino")).toEqual("modified");
2323
});
2424
});

frontend/settings/fbos_settings/default_values.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const DEFAULT_FBOS_CONFIG_VALUES: Record<Key, Value> = {
2929
update_channel: "stable",
3030
boot_sequence_id: undefined,
3131
safe_height: 0,
32-
soil_height: 0,
32+
soil_height: -500,
3333
gantry_height: 120,
3434
default_axis_order: "xy,z;high",
3535
};

spec/controllers/api/devices/devices_controller_seed_spec.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ def settings_change_firmware_config_defaults?(device)
7171
return c.movement_motor_current_x == 1646
7272
end
7373

74-
def settings_soil_height?(device)
75-
device.fbos_config.soil_height
76-
end
77-
7874
def settings_gantry_height?(device)
7975
device.fbos_config.gantry_height
8076
end
@@ -341,7 +337,6 @@ def check_slot_pairing(slot, expected_name)
341337
expect(sensors_tool_verification?(device)).to be_kind_of(Sensor)
342338
expect(settings_device_name?(device)).to eq(Names::GENESIS)
343339
expect(settings_change_firmware_config_defaults?(device)).to be(true)
344-
expect(settings_soil_height?(device)).to eq(-500)
345340
expect(settings_gantry_height?(device)).to eq(120)
346341
expect(settings_firmware?(device)).to eq("arduino")
347342
expect(settings_hide_sensors?(device)).to be(false)
@@ -418,7 +413,6 @@ def check_slot_pairing(slot, expected_name)
418413
expect(sensors_tool_verification?(device).pin).to eq(63)
419414
expect(settings_device_name?(device)).to eq(Names::GENESIS)
420415
expect(settings_change_firmware_config_defaults?(device)).to be(true)
421-
expect(settings_soil_height?(device)).to eq(-500)
422416
expect(settings_gantry_height?(device)).to eq(120)
423417
expect(settings_firmware?(device)).to eq("farmduino")
424418
expect(settings_hide_sensors?(device)).to be(false)
@@ -494,7 +488,6 @@ def check_slot_pairing(slot, expected_name)
494488
expect(sensors_tool_verification?(device).pin).to eq(63)
495489
expect(settings_device_name?(device)).to eq(Names::GENESIS)
496490
expect(settings_change_firmware_config_defaults?(device)).to be(true)
497-
expect(settings_soil_height?(device)).to eq(-500)
498491
expect(settings_gantry_height?(device)).to eq(120)
499492
expect(settings_firmware?(device)).to eq("farmduino_k14")
500493
expect(settings_hide_sensors?(device)).to be(false)
@@ -570,7 +563,6 @@ def check_slot_pairing(slot, expected_name)
570563
expect(sensors_tool_verification?(device).pin).to eq(63)
571564
expect(settings_device_name?(device)).to eq(Names::GENESIS)
572565
expect(settings_change_firmware_config_defaults?(device)).to be(true)
573-
expect(settings_soil_height?(device)).to eq(-500)
574566
expect(settings_gantry_height?(device)).to eq(120)
575567
expect(settings_firmware?(device)).to eq("farmduino_k15")
576568
expect(settings_hide_sensors?(device)).to be(false)
@@ -648,7 +640,6 @@ def check_slot_pairing(slot, expected_name)
648640
expect(sensors_tool_verification?(device).pin).to eq(63)
649641
expect(settings_device_name?(device)).to eq(Names::GENESIS)
650642
expect(settings_change_firmware_config_defaults?(device)).to be(true)
651-
expect(settings_soil_height?(device)).to eq(-500)
652643
expect(settings_gantry_height?(device)).to eq(120)
653644
expect(settings_firmware?(device)).to eq("farmduino_k16")
654645
expect(settings_hide_sensors?(device)).to be(false)
@@ -727,7 +718,6 @@ def check_slot_pairing(slot, expected_name)
727718
expect(sensors_tool_verification?(device).pin).to eq(63)
728719
expect(settings_device_name?(device)).to eq(Names::GENESIS)
729720
expect(settings_change_firmware_config_defaults?(device)).to be(true)
730-
expect(settings_soil_height?(device)).to eq(-500)
731721
expect(settings_gantry_height?(device)).to eq(120)
732722
expect(settings_firmware?(device)).to eq("farmduino_k17")
733723
expect(settings_hide_sensors?(device)).to be(false)
@@ -805,7 +795,6 @@ def check_slot_pairing(slot, expected_name)
805795
expect(sensors_tool_verification?(device).pin).to eq(63)
806796
expect(settings_device_name?(device)).to eq(Names::GENESIS)
807797
expect(settings_change_firmware_config_defaults?(device)).to be(true)
808-
expect(settings_soil_height?(device)).to eq(-500)
809798
expect(settings_gantry_height?(device)).to eq(120)
810799
expect(settings_firmware?(device)).to eq("farmduino_k18")
811800
expect(settings_hide_sensors?(device)).to be(false)
@@ -883,7 +872,6 @@ def check_slot_pairing(slot, expected_name)
883872
expect(sensors_tool_verification?(device).pin).to eq(63)
884873
expect(settings_device_name?(device)).to eq(Names::GENESIS_XL)
885874
expect(settings_change_firmware_config_defaults?(device)).to be(true)
886-
expect(settings_soil_height?(device)).to eq(-500)
887875
expect(settings_gantry_height?(device)).to eq(120)
888876
expect(settings_firmware?(device)).to eq("farmduino_k14")
889877
expect(settings_hide_sensors?(device)).to be(false)
@@ -959,7 +947,6 @@ def check_slot_pairing(slot, expected_name)
959947
expect(sensors_tool_verification?(device).pin).to eq(63)
960948
expect(settings_device_name?(device)).to eq(Names::GENESIS_XL)
961949
expect(settings_change_firmware_config_defaults?(device)).to be(true)
962-
expect(settings_soil_height?(device)).to eq(-500)
963950
expect(settings_gantry_height?(device)).to eq(120)
964951
expect(settings_firmware?(device)).to eq("farmduino_k15")
965952
expect(settings_hide_sensors?(device)).to be(false)
@@ -1037,7 +1024,6 @@ def check_slot_pairing(slot, expected_name)
10371024
expect(sensors_tool_verification?(device).pin).to eq(63)
10381025
expect(settings_device_name?(device)).to eq(Names::GENESIS_XL)
10391026
expect(settings_change_firmware_config_defaults?(device)).to be(true)
1040-
expect(settings_soil_height?(device)).to eq(-500)
10411027
expect(settings_gantry_height?(device)).to eq(120)
10421028
expect(settings_firmware?(device)).to eq("farmduino_k17")
10431029
expect(settings_hide_sensors?(device)).to be(false)
@@ -1115,7 +1101,6 @@ def check_slot_pairing(slot, expected_name)
11151101
expect(sensors_tool_verification?(device).pin).to eq(63)
11161102
expect(settings_device_name?(device)).to eq(Names::GENESIS_XL)
11171103
expect(settings_change_firmware_config_defaults?(device)).to be(true)
1118-
expect(settings_soil_height?(device)).to eq(-500)
11191104
expect(settings_gantry_height?(device)).to eq(120)
11201105
expect(settings_firmware?(device)).to eq("farmduino_k18")
11211106
expect(settings_hide_sensors?(device)).to be(false)
@@ -1193,7 +1178,6 @@ def check_slot_pairing(slot, expected_name)
11931178
expect(sensors_tool_verification?(device).pin).to eq(63)
11941179
expect(settings_device_name?(device)).to eq(Names::GENESIS_XL)
11951180
expect(settings_change_firmware_config_defaults?(device)).to be(true)
1196-
expect(settings_soil_height?(device)).to eq(-500)
11971181
expect(settings_gantry_height?(device)).to eq(120)
11981182
expect(settings_firmware?(device)).to eq("farmduino_k16")
11991183
expect(settings_hide_sensors?(device)).to be(false)
@@ -1272,7 +1256,6 @@ def check_slot_pairing(slot, expected_name)
12721256
expect(sensors_tool_verification?(device)).to_not be
12731257
expect(settings_device_name?(device)).to eq(Names::EXPRESS)
12741258
expect(settings_change_firmware_config_defaults?(device)).to be(false)
1275-
expect(settings_soil_height?(device)).to eq(-500)
12761259
expect(settings_gantry_height?(device)).to eq(140)
12771260
expect(settings_firmware?(device)).to eq("express_k10")
12781261
expect(settings_hide_sensors?(device)).to be(true)
@@ -1344,7 +1327,6 @@ def check_slot_pairing(slot, expected_name)
13441327
expect(sensors_tool_verification?(device)).to_not be
13451328
expect(settings_device_name?(device)).to eq(Names::EXPRESS)
13461329
expect(settings_change_firmware_config_defaults?(device)).to be(false)
1347-
expect(settings_soil_height?(device)).to eq(-500)
13481330
expect(settings_gantry_height?(device)).to eq(140)
13491331
expect(settings_firmware?(device)).to eq("express_k11")
13501332
expect(settings_hide_sensors?(device)).to be(true)
@@ -1416,7 +1398,6 @@ def check_slot_pairing(slot, expected_name)
14161398
expect(sensors_tool_verification?(device)).to_not be
14171399
expect(settings_device_name?(device)).to eq(Names::EXPRESS)
14181400
expect(settings_change_firmware_config_defaults?(device)).to be(false)
1419-
expect(settings_soil_height?(device)).to eq(-500)
14201401
expect(settings_gantry_height?(device)).to eq(140)
14211402
expect(settings_firmware?(device)).to eq("express_k12")
14221403
expect(settings_hide_sensors?(device)).to be(true)
@@ -1488,7 +1469,6 @@ def check_slot_pairing(slot, expected_name)
14881469
expect(sensors_tool_verification?(device)).to_not be
14891470
expect(settings_device_name?(device)).to eq(Names::EXPRESS_XL)
14901471
expect(settings_change_firmware_config_defaults?(device)).to be(false)
1491-
expect(settings_soil_height?(device)).to eq(-500)
14921472
expect(settings_gantry_height?(device)).to eq(140)
14931473
expect(settings_firmware?(device)).to eq("express_k10")
14941474
expect(settings_hide_sensors?(device)).to be(true)
@@ -1560,7 +1540,6 @@ def check_slot_pairing(slot, expected_name)
15601540
expect(sensors_tool_verification?(device)).to_not be
15611541
expect(settings_device_name?(device)).to eq(Names::EXPRESS_XL)
15621542
expect(settings_change_firmware_config_defaults?(device)).to be(false)
1563-
expect(settings_soil_height?(device)).to eq(-500)
15641543
expect(settings_gantry_height?(device)).to eq(140)
15651544
expect(settings_firmware?(device)).to eq("express_k11")
15661545
expect(settings_hide_sensors?(device)).to be(true)
@@ -1632,7 +1611,6 @@ def check_slot_pairing(slot, expected_name)
16321611
expect(sensors_tool_verification?(device)).to_not be
16331612
expect(settings_device_name?(device)).to eq(Names::EXPRESS_XL)
16341613
expect(settings_change_firmware_config_defaults?(device)).to be(false)
1635-
expect(settings_soil_height?(device)).to eq(-500)
16361614
expect(settings_gantry_height?(device)).to eq(140)
16371615
expect(settings_firmware?(device)).to eq("express_k12")
16381616
expect(settings_hide_sensors?(device)).to be(true)

0 commit comments

Comments
 (0)