<commit_before>#!/usr/bin/python
import time
import sys
import socket
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import cwiid
import json

tdelay = 0.2
DEBUG = 0
ACC_DEBUG = 0
BUT_DEBUG = 0
FLX_DEBUG = 0
PRC_DEBUG = 0
PNG_DEBUG = 0
NET_DEBUG = 0
ACT_DEBUG = 0
NETWORK = 1
PINGTIMEOUT = 1
HOMENET = 0
ACTIONS = []
ALLOWED_KEYS = []
action_idx = 0
thingactionfile = "/home/pi/pimeup/thingbox/thingactions.json"


try:
    chknet = sys.argv[1]
    print("Chknet: %s" % chknet)
    if int(chknet) == 2: # No network command line interface
        NETWORK = 0
    elif int(chknet) == 1:  # Use home net ip of 192.168.0.130
        HOMENET = 1
    else:
        NETWORK = 1
except:
    NETWORK = 1


if HOMENET == 1:
    UDP_IP = '192.168.0.130'
else:
    UDP_IP = '192.168.1.110'

UDP_PORT = 30000
UDP_SOCK = None



#SHOWLIST = [ "WristFlex", "WristTurn", "Pinky", "Ring", "Middle", "Index", "Thumb" ]
SHOWLIST = [ "Ring" ] 
# Defaults:
mysens_thres = 2
mychng_thres = 5
# Used for Testing:
tmpsens_thres = 2
tmpchng_thres = 10

roundval = 2
tmproundval = 3
# Hardware SPI configuration: (Do not Modify)
####################
SPI_PORT   = 0
SPI_DEVICE = 0
mcp = Adafruit_MCP3008.MCP3008(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE))
####################


STATUS = ""
SENSORS = [
    {"NAME": "Pinky", "TYPE": "adc", "REMOTE": 4, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 4},
    {"NAME": "Ring", "TYPE": "adc", "REMOTE": 3, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 4},
    {"NAME": "Middle", "TYPE": "adc", "REMOTE": 2, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 4},
    {"NAME": "Index", "TYPE": "adc", "REMOTE": 1, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 4},
    {"NAME": "Thumb", "TYPE": "adc", "REMOTE": 0, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 4},
    {"NAME": "WristFlex", "TYPE": "acc", "REMOTE": 5, "MIN": 1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": 3, "CHNG_THRES": mychng_thres, "INVERT": True, "ROUNDVAL": roundval, "ADJVAL": 0},<commit_msg>Updated actions and speed of rotation<commit_after>#!/usr/bin/python
import time
import sys
import socket
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import cwiid
import json

tdelay = 0.2
DEBUG = 0
ACC_DEBUG = 0
BUT_DEBUG = 0
FLX_DEBUG = 0
PRC_DEBUG = 0
PNG_DEBUG = 0
NET_DEBUG = 1
ACT_DEBUG = 0
NETWORK = 1
PINGTIMEOUT = 1
HOMENET = 0
ACTIONS = []
ALLOWED_KEYS = []
action_idx = 0
thingactionfile = "/home/pi/pimeup/thingbox/thingactions.json"


try:
    chknet = sys.argv[1]
    print("Chknet: %s" % chknet)
    if int(chknet) == 2: # No network command line interface
        NETWORK = 0
    elif int(chknet) == 1:  # Use home net ip of 192.168.0.130
        HOMENET = 1
    else:
        NETWORK = 1
except:
    NETWORK = 1


if HOMENET == 1:
    UDP_IP = '192.168.0.130'
else:
    UDP_IP = '192.168.1.110'

UDP_PORT = 30000
UDP_SOCK = None



#SHOWLIST = [ "WristFlex", "WristTurn", "Pinky", "Ring", "Middle", "Index", "Thumb" ]
SHOWLIST = [ "Ring", "Middle" ] 
# Defaults:
mysens_thres = 2
mychng_thres = 2
# Used for Testing:
tmpsens_thres = 2
tmpchng_thres = 10

roundval = 2
tmproundval = 3
# Hardware SPI configuration: (Do not Modify)
####################
SPI_PORT   = 0
SPI_DEVICE = 0
mcp = Adafruit_MCP3008.MCP3008(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE))
####################


STATUS = ""
SENSORS = [
    {"NAME": "Pinky", "TYPE": "adc", "REMOTE": 4, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 2},
    {"NAME": "Ring", "TYPE": "adc", "REMOTE": 3, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 2},
    {"NAME": "Middle", "TYPE": "adc", "REMOTE": 2, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 2},
    {"NAME": "Index", "TYPE": "adc", "REMOTE": 1, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 2},
    {"NAME": "Thumb", "TYPE": "adc", "REMOTE": 0, "MIN":1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": mysens_thres, "CHNG_THRES": mychng_thres, "INVERT": False, "ROUNDVAL": roundval, "ADJVAL": 2},
    {"NAME": "WristFlex", "TYPE": "acc", "REMOTE": 5, "MIN": 1000, "MAX": 0, "CHANGES":0, "LAST": 0, "CHANGED": False, "SENS_THRES": 3, "CHNG_THRES": mychng_thres, "INVERT": True, "ROUNDVAL": roundval, "ADJVAL": 0},
{'fraction_non_alphanumeric': 0.20367563471011746, 'fraction_numerical': 0.050397877984084884, 'mean_word_length': 4.782037239868565, 'pattern_counts': {'":': 156, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '482908', 'n_tokens_mistral': 2504, 'n_tokens_neox': 2224, 'n_words': 561}