Преглед на файлове

Use a bool for dpm_unconstrained_power

It was a uint8_t before, but it was really just a boolean variable.
It's a proper bool now, and the code that sets its value is less
ridiculous.
Clara Hobbs преди 7 години
родител
ревизия
fb50afc4cd
променени са 1 файла, в които са добавени 2 реда и са изтрити 6 реда
  1. 2
    6
      src/device_policy_manager.c

+ 2
- 6
src/device_policy_manager.c Целия файл

28
 
28
 
29
 
29
 
30
 /* Whether or not the power supply is unconstrained */
30
 /* Whether or not the power supply is unconstrained */
31
-static uint8_t dpm_unconstrained_power;
31
+static bool dpm_unconstrained_power;
32
 
32
 
33
 bool pdb_dpm_evaluate_capability(const union pd_msg *capabilities, union pd_msg *request)
33
 bool pdb_dpm_evaluate_capability(const union pd_msg *capabilities, union pd_msg *request)
34
 {
34
 {
41
     chEvtSignal(pdb_led_thread, PDB_EVT_LED_FAST_BLINK);
41
     chEvtSignal(pdb_led_thread, PDB_EVT_LED_FAST_BLINK);
42
 
42
 
43
     /* Get whether or not the power supply is constrained */
43
     /* Get whether or not the power supply is constrained */
44
-    if (capabilities->obj[0] & PD_PDO_SRC_FIXED_UNCONSTRAINED) {
45
-        dpm_unconstrained_power = 1;
46
-    } else {
47
-        dpm_unconstrained_power = 0;
48
-    }
44
+    dpm_unconstrained_power = capabilities->obj[0] & PD_PDO_SRC_FIXED_UNCONSTRAINED;
49
 
45
 
50
     /* Make sure we have configuration */
46
     /* Make sure we have configuration */
51
     if (cfg != NULL) {
47
     if (cfg != NULL) {

Loading…
Отказ
Запис