Skip to content

Commit

Permalink
Fix Battery module
Browse files Browse the repository at this point in the history
  • Loading branch information
eloaders committed Jan 11, 2014
1 parent ea5c43f commit 1685528
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 28 deletions.
38 changes: 29 additions & 9 deletions src/i-nex/.src/Finfosys.class
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Public Sub Form_Open()
Logs(Settings.Path, Logger.Info)
Logs(Settings.DefaultDir, Logger.Info)
Finfosys.TabStrip1[9].Visible = False
Finfosys.TabStrip1[11].Visible = False
Logs("Call to MInit for copy nedded files to I-Nex config dir in User.Home", Logger.Info)
Object.Call(MInit, "_inits")
Logs("Call to Distribution_Detect", Logger.Info)
Expand Down Expand Up @@ -481,20 +482,39 @@ End
Public Sub battery_info()
Logs("Get information Active Battery", Logger.Info)
TextBox7.Text = battery.Present
TextBox8.Text = battery.Design_capacity & battery.capacity
TextBox9.Text = battery.last_full_capacity & battery.current_now
TextBox10.Text = battery.battery_technology & battery.technology
TextBox11.Text = battery.design_voltage & battery.charge_now
TextBox12.Text = battery.design_capacity_warning & battery.charge_full_design
TextBox13.Text = battery.design_capacity_low & battery.charge_full
TextBox14.Text = battery.cycle_count & battery.status
TextBox8.Text = battery.Design_capacity
TextBox9.Text = battery.last_full_capacity
TextBox10.Text = battery.battery_technology
TextBox11.Text = battery.design_voltage
TextBox12.Text = battery.design_capacity_warning
TextBox13.Text = battery.design_capacity_low
TextBox14.Text = battery.cycle_count
TextBox15.Text = battery.capacity_granularity_1
TextBox16.Text = battery.capacity_granularity_2
TextBox17.Text = battery.model_number & battery.model_name
TextBox17.Text = battery.model_number
TextBox18.Text = battery.serial_number
TextBox19.Text = battery.battery_type
TextBox20.Text = battery.OEM_info & battery.manufacturer
TextBox20.Text = battery.OEM_info

Logs("Get information Active Battery Done", Logger.Info)
If Exist("/sys/class/power_supply/BAT1/", True) Then
Label177.Text = "Alarm: " & battery.alarm
Label178.Text = "Capacity: " & battery.capacity
Label179.Text = "Charge full: " & battery.charge_full
Label180.Text = "Charge full design: " & battery.charge_full_design
Label181.Text = "Charge now: " & battery.charge_now
Label182.Text = "Current now: " & battery.current_now
Label183.Text = "Cycle count: " & battery.cycle_count
Label184.Text = "Manufacturer: " & battery.manufacturer
Label185.Text = "Model name: " & battery.model_name
Label186.Text = "Present: " & battery.Present
Label187.Text = "Serial number: " & battery.serial_number
Label188.Text = "Status: " & battery.status
Label189.Text = "Technology: " & battery.technology
Label190.Text = "Battery type: " & battery.battery_type
Label191.Text = "Voltage min design: " & battery.voltage_min_design
Label192.Text = "Voltage now: " & battery.voltage_now
Endif

End

