dofile("./System/config.lua")
pi = pi
red=Color.new(255,0,0)
green=Color.new(0,255,0)
select=1
select1=red
select2=red
select3=red
disp=disp
oldpad=Controls.read()
while true do
pad=Controls.read()
screen:clear()

if pad:up() and pad:up() ~= oldpad:up() then
	select=select-1

end
if pad:down() and pad:down() ~= oldpad:down() then
	select=select+1
end

if select>3 then
select=1
end
if select<1 then
select=3
end
if select==1 then
select1=green
else
select1=red
end
if select==2 then
	select2=green
	else
	select2=red
end
if select==3 then
select3=green
else
select3=red
end
if select==1 and pad:cross() and pad:cross()~=oldpad:cross() then
	if pi==3.14 then
		pi=math.pi
	else
		pi=3.14
	end
end
if select==2 and pad:cross() and pad:cross() ~= oldpad:cross() then
if disp=="true" then
disp="false"
else
disp="true" 
end
end
if select==3 and pad:cross() and pad:cross() ~= oldpad:cross() then
	config=io.open("./System/config.lua","w")
	screen:print(0,0,"Saving...",Color.new(0,0,255))
	config:write("pi=" .. pi .. "\ndisp=" .. disp)
	config:close()
end
if pad:start() then
	dofile("./System/menu.lua")
	break;
end
screen:print(0,100,"Pi=" .. pi,select1)
if disp==true then
screen:print(0,120,"BatterySaving?=true",select2)
else
screen:print(0,120,"BatterySaveing?=false",select2)
end
screen:print(0,140,"save settings",select3)
screen.waitVblankStart()
screen.flip()
oldpad=pad
end
