-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodeline.py
executable file
·31 lines (24 loc) · 1.11 KB
/
modeline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# (should work on either Python 2 or Python 3)
# Modeline for old PC connected to Philips 192EL2 monitor
freq_khz = 47.71 # from the monitor spec
hres = 680 # from the 1366 spec, /2 and round to mult of 8 for VGA
rhs_margin = 40 # found by trial and error
sync_len = 72 # xtimings standard
lhs_margin = 104 # found by trial and error
vres = 384 # from the 768 spec, /2
btm_margin = 8 # xtimings standard
vsync_len = 4 # xtimings standard
top_margin = 8 # xtimings standard
total_hpx = hres+rhs_margin+sync_len+lhs_margin
clock_mhz = freq_khz*1000*total_hpx/1000000
print ('Modeline "%dx%d" %.2f %d %d %d %d %d %d %d %d doublescan' % (hres,vres,
clock_mhz,
hres, hres+rhs_margin, hres+rhs_margin+sync_len, total_hpx,
vres, vres+btm_margin, vres+btm_margin+vsync_len, vres+btm_margin+vsync_len+top_margin))
# Where to find history:
# on GitHub at https://github.com/ssb22/config
# and on GitLab at https://gitlab.com/ssb22/config
# and on BitBucket https://bitbucket.org/ssb22/config
# and at https://gitlab.developers.cam.ac.uk/ssb22/config
# and in China: https://gitee.com/ssb22/config