Expand Down
118 changes: 117 additions & 1 deletion src/i-nex/.src/Finfosys.form
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
PopupMenu = "Menu1"
Margin = True
Padding = 3
Count = 11
Count = 12
TextFont = Font["8"]
Index = 0
Text = ("CPU")
Expand Down Expand Up @@ -1977,6 +1977,122 @@
Move(6,330,144,24)
ReadOnly = True
}
Index = 11
Text = ("Battery ")
Picture = Picture["AppIcons/Finfosys/battery.png"]
{ Label177 Label
Move(7,7,455,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label177")
Border = Border.Raised
}
{ Label178 Label
Move(7,28,455,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label178")
Border = Border.Raised
}
{ Label179 Label
Move(7,49,455,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label179")
Border = Border.Raised
}
{ Label180 Label
Move(7,70,455,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label180")
Border = Border.Raised
}
{ Label181 Label
Move(7,91,455,21)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label181")
Border = Border.Raised
}
{ Label182 Label
Move(7,112,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label182")
Border = Border.Raised
}
{ Label183 Label
Move(7,140,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label183")
Border = Border.Raised
}
{ Label184 Label
Move(7,168,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label184")
Border = Border.Raised
}
{ Label185 Label
Move(7,196,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label185")
Border = Border.Raised
}
{ Label186 Label
Move(7,224,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label186")
Border = Border.Raised
}
{ Label187 Label
Move(7,252,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label187")
Border = Border.Raised
}
{ Label188 Label
Move(7,280,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label188")
Border = Border.Raised
}
{ Label189 Label
Move(7,308,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label189")
Border = Border.Raised
}
{ Label190 Label
Move(7,336,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label190")
Border = Border.Raised
}
{ Label191 Label
Move(7,364,455,28)
Font = Font["Bold,8"]
Padding = 3
Text = ("Label191")
Border = Border.Raised
}
{ ProgressBar5 ProgressBar
Move(7,441,455,28)
}
{ Label192 Label
Move(7,392,455,28)
Text = ("Label192")
Border = Border.Raised
}
Index = 0
}
{ ComboBox1 ComboBox
Expand Down
38 changes: 20 additions & 18 deletions src/i-nex/.src/battery.module
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ If Exist("/proc/acpi/battery/BAT1/info", True) Then
Finfosys.battery_info()
Endif
If Exist("/sys/class/power_supply/BAT1/", True) Then
Finfosys.TabStrip1[9].Visible = True
Finfosys.TabStrip1[11].Visible = True
battery._get_inf_other()
battery._replace_n()
Finfosys.battery_info()
Expand Down Expand Up @@ -81,23 +81,24 @@ Public Sub _get_inf()
End

Public Sub _get_inf_other()
alarm = File.Load("/sys/class/power_supply/BAT1/alarm")
capacity = File.Load("/sys/class/power_supply/BAT1/capacity")
charge_full = File.Load("/sys/class/power_supply/BAT1/charge_full")
charge_full_design = File.Load("/sys/class/power_supply/BAT1/charge_full_design")
charge_now = File.Load("/sys/class/power_supply/BAT1/charge_now")
current_now = File.Load("/sys/class/power_supply/BAT1/current_now")
cycle_count = File.Load("/sys/class/power_supply/BAT1/cycle_count")
manufacturer = File.Load("/sys/class/power_supply/BAT1/manufacturer")
model_name = File.Load("/sys/class/power_supply/BAT1/model_name")
Present = File.Load("/sys/class/power_supply/BAT1/present")
serial_number = File.Load("/sys/class/power_supply/BAT1/serial_number")
status = File.Load("/sys/class/power_supply/BAT1/status")
technology = File.Load("/sys/class/power_supply/BAT1/technology")
battery_type = File.Load("/sys/class/power_supply/BAT1/type")
voltage_min_design = File.Load("/sys/class/power_supply/BAT1/voltage_min_design")
voltage_now = File.Load("/sys/class/power_supply/BAT1/voltage_now")
'uevent

alarm = Replace(File.Load("/sys/class/power_supply/BAT1/alarm"), "\n", "")
capacity = Replace(File.Load("/sys/class/power_supply/BAT1/capacity"), "\n", "")
charge_full = Replace(File.Load("/sys/class/power_supply/BAT1/charge_full"), "\n", "")
charge_full_design = Replace(File.Load("/sys/class/power_supply/BAT1/charge_full_design"), "\n", "")
charge_now = Replace(File.Load("/sys/class/power_supply/BAT1/charge_now"), "\n", "")
current_now = Replace(File.Load("/sys/class/power_supply/BAT1/current_now"), "\n", "")
cycle_count = Replace(File.Load("/sys/class/power_supply/BAT1/cycle_count"), "\n", "")
manufacturer = Replace(File.Load("/sys/class/power_supply/BAT1/manufacturer"), "\n", "")
model_name = Replace(File.Load("/sys/class/power_supply/BAT1/model_name"), "\n", "")
Present = Replace(File.Load("/sys/class/power_supply/BAT1/present"), "\n", "")
serial_number = Replace(File.Load("/sys/class/power_supply/BAT1/serial_number"), "\n", "")
status = Replace(File.Load("/sys/class/power_supply/BAT1/status"), "\n", "")
technology = Replace(File.Load("/sys/class/power_supply/BAT1/technology"), "\n", "")
battery_type = Replace(File.Load("/sys/class/power_supply/BAT1/type"), "\n", "")
voltage_min_design = Replace(File.Load("/sys/class/power_supply/BAT1/voltage_min_design"), "\n", "")
voltage_now = Replace(File.Load("/sys/class/power_supply/BAT1/voltage_now"), "\n", "")

End

Public Sub _replace_n()
Expand All @@ -119,5 +120,6 @@ Public Sub _replace_n()
calculate_percentage = Replace(Replace(Replace(calculate_percentage, "mAh", ""), " ", ""), "\n", "")
calculate_percentage_max = Replace(Replace(Replace(calculate_percentage_max, "mAh", ""), " ", ""), "\n", "")
Try Finfosys.ProgressBar3.Value = calculate_percentage / calculate_percentage_max
Try Finfosys.ProgressBar5.Value = CInteger(Replace(capacity, "\n", "")) / 100
End

0 comments on commit 1685528

Please sign in to comment.