This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def saveSensor(self, getDat, datMc): | |
ret=False | |
clsConst = com_appConst.appConstClass() | |
connection = MySQLdb.connect(host=clsConst.mHost, db=clsConst.mDB_NAME, user=clsConst.mUser, passwd=clsConst.mPass, charset="utf8") | |
if(datMc["vnum_1"]==1): | |
cursor = connection.cursor() | |
sSql=u"INSERT INTO t_sensors (mc_id" | |
sSql=sSql+",vnum" | |
sSql=sSql+",snum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @return TRUE: opne-Valve | |
def Is_validValve(self, iSen , iMoi): | |
clsConst = com_appConst.appConstClass() | |
ret=clsConst.mNG_CODE | |
if(iMoi > iSen ): | |
ret=clsConst.mOK_CODE | |
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getResponse(self, dicGet , dicMst): | |
ret ="000000000000000000000000" | |
ret2="" | |
k_flg_1=self.Is_validValve( int(dicGet["snum_1"]) ,dicMst["moi_num"]) | |
k_flg_2=self.Is_validValve( int(dicGet["snum_2"]) ,dicMst["moi_num"]) | |
k_flg_3=self.Is_validValve( int(dicGet["snum_3"]) ,dicMst["moi_num"]) | |
k_flg_4=self.Is_validValve( int(dicGet["snum_4"]) ,dicMst["moi_num"]) | |
sMoi= self.getZero_byNum(str(dicMst["moi_num"]) ,4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int iSen =0; | |
int iSen2 =0; | |
int iSen3 =0; | |
int iSen4 =0; | |
float fSen = inSen1; | |
float fSen2 = inSen2; | |
float fSen3 = inSen3; | |
float fSen4 = inSen4; | |
iSen = int(fSen * 1000); | |
iSen2 = int(fSen2 * 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( mPc.readable()) { | |
char c= mPc.getc(); | |
mResponse3+= c; | |
}else{ | |
if(mResponse3.length() > 31){ | |
printf("==== response ==== \n"); | |
string sRes4 = mResponse3.substr(8); | |
printf("%s\n" ,sRes4.c_str() ); | |
mResponse3=""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char buff[]="0000"; | |
sprintf(buff, "%d", mCtOpen); | |
printf("valve-open=%s\n" , buff); | |
if(mCtOpen >= mValveGet){ | |
outRelary_1=0; | |
outRelary_2=0; | |
outRelary_3=0; | |
outRelary_4=0; | |
mResponse3=""; | |
mSTAT = mSTAT_CONECT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int iSen =0; | |
int iSen2=0; | |
int iSen3=0; | |
int iSen4=0; | |
iSen =analogRead(SENSOR); | |
iSen2 =analogRead(SENSOR_1); | |
iSen3 =analogRead(SENSOR_2); | |
iSen4 =analogRead(SENSOR_3); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_master(self, sId ): | |
ret={} | |
clsConst = com_appConst.appConstClass() | |
headers = { | |
"X-Parse-Application-Id": clsConst.mParse_APP_ID , | |
"X-Parse-REST-API-Key": clsConst.mParse_REST_ID , | |
"Content-Type": "application/json" | |
} | |
dtParam = {'mc_id': int(sId) }; | |
params = urllib.urlencode({"where":json.dumps(dtParam)}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MasterApp.prototype.update_master = function ( className , sid) { | |
var parent_app=this; | |
var GameScore = Parse.Object.extend(className); | |
var master = new GameScore(); | |
master.set("id", sid); | |
var sMoi= $('input#txt_moi_num').val(); | |
var sKnum= $('input#txt_kai_num_1').val(); | |
var vnum1= $('#txt_vnum_1').val(); | |
var vnum2= $('#txt_vnum_2').val(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main | |
int main() { | |
mPc.baud( 115200 ); | |
mSTAT = mSTAT_CONECT; | |
mTimer.start(); | |
while(1) { | |
float sec= mTimer.read(); | |
if(mSTAT == mSTAT_CONECT){ | |
if(sec >= mTmMax){ |