Change default firmware_hard from "none" to nil, plus FBJS stuff
parent
bb525c26ec
commit
4d24432f2c
|
@ -6,7 +6,7 @@ class FbosConfig < ApplicationRecord
|
|||
after_save :maybe_sync_nerves, on: [:create, :update]
|
||||
|
||||
FIRMWARE_HARDWARE = [
|
||||
NONE = "none",
|
||||
NONE = nil,
|
||||
ARDUINO = "arduino",
|
||||
FARMDUINO = "farmduino",
|
||||
FARMDUINO_K14 = "farmduino_k14",
|
||||
|
|
|
@ -7,7 +7,7 @@ module Devices
|
|||
"genesis_1.2" => Devices::Seeders::GenesisOneTwo,
|
||||
"genesis_1.3" => Devices::Seeders::GenesisOneThree,
|
||||
"genesis_1.4" => Devices::Seeders::GenesisOneFour,
|
||||
"genesis_xl_1.4" => Devices::Seeders::XlOneFour,
|
||||
"genesis_xl_1.4" => Devices::Seeders::GenesisXlOneFour,
|
||||
|
||||
"none" => Devices::Seeders::None,
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ module Devices
|
|||
:settings_device_name,
|
||||
:settings_enable_encoders,
|
||||
:settings_firmware,
|
||||
:settings_map_xl,
|
||||
|
||||
# TOOLS ==================================
|
||||
:tools_seed_bin,
|
||||
|
@ -76,6 +77,10 @@ module Devices
|
|||
@device = device
|
||||
end
|
||||
|
||||
def settings_map_xl
|
||||
device.web_app_config.update_attributes!(map_xl: false)
|
||||
end
|
||||
|
||||
def plants
|
||||
PLANTS.map { |x| Points::Create.run!(x, device: device) }
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Devices
|
||||
module Seeders
|
||||
class XlOneFour < AbstractGenesis
|
||||
class GenesisXlOneFour < AbstractGenesis
|
||||
def settings_firmware
|
||||
device
|
||||
.fbos_config
|
||||
|
@ -18,6 +18,10 @@ module Devices
|
|||
def settings_default_map_size_y
|
||||
device.web_app_config.update_attributes!(map_size_y: 2_900)
|
||||
end
|
||||
|
||||
def settings_map_xl
|
||||
device.web_app_config.update_attributes!(map_xl: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class UndoColumnDefaultFirmwareHardware < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
change_column_default(:fbos_configs, :firmware_hardware, from: "none", to: nil)
|
||||
end
|
||||
end
|
|
@ -430,7 +430,7 @@ CREATE TABLE public.fbos_configs (
|
|||
sequence_complete_log boolean DEFAULT false,
|
||||
sequence_init_log boolean DEFAULT false,
|
||||
network_not_found_timer integer,
|
||||
firmware_hardware character varying DEFAULT 'arduino'::character varying,
|
||||
firmware_hardware character varying,
|
||||
api_migrated boolean DEFAULT true,
|
||||
os_auto_update boolean DEFAULT true,
|
||||
arduino_debug_messages boolean DEFAULT false,
|
||||
|
@ -2965,6 +2965,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||
('20190501143201'),
|
||||
('20190502163453'),
|
||||
('20190504170018'),
|
||||
('20190512015442');
|
||||
('20190512015442'),
|
||||
('20190513221836');
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"coveralls": "3.0.3",
|
||||
"enzyme": "3.9.0",
|
||||
"enzyme-adapter-react-16": "1.12.1",
|
||||
"farmbot": "7.0.9",
|
||||
"farmbot": "7.1.0",
|
||||
"farmbot-toastr": "1.0.3",
|
||||
"i18next": "15.1.0",
|
||||
"jest": "24.8.0",
|
||||
|
|
|
@ -26,13 +26,14 @@ describe Api::FbosConfigsController do
|
|||
arduino_debug_messages: false,
|
||||
network_not_found_timer: nil,
|
||||
os_auto_update: true,
|
||||
firmware_hardware: "none",
|
||||
firmware_hardware: nil,
|
||||
api_migrated: true
|
||||
}.to_a.map do |key, value|
|
||||
actual = json[key]
|
||||
actual = json.fetch(key)
|
||||
expected = value
|
||||
correct = actual == expected
|
||||
fail "#{key} should be #{expected} but got #{actual}" unless correct
|
||||
friendly_actual_var = actual|| "nil or false"
|
||||
fail "#{key} should be #{expected} but got #{friendly_actual_var}" unless correct
|
||||
end
|
||||
|
||||
{ created_at: String, updated_at: String }
|
||||
|
|
|
@ -61,6 +61,10 @@ describe Api::DevicesController do
|
|||
device.name
|
||||
end
|
||||
|
||||
def settings_map_xl?(device)
|
||||
device.web_app_config.map_xl
|
||||
end
|
||||
|
||||
def settings_enable_encoders?(device)
|
||||
c = device.firmware_config
|
||||
|
||||
|
@ -216,6 +220,7 @@ describe Api::DevicesController do
|
|||
expect(settings_device_name?(device)).to eq("FarmBot Genesis")
|
||||
expect(settings_enable_encoders?(device)).to be(true)
|
||||
expect(settings_firmware?(device)).to eq("arduino")
|
||||
expect(settings_map_xl?(device)).to be(false)
|
||||
expect(tool_slots_slot_1?(device).name).to eq("Seeder")
|
||||
expect(tool_slots_slot_2?(device).name).to eq("Seed Bin")
|
||||
expect(tool_slots_slot_3?(device).name).to eq("Seed Tray")
|
||||
|
@ -265,6 +270,7 @@ describe Api::DevicesController do
|
|||
expect(settings_device_name?(device)).to eq("FarmBot Genesis")
|
||||
expect(settings_enable_encoders?(device)).to be(true)
|
||||
expect(settings_firmware?(device)).to eq("farmduino")
|
||||
expect(settings_map_xl?(device)).to be(false)
|
||||
expect(tool_slots_slot_1?(device).name).to eq("Seeder")
|
||||
expect(tool_slots_slot_2?(device).name).to eq("Seed Bin")
|
||||
expect(tool_slots_slot_3?(device).name).to eq("Seed Tray")
|
||||
|
@ -315,6 +321,7 @@ describe Api::DevicesController do
|
|||
expect(settings_device_name?(device)).to eq("FarmBot Genesis")
|
||||
expect(settings_enable_encoders?(device)).to be(true)
|
||||
expect(settings_firmware?(device)).to eq("farmduino_k14")
|
||||
expect(settings_map_xl?(device)).to be(false)
|
||||
expect(tool_slots_slot_1?(device).name).to eq("Seeder")
|
||||
expect(tool_slots_slot_2?(device).name).to eq("Seed Bin")
|
||||
expect(tool_slots_slot_3?(device).name).to eq("Seed Tray")
|
||||
|
@ -358,6 +365,7 @@ describe Api::DevicesController do
|
|||
expect(settings_device_name?(device)).to eq("FarmBot Genesis XL")
|
||||
expect(settings_enable_encoders?(device)).to be(true)
|
||||
expect(settings_firmware?(device)).to eq("farmduino_k14")
|
||||
expect(settings_map_xl?(device)).to be(true)
|
||||
expect(tool_slots_slot_1?(device).name).to eq("Seeder")
|
||||
expect(tool_slots_slot_2?(device).name).to eq("Seed Bin")
|
||||
expect(tool_slots_slot_3?(device).name).to eq("Seed Tray")
|
||||
|
@ -409,6 +417,7 @@ describe Api::DevicesController do
|
|||
expect(settings_device_name?(device)).to eq("FarmBot Express")
|
||||
expect(settings_enable_encoders?(device)).to be(false)
|
||||
expect(settings_firmware?(device)).to eq("express_k10")
|
||||
expect(settings_map_xl?(device)).to be(false)
|
||||
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")
|
||||
|
@ -455,6 +464,7 @@ describe Api::DevicesController do
|
|||
expect(settings_device_name?(device)).to eq("FarmBot Express XL")
|
||||
expect(settings_enable_encoders?(device)).to be(false)
|
||||
expect(settings_firmware?(device)).to eq("express_k10")
|
||||
expect(settings_map_xl?(device)).to be(false)
|
||||
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")
|
||||
|
|
|
@ -42,6 +42,6 @@ describe FbosConfig do
|
|||
end
|
||||
|
||||
it "has default firmware_hardware" do
|
||||
expect(FbosConfig.create!.firmware_hardware).to eq("none")
|
||||
expect(FbosConfig.create!.firmware_hardware).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue