mirror of https://github.com/arendst/Tasmota.git
Merge pull request #15570 from s-hadinger/partition_core_more2
Berry add additional primitives to partition_core
This commit is contained in:
commit
e372f0c63a
|
@ -511,6 +511,7 @@ extern const bcstring be_const_str_get_coords;
|
||||||
extern const bcstring be_const_str_get_current_module_name;
|
extern const bcstring be_const_str_get_current_module_name;
|
||||||
extern const bcstring be_const_str_get_current_module_path;
|
extern const bcstring be_const_str_get_current_module_path;
|
||||||
extern const bcstring be_const_str_get_event_cb;
|
extern const bcstring be_const_str_get_event_cb;
|
||||||
|
extern const bcstring be_const_str_get_factory_slot;
|
||||||
extern const bcstring be_const_str_get_free_heap;
|
extern const bcstring be_const_str_get_free_heap;
|
||||||
extern const bcstring be_const_str_get_height;
|
extern const bcstring be_const_str_get_height;
|
||||||
extern const bcstring be_const_str_get_hor_res;
|
extern const bcstring be_const_str_get_hor_res;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -408,6 +408,16 @@ class Partition
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_factory_slot()
|
||||||
|
for slot: self.slots
|
||||||
|
if slot.is_factory() return slot end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def has_factory()
|
||||||
|
return self.get_factory_slot() != nil
|
||||||
|
end
|
||||||
|
|
||||||
#- compute the highest ota<x> partition -#
|
#- compute the highest ota<x> partition -#
|
||||||
def ota_max()
|
def ota_max()
|
||||||
var ota_max = 0
|
var ota_max = 0
|
||||||
|
@ -420,13 +430,9 @@ class Partition
|
||||||
return ota_max
|
return ota_max
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_factory()
|
# get the active OTA app partition number
|
||||||
for slot:self.slots
|
def get_active()
|
||||||
if (slot.type == 0) && (slot.subtype == 0)
|
return self.otadata.active_otadata
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_otadata()
|
def load_otadata()
|
||||||
|
@ -442,11 +448,6 @@ class Partition
|
||||||
self.otadata = partition_core.Partition_otadata(ota_max, self.has_factory(), otadata_offset)
|
self.otadata = partition_core.Partition_otadata(ota_max, self.has_factory(), otadata_offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
# get the active OTA app partition number
|
|
||||||
def get_active()
|
|
||||||
return self.otadata.active_otadata
|
|
||||||
end
|
|
||||||
|
|
||||||
#- change the active partition -#
|
#- change the active partition -#
|
||||||
def set_active(n)
|
def set_active(n)
|
||||||
if n < 0 || n > self.ota_max() raise "value_error", "Invalid ota partition number" end
|
if n < 0 || n > self.ota_max() raise "value_error", "Invalid ota partition number" end
|
||||||
|
|
Loading…
Reference in New Issue