options parameter
This commit is contained in:
parent
663a79baef
commit
0ef549a6b1
|
@ -39,21 +39,21 @@ function generate_message(buffer)
|
|||
local t_conv = convert_joules(t_raw)
|
||||
|
||||
-- format and align fill values
|
||||
message_aligned(buffer, 'Fill....:', format_percent(p_raw), system.width)
|
||||
message_aligned(buffer, 'Fill....:', format_energy(c_conv), system.width)
|
||||
message_aligned(buffer, 'Fill....:', format_percent(options, p_raw), system.width)
|
||||
message_aligned(buffer, 'Fill....:', format_energy(options, c_conv), system.width)
|
||||
|
||||
-- format and align capacity
|
||||
message(buffer, '\n')
|
||||
message_aligned(buffer, 'Capacity:', format_energy(m_conv), system.width)
|
||||
message_aligned(buffer, 'Capacity:', format_energy(options, m_conv), system.width)
|
||||
|
||||
-- format and align i/o values
|
||||
message(buffer, '\n') message(buffer, '\n')
|
||||
message_aligned(buffer, 'Input...:', format_energy(i_conv, true), system.width)
|
||||
message_aligned(buffer, 'Output..:', format_energy(o_conv, true), system.width)
|
||||
message_aligned(buffer, 'Input...:', format_energy(options, i_conv, true), system.width)
|
||||
message_aligned(buffer, 'Output..:', format_energy(options, o_conv, true), system.width)
|
||||
|
||||
-- format and align transfer
|
||||
message(buffer, '\n')
|
||||
message_aligned(buffer, 'Transfer:', format_energy(t_conv, true), system.width)
|
||||
message_aligned(buffer, 'Transfer:', format_energy(options, t_conv, true), system.width)
|
||||
end
|
||||
|
||||
function send_info()
|
||||
|
|
|
@ -26,7 +26,7 @@ function compact_number(number)
|
|||
end
|
||||
|
||||
-- format number with energy (/transfer) units
|
||||
function format_energy(number, transfer)
|
||||
function format_energy(options, number, transfer)
|
||||
local energy = tostring(number)
|
||||
|
||||
-- compact number
|
||||
|
@ -45,7 +45,7 @@ function format_energy(number, transfer)
|
|||
end
|
||||
|
||||
-- format percentages as number with two decimals and padded unit
|
||||
function format_percent(number)
|
||||
function format_percent(options, number)
|
||||
return string.format('%.2f', number * 100) .. ' % ' .. string.rep(' ', #options.unit)
|
||||
end
|
||||
|
||||
|
@ -99,7 +99,7 @@ function init_modem(options, system)
|
|||
|
||||
term.setCursorPos(1, 6)
|
||||
print('\nTry #' .. count)
|
||||
print('Trying channel ' .. channel .. string.rep(' ', #tostring(1+options.channels)))
|
||||
print('Trying channel ' .. channel .. string.rep(' ', #tostring(1 + options.channels)))
|
||||
-- increment try-counter
|
||||
count = count + 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user