Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
zoic21 authored Aug 27, 2024
1 parent 2cd7976 commit a8060c6
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions core/class/ajaxSystem.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public function refreshData() {
}
if (isset($datas['firmwareVersion']) && $datas['firmwareVersion'] != $this->getConfiguration('firmware')) {
$this->setConfiguration('firmware', $datas['firmwareVersion']);
$this->save();
$this->save(true);
}
foreach ($this->getCmd('info') as $cmd) {
$paths = explode('::', $cmd->getLogicalId());
Expand All @@ -291,7 +291,6 @@ public function refreshData() {
}
$this->checkAndUpdateCmd($cmd, $value);
}

//Refresh batterie depuis trame de synchronisation / refresh
$batteryChargeLevel = '-1';
if (isset($datas['batteryChargeLevelPercentage'])) {
Expand All @@ -300,17 +299,11 @@ public function refreshData() {
if (isset($datas['battery']) && isset($datas['battery']['chargeLevelPercentage'])) {
$batteryChargeLevel = $datas['battery']['chargeLevelPercentage'];
}

//Si niveau de charge numérique disponible, mise à jour de l'information
if($batteryChargeLevel != '-1'){
//Au niveau de l'équipement
$this->batteryStatus($batteryChargeLevel);

//Au niveau de la commande spécifique si elle existe
$batteryCmd = $this->getCmd('info', 'battery::chargeLevelPercentage');
if(is_object($batteryCmd)){
$this->checkAndUpdateCmd('battery::chargeLevelPercentage', $value);
}
$this->checkAndUpdateCmd('battery::chargeLevelPercentage', $value);
}
}

Expand Down

0 comments on commit a8060c6

Please sign in to comment.