INTERMISSION: Need to add ToolSlot#gantry_mounted(boolean) to account for express style gantry mount tools

pull/1177/head
Rick Carlino 2019-05-02 10:22:48 -05:00
parent 708661a9a6
commit 74ed1ec296
6 changed files with 144 additions and 3 deletions

View File

@ -9,6 +9,7 @@ class FbosConfig < ApplicationRecord
ARDUINO = "arduino",
FARMDUINO = "farmduino",
FARMDUINO_K14 = "farmduino_k14",
EXPRESS_V10 = "express_v10"
]
NERVES_FIELD = "update_channel"

View File

@ -0,0 +1,93 @@
module Devices
module Seeders
class AbstractExpress < AbstractGenesis
PRODUCT_LINE = Devices::Seeders::Constants::ProductLines::EXPRESS
SEQUENCES_MOUNT_TOOL = false
SEQUENCES_PICKUP_SEED = false
SEQUENCES_PLANT_SEED = false
SEQUENCES_TAKE_PHOTO_OF_PLANT = false
SEQUENCES_TOOL_ERROR = false
SEQUENCES_UNMOUNT_TOOL = false
SEQUENCES_WATER_PLANT = false
def settings_device_name
device.update_attributes!(name: "FarmBot Express")
end
def sensors_soil_sensor; end
def sensors_tool_verification; end
def settings_enable_encoders
device.firmware_config.update_attributes!(encoder_enabled_x: 0,
encoder_enabled_y: 0,
encoder_enabled_z: 0)
end
def settings_firmware
device
.fbos_config
.update_attributes!(firmware_hardware: FbosConfig::EXPRESS_V10)
end
def tool_slots_slot_1
add_tool_slot(ToolNames::SEED_TROUGH_1,
0,
25,
-200,
ToolSlot::NONE,
true)
end
def tool_slots_slot_2
add_tool_slot(ToolNames::SEED_TROUGH_2,
0,
50,
-200,
ToolSlot::NONE,
true)
end
def tool_slots_slot_3
add_tool_slot(ToolNames::SEED_TROUGH_3,
0,
75,
-200,
ToolSlot::NONE,
true)
end
def tool_slots_slot_4; end
def tool_slots_slot_5; end
def tool_slots_slot_6; end
def tools_seed_bin; end
def tools_seed_tray; end
def tools_seed_trough_1
add_tool(ToolNames::SEED_TROUGH_1)
end
def tools_seed_trough_2
add_tool(ToolNames::SEED_TROUGH_2)
end
def tools_seed_trough_3
add_tool(ToolNames::SEED_TROUGH_3)
end
def tools_seeder; end
def tools_soil_sensor; end
def tools_watering_nozzle; end
def tools_weeder; end
def sequences_mount_tool; end
def sequences_pickup_seed
binding.pry # Hmm...
end
def sequences_tool_error; end
def sequences_unmount_tool; end
def settings_default_map_size_y
device.web_app_config.update_attributes!(map_size_y: 1_200)
end
end
end
end

View File

@ -254,7 +254,7 @@ module Devices
mode: mode)
end
def add_tool_slot(name, x, y, z, pullout_direction = ToolSlot::POSITIVE_X)
def add_tool_slot(name, x, y, z, pullout_direction = ToolSlot::POSITIVE_X, gantry_mount = false)
Points::Create.run!(pointer_type: "ToolSlot",
name: name,
x: x,

View File

@ -29,6 +29,9 @@ module Devices
WATERING_NOZZLE = "Watering Nozzle"
WEEDER = "Weeder"
LIGHTING = "Lighting"
SEED_TROUGH_1 = "Seed Trough 1"
SEED_TROUGH_2 = "Seed Trough 2"
SEED_TROUGH_3 = "Seed Trough 3"
end
# Stub plants ==============================

View File

@ -1,6 +1,6 @@
module Devices
module Seeders
class ExpressOneZero < AbstractSeeder
class ExpressOneZero < AbstractExpress
end
end
end

View File

@ -323,7 +323,7 @@ describe Api::DevicesController do
expect(settings_default_map_size_y?(device)).to eq(1500)
end
it "seeds accounts with Genesis 1.4 data" do
it "seeds accounts with Genesis XL 1.4 data" do
start_tests "xl_1.4"
expect(peripherals_lighting?(device).pin).to eq(7)
@ -365,5 +365,49 @@ describe Api::DevicesController do
expect(settings_default_map_size_x?(device)).to eq(6000)
expect(settings_default_map_size_y?(device)).to eq(3000)
end
it "seeds accounts with Express 1.0 data" do
start_tests "express_1.0"
expect(peripherals_lighting?(device).pin).to eq(7)
expect(peripherals_peripheral_4?(device).pin).to eq(10)
expect(peripherals_peripheral_5?(device).pin).to eq(12)
expect(peripherals_vacuum?(device).pin).to be(9)
expect(peripherals_water?(device).pin).to be(8)
expect(pin_bindings_button_1?(device).special_action).to eq("emergency_lock")
expect(pin_bindings_button_2?(device).special_action).to eq("emergency_unlock")
expect(plants?(device)).to be true
expect(sensors_soil_sensor?(device)).to_not be
expect(sensors_tool_verification?(device)).to_not be
expect(settings_device_name?(device)).to eq("FarmBot Express")
expect(settings_enable_encoders?(device)).to be(false)
expect(settings_firmware?(device)).to eq("express_v10")
expect(tool_slots_slot_1?(device).name).to eq("Seed Trough 1")
expect(tool_slots_slot_2?(device).name).to eq("Seed Trough 2")
expect(tool_slots_slot_3?(device).name).to eq("Seed Trough 3")
expect(tool_slots_slot_4?(device)).to_not be
expect(tool_slots_slot_5?(device)).to_not be
expect(tool_slots_slot_6?(device)).to_not be
expect(tools_seed_bin?(device)).to_not be
expect(tools_seed_tray?(device)).to_not be
expect(tools_seed_trough_1?(device)).to be
expect(tools_seed_trough_2?(device)).to be
expect(tools_seed_trough_3?(device)).to be
expect(tools_seeder?(device)).to_not be
expect(tools_soil_sensor?(device)).to_not be
expect(tools_watering_nozzle?(device)).to_not be
expect(tools_weeder?(device)).to_not be
expect(sequences_mount_tool?(device)).to_not be
expect(sequences_pickup_seed_genesis?(device)).to_not be
expect(sequences_pickup_seed_express?(device)).to be
expect(sequences_plant_seed?(device)).to be_kind_of(Sequence)
expect(sequences_take_photo_of_plant?(device)).to be_kind_of(Sequence)
expect(sequences_tool_error?(device)).to_not be
expect(sequences_unmount_tool?(device)).to_not be
expect(sequences_water_plant?(device)).to be_kind_of(Sequence)
expect(settings_default_map_size_x?(device)).to eq(3000)
expect(settings_default_map_size_y?(device)).to eq(1200)
end
end
end