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_path;
|
||||
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_height;
|
||||
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
|
||||
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 -#
|
||||
def ota_max()
|
||||
var ota_max = 0
|
||||
|
@ -420,13 +430,9 @@ class Partition
|
|||
return ota_max
|
||||
end
|
||||
|
||||
def has_factory()
|
||||
for slot:self.slots
|
||||
if (slot.type == 0) && (slot.subtype == 0)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
# get the active OTA app partition number
|
||||
def get_active()
|
||||
return self.otadata.active_otadata
|
||||
end
|
||||
|
||||
def load_otadata()
|
||||
|
@ -442,11 +448,6 @@ class Partition
|
|||
self.otadata = partition_core.Partition_otadata(ota_max, self.has_factory(), otadata_offset)
|
||||
end
|
||||
|
||||
# get the active OTA app partition number
|
||||
def get_active()
|
||||
return self.otadata.active_otadata
|
||||
end
|
||||
|
||||
#- change the active partition -#
|
||||
def set_active(n)
|
||||
if n < 0 || n > self.ota_max() raise "value_error", "Invalid ota partition number" end
|
||||
|
|
Loading…
Reference in New Issue