<commit_before>__author__ = 'bmasquelier'
#
# Python script for Arduidom communication
#

import serial
import thread
from socket import *
import time
import subprocess

VIOLET = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
data = ""
pin1 = ""
oldpin1 = "x"
pinvalue = ["x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", ".", "xxx", "xxx", "xxx", "xxx", "xxx"]
pinmode = ["z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", ".", "z", "z", "z", "z", "z", "z"]
oldpinvalue = ["y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y"]
count = 1
arduino_rx = "aaa"
currentline = 99
radiorxpin = 0

def print_time(threadName, delay):
    global pinvalue
    global oldpinvalue
    global pinmode
    global count
    global arduino_rx
    while True:
        time.sleep(delay)
        count += 1
        if (count > 2):
            count = 1
            print("Send $$RF to Arduino")
            arduino_rx = ""
            ArduinoPort.write("$$RF")
            while (arduino_rx == ""):
                time.sleep(0.01)

            print("arduino_rx=" + arduino_rx)
            pinvalue = arduino_rx.rsplit(',')

        print VIOLET + "%s: %s" % ( threadName, time.ctime(time.time()) )
        print "          D00  D01  D02  D03  D04  D05  D06  D07  D08  D09  D10  D11  D12  D13   x    A0     A1     A2     A3     A4     A5"
        print "pinvalue=" + str(pinvalue)
        if (oldpinvalue != pinvalue):
            for pinnumber in range(0, 15):
                cmd = 'nice -n 19 /usr/bin/php /usr/share/nginx/www/jeedom/plugins/arduidom/core/php/jeeArduidom.php '
                cmd += str(pinnumber)
                cmd += "="
                cmd += pinvalue[pinnumber]
                print(RED + cmd)

        oldpinvalue = pinvalue
        print " pinmode=" + str(pinmode)<commit_msg>py optimisation de l'envoi php<commit_after>__author__ = 'bmasquelier'
#
# Python script for Arduidom communication
#

import serial
import thread
from socket import *
import time
import subprocess

VIOLET = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
data = ""
pin1 = ""
oldpin1 = "x"
pinvalue = ["x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", ".", "xxx", "xxx", "xxx", "xxx", "xxx"]
pinmode = ["z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z", ".", "z", "z", "z", "z", "z", "z"]
oldpinvalue = ["y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y"]
count = 1
arduino_rx = "aaa"
currentline = 99
radiorxpin = 0

def print_time(threadName, delay):
    global pinvalue
    global oldpinvalue
    global pinmode
    global count
    global arduino_rx
    while True:
        time.sleep(delay)
        count += 1
        if (count > 2):
            count = 1
            print("Send $$RF to Arduino")
            arduino_rx = ""
            ArduinoPort.write("$$RF")
            while (arduino_rx == ""):
                time.sleep(0.01)

            print("arduino_rx=" + arduino_rx)
            pinvalue = arduino_rx.rsplit(',')

        print VIOLET + "%s: %s" % ( threadName, time.ctime(time.time()) )
        print "          D00  D01  D02  D03  D04  D05  D06  D07  D08  D09  D10  D11  D12  D13   x    A0     A1     A2     A3     A4     A5"
        print "pinvalue=" + str(pinvalue)
        if (oldpinvalue != pinvalue):
            cmd = 'nice -n 19 /usr/bin/php /usr/share/nginx/www/jeedom/plugins/arduidom/core/php/jeeArduidom.php '
            for pinnumber in range(0, 20):
                if (pinnumber != 14):
                    cmd += str(pinnumber)
                    cmd += "="
                    cmd += pinvalue[pinnumber]
                    cmd += " "
            print(RED + cmd)

        oldpinvalue = pinvalue
        print " pinmode=" + str(pinmode)
{'fraction_non_alphanumeric': 0.1918158567774936, 'fraction_numerical': 0.03938618925831202, 'mean_word_length': 2.0530835284933646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1761206', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1478, 'n_words': 397}