24 lines
553 B
Python
24 lines
553 B
Python
import numpy as np
|
|
from multiprocessing import shared_memory
|
|
import time
|
|
import json
|
|
import argparse
|
|
|
|
|
|
existing_shm = shared_memory.SharedMemory(name="DO-shm")
|
|
|
|
c = np.ndarray((64,), dtype=np.int32, buffer=existing_shm.buf)
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-config',help='')
|
|
args = parser.parse_args()
|
|
|
|
ROOT_PATH = f"/usr/local/sdt/app/{args.config}"
|
|
|
|
while True:
|
|
with open(f"{ROOT_PATH}/config.json", 'r') as file:
|
|
jsonData = json.load(file)
|
|
for n in range(64):
|
|
c[n]=jsonData[str(n+1)]
|
|
time.sleep(2)
|