Hi, I have a relatively simple program where I am creating a custom menu with two user-adjustable options followed by an 'Apply' option using MenuRecompile(). My problem is that when I make a change, then select 'Apply', the program appears to recompile successfully, but then reverts to the default settings in my constant table declaration. Oddly, if I make a change in the regular constant table, the recompile is successful and the new values are used. Any thoughts as to what I am missing?
'CR800 Series
'Declare Variables and Units
Public BattV
Public TRHData(2)
Public SEVolt(4)
Public rTime(9)
Public doy_frac
Public plot
Public recomp
Public lognum
Public logbut
Const No=False
Const Yes=True
ConstTable
Const logfreq=5
Const logtime=30
EndConstTable
Alias TRHData(1)=cmb_temp
Alias TRHData(2)=cmb_rh
Alias SEVolt(1)=co2
Alias SEVolt(2)=press
Alias SEVolt(3)=flow
Alias SEVolt(4)=par
Alias rTime(1)=year
Alias rTime(9)=doy
Alias rTime(4)=hour
Alias rTime(5)=minute
Alias rTime(6)=second
Units BattV=Volts
Units cmb_temp=Deg C
Units cmb_rh=%
Units co2=ppm
Units press=kPa
Units flow=mV
Units par=umol/m2s
'Define Data Tables
DataTable(Soilflux,1,-1)
DataInterval(0,logfreq,sec,10)
Sample(1,plot,FP2)
Sample(1,lognum,FP2)
Sample(1,year,FP2)
Sample(1,doy,FP2)
Sample(1,hour,FP2)
Sample(1,minute,FP2)
Sample(1,second,FP2)
Sample(1,doy_frac,IEEE4)
Sample(1,co2,FP2)
Sample(1,flow,FP2)
Sample(1,press,FP2)
Sample(1,cmb_temp,FP2)
Sample(1,cmb_rh,FP2)
Sample(1,par,FP2)
Sample(1,BattV,FP2)
EndTable
'define custom menu
DisplayMenu("Soil Flux",-2)
MenuItem("Plot", plot)
DisplayValue("CO2", co2)
DisplayValue("Cham TC",cmb_temp)
DisplayValue("Chamb RH%", cmb_rh)
DisplayValue("Log", lognum)
SubMenu("Other Data ")
DisplayValue("Flow", flow)
DisplayValue("PAR", par)
DisplayValue("Batt volt", BattV)
EndSubMenu
SubMenu("Settings ")
MenuItem("Log Freq(s)",logfreq)
MenuPick(1,2,5,10,30,60)
MenuItem("Log Time(s)",logtime)
MenuPick(30,60,90,120,180,240)
MenuRecompile("Apply", recomp)
MenuPick(Yes, No)
EndSubMenu
EndMenu
'Main Program
BeginProg
Do While TRUE
Scan(1,Sec,1,0)
RealTime(rTime)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
'CS215 Temperature & Relative Humidity Sensor measurements cmb_temp and cmb_rh
SDI12Recorder(TRHData(),3,"0","M!",1,0)
'Generic Single-Ended Voltage measurements SEVolt()
VoltSe(SEVolt(),4,mV5000,1,True,0,_60Hz,1,0)
'log button
PulseCount(logbut,1,1,2,0,1,0)
'calculatev values'
co2=1000*(co2/5000)
press=100*(press/5000)
par=par*0.5
doy_frac=doy+(hour/24)+(minute/1440)+(second/86400)
if logbut>0 Then ExitScan
NextScan
Scan(logfreq,sec,1,0)
RealTime(rTime)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
'CS215 Temperature & Relative Humidity Sensor measurements cmb_temp and cmb_rh
SDI12Recorder(TRHData(),3,"0","M!",1,0)
'Generic Single-Ended Voltage measurements SEVolt()
VoltSe(SEVolt(),4,mV5000,1,True,0,_60Hz,1,0)
'calculatev values'
co2=1000*(co2/5000)
press=100*(press/5000)
par=par*0.5
doy_frac=doy+(hour/24)+(minute/1440)+(second/86400)
lognum=lognum+1
'Call Data Tables and Store Data
CallTable(Soilflux)
If lognum=logtime/logfreq Then
lognum=0
logbut=0
ExitScan
EndIf
NextScan
Loop
EndProg
I think you should change every MenuPick with the following:
'define custom menu
DisplayMenu("Soil Flux",-2)
MenuItem("Plot", plot)
DisplayValue("CO2", co2)
DisplayValue("Cham TC",cmb_temp)
DisplayValue("Chamb RH%", cmb_rh)
DisplayValue("Log", lognum)
SubMenu("Other Data ")
DisplayValue("Flow", flow)
DisplayValue("PAR", par)
DisplayValue("Batt volt", BattV)
EndSubMenu
SubMenu("Settings ")
MenuItem("Log Freq(s)",logfreq)
MenuPick(logfreq,1,2,5,10,30,60)
MenuItem("Log Time(s)",logtime)
MenuPick(logtime,30,60,90,120,180,240)
MenuRecompile("Apply", recomp)
MenuPick(Yes, No)
EndSubMenu
EndMenu
* Last updated by: thonerga on 10/30/2014 @ 1:11 AM *