diff --git a/advanced.py b/advanced.py index 5c63da6..af68c1d 100644 --- a/advanced.py +++ b/advanced.py @@ -190,7 +190,7 @@ def adv_apply(): lines = str(3) + "\n" + all_lines[1] + "\n" for val in vr: lines = lines + str(val) + "," - lines = lines + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = lines + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) return diff --git a/indicator.py b/indicator.py index 33f759f..5cc5509 100644 --- a/indicator.py +++ b/indicator.py @@ -34,6 +34,7 @@ conf_file.write("12,") for val in temp_: conf_file.write("%i," % val) + conf_file.write("\n0") conf_file.close() os.system("x-terminal-emulator -e 'bash -c \"sudo nohup python3 ${pkgdir}read_temp_set.py >/dev/null 2>&1\"'") @@ -64,7 +65,7 @@ def corrections(lines): return all_lines = reading() -lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] +lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def main(): @@ -78,6 +79,7 @@ def build_menu(): basic_submenu = gtk.Menu() cpu_submenu = gtk.Menu() battery_charge_threshold_submenu = gtk.Menu() + flip_board_submenu = gtk.Menu() backlight_submenu = gtk.Menu() item_github = gtk.MenuItem.new_with_label('Visit Project') @@ -196,6 +198,19 @@ def build_menu(): item_ec.connect('activate', ec_map) menu.append(item_ec) + item_flip_board = gtk.MenuItem.new_with_label('Intel 11th Gen') ################# CPU fan monitor choose "ca" and "c8" + item_flip_board.set_submenu(flip_board_submenu) + + item_flip_board_1 = gtk.MenuItem.new_with_label('On') + item_flip_board_1.connect('activate', flip_board_1) + flip_board_submenu.append(item_flip_board_1) + + item_flip_board_2 = gtk.MenuItem.new_with_label('Off') + item_flip_board_2.connect('activate', flip_board_2) + flip_board_submenu.append(item_flip_board_2) + + menu.append(item_flip_board) + Separator = gtk.SeparatorMenuItem() ################################# Quit menu.append(Separator) @@ -211,42 +226,42 @@ def github(source): def auto(source): all_lines = reading() - lines = str(1) + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(1) + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def slowest(source): all_lines = reading() - lines = str(2) + "\n" + "-30" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(2) + "\n" + "-30" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def slower(source): all_lines = reading() - lines = str(2) + "\n" + "-20" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(2) + "\n" + "-20" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def slow(source): all_lines = reading() - lines = str(2) + "\n" + "-10" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(2) + "\n" + "-10" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def normal(source): all_lines = reading() - lines = str(2) + "\n" + "0" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(2) + "\n" + "0" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def fast(source): all_lines = reading() - lines = str(2) + "\n" + "10" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(2) + "\n" + "10" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def faster(source): all_lines = reading() - lines = str(2) + "\n" + "20" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(2) + "\n" + "20" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def fastest(source): all_lines = reading() - lines = str(2) + "\n" + "30" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(2) + "\n" + "30" + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def advanced(source): @@ -255,7 +270,7 @@ def advanced(source): def cooler_booster(source): all_lines = reading() - lines = str(4) + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = str(4) + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def monitoring(source): @@ -276,38 +291,48 @@ def manual(source): def cpu(source): f = 0 -def battery_charge_threashold_50(osurce): +def battery_charge_threashold_50(source): all_lines = reading() - lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "50" + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "50" + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) -def battery_charge_threashold_60(osurce): +def battery_charge_threashold_60(source): all_lines = reading() - lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "60" + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "60" + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) -def battery_charge_threashold_70(osurce): +def battery_charge_threashold_70(source): all_lines = reading() - lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "70" + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "70" + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) -def battery_charge_threashold_80(osurce): +def battery_charge_threashold_80(source): all_lines = reading() - lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "80" + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "80" + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) -def battery_charge_threashold_90(osurce): +def battery_charge_threashold_90(source): all_lines = reading() - lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "90" + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "90" + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) -def battery_charge_threashold_100(osurce): +def battery_charge_threashold_100(source): all_lines = reading() - lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "100" + "\n" + all_lines[4] + "\n" + all_lines[5] + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + "100" + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + all_lines[6] corrections(lines) def ec_map(source): os.system("x-terminal-emulator -e 'bash -c \"sudo nohup python3 ${pkgdir}ec_dump.py >/dev/null 2>&1\"'") + +def flip_board_1(source): + all_lines = reading() + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + str(1) + corrections(lines) + +def flip_board_2(source): + all_lines = reading() + lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" + all_lines[4] + "\n" + all_lines[5] + "\n" + str(0) + corrections(lines) def quit(source): gtk.main_quit() diff --git a/monitor.py b/monitor.py index a78e134..5d9bff2 100644 --- a/monitor.py +++ b/monitor.py @@ -11,6 +11,8 @@ conf_file_a = open(my_filename, "r") mode = int(conf_file_a.read(1)) +all_lines = conf_file_a.readlines() +flip_board = int(all_lines[6]) conf_file_a.close() monitoring = 0 @@ -29,11 +31,11 @@ canvas = Canvas(window_m) canvas.configure(bg = 'black') -def monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55): +def monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55, lable_m444, lable_m555): global monitoring monitoring = 1 global timer - timer = threading.Timer(1, monitoring_int, args = (lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55)) + timer = threading.Timer(1, monitoring_int, args = (lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55, lable_m444, lable_m555)) timer.start() global temp_m temp_m = mode @@ -46,7 +48,14 @@ def monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_ cpu_cur_temp = (int(file.read(1).hex(),16)) file.seek(0x80) gpu_cur_temp = (int(file.read(1).hex(),16)) - file.seek(0xcc) + file.seek(0x71) + cpu_fan_s = (int(file.read(1).hex(),16)) + file.seek(0x89) + gpu_fan_s = (int(file.read(1).hex(),16)) + if flip_board == 0: + file.seek(0xca) + else: + file.seek(0xc8) cpu_fan = (int(file.read(2).hex(),16)) if cpu_fan != 0: cpu_fan = 478000//cpu_fan @@ -70,6 +79,8 @@ def monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_ color(gpu_cur_temp, lable_g11) lable_m44.config(text = cpu_fan) lable_m55.config(text = gpu_fan) + lable_m444.config(text = str(cpu_fan_s) + "%") + lable_m555.config(text = str(gpu_fan_s) + "%") return def color(temp, lable): @@ -114,13 +125,17 @@ def color(temp, lable): lable_m4.place(x = dpi_scale * 10, y = dpi_scale * 67) lable_m44 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) lable_m44.place(x = dpi_scale * 190, y = dpi_scale * 67) +lable_m444 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +lable_m444.place(x = dpi_scale * 250, y = dpi_scale * 67) lable_m5 = Label(window_m, text = "GPU fan RPM : ", fg = 'white', bg = 'black', font=("Helvetica", 10)) lable_m5.place(x = dpi_scale * 10, y = dpi_scale * 87) lable_m55 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) lable_m55.place(x = dpi_scale * 190, y = dpi_scale * 87) +lable_m555 = Label(window_m, text = "", fg = 'white', bg = 'black', font=("Helvetica", 11)) +lable_m555.place(x = dpi_scale * 250, y = dpi_scale * 87) -monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55) +monitoring_int(lable_c11, lable_c22, lable_c33, lable_g11, lable_g22, lable_g33, lable_m44, lable_m55, lable_m444, lable_m555) def on_closing(): timer.cancel() diff --git a/read_temp_set.py b/read_temp_set.py index 827c3e9..597fd20 100644 --- a/read_temp_set.py +++ b/read_temp_set.py @@ -13,6 +13,8 @@ lines = all_lines[0] + "\n" + all_lines[1] + "\n" + all_lines[2] + "\n" + all_lines[3] + "\n" with open(EC_IO_FILE,'r+b') as file: + file.seek(0xf4) + file.write(bytes((12,))) file.seek(0x6a) lines = lines + str(int(file.read(1).hex(),16)) + "," file.seek(0x6b) @@ -76,4 +78,5 @@ str_1 = str_1 + line conf_file = open(my_filename, "w") conf_file.writelines(str_1) +conf_file.write("\n" + all_lines[6]) conf_file.close() \ No newline at end of file diff --git a/write_EC.py b/write_EC.py index 7bf87a0..c60a682 100644 --- a/write_EC.py +++ b/write_EC.py @@ -9,7 +9,7 @@ conf_file_b = open(my_filename, "r") all_lines = conf_file_b.readlines() mode_f = int(all_lines[0]) -battery_threshold = int(all_lines[3]) + 128 +battery_threshold = int(all_lines[3]) conf_file_b.close() def write_EC(v, battery_threshold): @@ -24,36 +24,36 @@ def write_EC(v, battery_threshold): file.write(bytes((0,))) file.seek(0xf4) file.write(bytes((v[0],))) - file.seek(114) - file.write(bytes((v[1],))) - file.seek(115) - file.write(bytes((v[2],))) - file.seek(116) - file.write(bytes((v[3],))) - file.seek(117) - file.write(bytes((v[4],))) - file.seek(118) - file.write(bytes((v[5],))) - file.seek(119) - file.write(bytes((v[6],))) - file.seek(120) - file.write(bytes((v[7],))) - file.seek(138) - file.write(bytes((v[8],))) - file.seek(139) - file.write(bytes((v[9],))) - file.seek(140) - file.write(bytes((v[10],))) - file.seek(141) - file.write(bytes((v[11],))) - file.seek(142) - file.write(bytes((v[12],))) - file.seek(143) - file.write(bytes((v[13],))) - file.seek(144) - file.write(bytes((v[14],))) - file.seek(239) - file.write(bytes((battery_threshold,))) + file.seek(114) + file.write(bytes((v[1],))) + file.seek(115) + file.write(bytes((v[2],))) + file.seek(116) + file.write(bytes((v[3],))) + file.seek(117) + file.write(bytes((v[4],))) + file.seek(118) + file.write(bytes((v[5],))) + file.seek(119) + file.write(bytes((v[6],))) + file.seek(120) + file.write(bytes((v[7],))) + file.seek(138) + file.write(bytes((v[8],))) + file.seek(139) + file.write(bytes((v[9],))) + file.seek(140) + file.write(bytes((v[10],))) + file.seek(141) + file.write(bytes((v[11],))) + file.seek(142) + file.write(bytes((v[12],))) + file.seek(143) + file.write(bytes((v[13],))) + file.seek(144) + file.write(bytes((v[14],))) + """file.seek(239) + file.write(bytes((battery_threshold)))""" return def get_temp_list(val): @@ -76,13 +76,13 @@ def get_temp_list(val): offset_official = int(all_lines[1]) vr = get_temp_list(5) vr_new = [] - vr_new.append(140) + vr_new.append(76) for i in range(1, 15): if ((vr[i] + offset_official) >= 0) & ((vr[i] + offset_official) <= 100): vr_new.append(vr[i] + offset_official) - if ((vr[i] + offset_official) < 0): + elif ((vr[i] + offset_official) < 0): vr_new.append(0) - if ((vr[i] + offset_official) > 100): + else: vr_new.append(100) write_EC(vr_new, battery_threshold) elif int(mode_f) == 3: