Seed slots 1-6
parent
2ad2cc73d6
commit
65bfc110be
|
@ -158,12 +158,29 @@ module Devices
|
|||
|
||||
def settings_firmware; end
|
||||
|
||||
def tool_slots_slot_1; end
|
||||
def tool_slots_slot_2; end
|
||||
def tool_slots_slot_3; end
|
||||
def tool_slots_slot_4; end
|
||||
def tool_slots_slot_5; end
|
||||
def tool_slots_slot_6; end
|
||||
def tool_slots_slot_1
|
||||
add_tool_slot(ToolNames::SEEDER, 50, 100, -200)
|
||||
end
|
||||
|
||||
def tool_slots_slot_2
|
||||
add_tool_slot(ToolNames::SEED_BIN, 50, 200, -200)
|
||||
end
|
||||
|
||||
def tool_slots_slot_3
|
||||
add_tool_slot(ToolNames::SEED_TRAY, 50, 300, -200)
|
||||
end
|
||||
|
||||
def tool_slots_slot_4
|
||||
add_tool_slot(ToolNames::WATERING_NOZZLE, 50, 500, -200)
|
||||
end
|
||||
|
||||
def tool_slots_slot_5
|
||||
add_tool_slot(ToolNames::SOIL_SENSOR, 50, 600, -200)
|
||||
end
|
||||
|
||||
def tool_slots_slot_6
|
||||
add_tool_slot(ToolNames::WEEDER, 50, 700, -200)
|
||||
end
|
||||
|
||||
def tools_seed_bin; end
|
||||
def tools_seed_tray; end
|
||||
|
@ -181,18 +198,28 @@ module Devices
|
|||
puts "TODO - need to implement tools first!"
|
||||
end
|
||||
|
||||
def attach_peripheral(pin, label)
|
||||
def add_peripheral(pin, label)
|
||||
Peripherals::Create.run!(device: device,
|
||||
pin: pin,
|
||||
label: label)
|
||||
end
|
||||
|
||||
def attach_sensor(pin, label, mode)
|
||||
def add_sensor(pin, label, mode)
|
||||
Sensors::Create.run!(device: device,
|
||||
pin: pin,
|
||||
label: label,
|
||||
mode: mode)
|
||||
end
|
||||
|
||||
def add_tool_slot(name, x, y, z, pullout_direction = ToolSlot::POSITIVE_X)
|
||||
Points::Create.run!(pointer_type: "ToolSlot",
|
||||
name: name,
|
||||
x: x,
|
||||
y: y,
|
||||
z: z,
|
||||
pullout_direction: pullout_direction,
|
||||
device: device)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,19 +11,19 @@ module Devices
|
|||
SEQUENCES_WATER_PLANT = true
|
||||
|
||||
def peripherals_water
|
||||
attach_peripheral(10, ToolNames::VACUUM)
|
||||
add_peripheral(10, ToolNames::VACUUM)
|
||||
end
|
||||
|
||||
def peripherals_vacuum
|
||||
attach_peripheral(9, ToolNames::WATER)
|
||||
add_peripheral(9, ToolNames::WATER)
|
||||
end
|
||||
|
||||
def sensors_soil_sensor
|
||||
attach_sensor(59, ToolNames::SOIL_SENSOR, ANALOG)
|
||||
add_sensor(59, ToolNames::SOIL_SENSOR, ANALOG)
|
||||
end
|
||||
|
||||
def sensors_tool_verification
|
||||
attach_sensor(63, ToolNames::TOOL_VERIFICATION, DIGITAL)
|
||||
add_sensor(63, ToolNames::TOOL_VERIFICATION, DIGITAL)
|
||||
end
|
||||
|
||||
def settings_firmware
|
||||
|
|
|
@ -61,12 +61,9 @@ describe Api::DevicesController do
|
|||
expect(device.fbos_config.firmware_hardware).to eq(FbosConfig::ARDUINO)
|
||||
slot_names = device.tool_slots.pluck(:name)
|
||||
|
||||
expect(slot_names).to include("Seeder")
|
||||
expect(slot_names).to include("Seed Bin")
|
||||
expect(slot_names).to include("Seed Tray")
|
||||
expect(slot_names).to include("Watering Nozzle")
|
||||
expect(slot_names).to include("Soil Sensor")
|
||||
expect(slot_names).to include("Weeder")
|
||||
%i(SEED_BIN SEED_TRAY SEEDER SOIL_SENSOR WATERING_NOZZLE WEEDER)
|
||||
.map { |sym| Devices::Seeders::Constants::ToolNames.const_get sym }
|
||||
.map { |x| expect(slot_names).to include(x) }
|
||||
|
||||
expect(device.sequences.count).to eq(7)
|
||||
binding.pry # Now what?
|
||||
|
|
Loading…
Reference in New Issue