正常パターン

接続時に接続確認を実行し、LED点滅するようにした

接続から切断までおおよそ6秒後半程度かかっている

処理としてはスキャンを実行後、順番に各機器に接続しBLEコマンドの接続確認のコマンドを実行して、切断し次の機器に接続している

ここから処理を増やしていけば多少は時間が延びるだろうが、1分間に6台を回すことができるだろうと思われる

PXL_20220928_183937098_2.mp4

on obniz loop
scan: 6.225s
connect_1804ed3b3b19: 6.750s
connect_1804ed3b3934: 6.763s
connect_1804ed3b664c: 6.652s
connect_1804ed3b3654: 7.267s
connect_1804ed3b3a4a: 6.143
connect_1804ed3b3ee7: 7.012s
program: 46.816s
on obniz loop
scan: 6.234s
connect_1804ed3b3934: 6.955s
connect_1804ed3b3654: 6.753s
connect_1804ed3b3b19: 6.757s
connect_1804ed3b3a4a: 6.657s
connect_1804ed3b3ee7: 6.762s
connect_1804ed3b664c: 6.662s
program: 46.786s
on obniz loop
scan: 6.249s
connect_1804ed3b3934: 6.748s
connect_1804ed3b3b19: 6.651s
connect_1804ed3b3a4a: 6.758s
connect_1804ed3b664c: 6.152s
connect_1804ed3b3ee7: 6.670s
connect_1804ed3b3654: 6.734s
program: 45.966s
on obniz loop
scan: 6.231s
connect_1804ed3b3934: 7.362s
connect_1804ed3b3a4a: 6.867s
connect_1804ed3b3b19: 6.853s
connect_1804ed3b664c: 7.065s
connect_1804ed3b3654: 6.870s
connect_1804ed3b3ee7: 6.859s
program: 48.112s
on obniz loop
scan: 6.221s
connect_1804ed3b3ee7: 6.870s
connect_1804ed3b3a4a: 6.758s
connect_1804ed3b3654: 6.853s
connect_1804ed3b664c: 6.655s
connect_1804ed3b3934: 6.757s
connect_1804ed3b3b19: 6.759s
program: 46.877s
on obniz loop
scan: 6.231s
connect_1804ed3b664c: 6.643s
connect_1804ed3b3b19: 6.758s
connect_1804ed3b3a4a: 6.758s
connect_1804ed3b3654: 6.697s
connect_1804ed3b3934: 6.614s
connect_1804ed3b3ee7: 6.867s
program: 46.5

接続時の処理改善

on obniz loop
scan: 6.243s
connect_1804ed3b664c: 3.058s
connect_1804ed3b3b19: 2.251s
connect_1804ed3b3654: 1.945s
connect_1804ed3b3ee7: 2.084s
connect_1804ed3b3a4a: 2.011s
connect_1804ed3b3934: 2.257s
program: 19.854s
on obniz loop
scan: 6.213s
connect_1804ed3b3ee7: 2.134s
connect_1804ed3b664c: 2.047s
connect_1804ed3b3b19: 2.085s
connect_1804ed3b3654: 2.011s
connect_1804ed3b3a4a: 2.048s
connect_1804ed3b3934: 1.843s
program: 18.383s
on obniz loop
scan: 6.217s
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 146,
  result: 'ok',
  data: [
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 128,
  result: 'ok',
  data: [
    3, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
data.data[0] 3
monitor
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 169,
  result: 'ok',
  data: [
    30, 60, 10, 60, 0, 0,
     0,  0,  0,  0, 0, 0,
     0,  0,  0,  0
  ]
}
{
  effectiveInstantFlowRate: 30,
  finishJudgmentSec: 60,
  effectiveIntegratedFlowRate: 10,
  powerOffSec: 60
}
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 168,
  result: 'ok',
  data: [
    20, 0, 244, 1, 250, 0,
     0, 0,   0, 0,   0, 0,
     0, 0,   0, 0
  ]
}
{
  infusionDropCount: 20,
  targetSumFlowRate: 500,
  targetFlowRate: 250,
  correctionFactor: 0
}
writeCommandWait data Uint8Array(1) [ 1 ]
writeCommandWait array Uint8Array(17) [
  1, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 161,
  result: 'ok',
  data: [
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
notifyData {
  commandId: 160,
  result: 'ok',
  data: [
     70, 1,   0,  0, 85, 31,
      0, 0, 226,  0, 16,  0,
    179, 0, 147, 15
  ]
}
writeCommandWait data Uint8Array(1) [ 0 ]
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
Pulse Data {"sequenceNumber":326,"pulse":3925,"status":0,"error":{"outRange":false,"changeSetting":false,"overSumFlow":false,"lowInstantFlow":false,"highInstantFlow":false,"shutdownBattery":false,"lowBatt
ery":false,"isError":false},"instantFlowRate":226,"sumFlowRate":16,"averageFlowRate":179,"batteryVoltage":3987}
notifyData {
  commandId: 161,
  result: 'ok',
  data: [
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
{
  sequenceNumber: 326,
  pulse: 3925,
  status: 0,
  error: {
    outRange: false,
    changeSetting: false,
    overSumFlow: false,
    lowInstantFlow: false,
    highInstantFlow: false,
    shutdownBattery: false,
    lowBattery: false,
    isError: false
  },
  instantFlowRate: 226,
  sumFlowRate: 16,
  averageFlowRate: 179,
  batteryVoltage: 3987
}
connect_1804ed3b3654: 3.169s
program: 9.387s
on obniz loop
scan: 6.630s
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 146,
  result: 'ok',
  data: [
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 128,
  result: 'ok',
  data: [
    3, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
data.data[0] 3
monitor
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 169,
  result: 'ok',
  data: [
    30, 60, 10, 60, 0, 0,
     0,  0,  0,  0, 0, 0,
     0,  0,  0,  0
  ]
}
{
  effectiveInstantFlowRate: 30,
  finishJudgmentSec: 60,
  effectiveIntegratedFlowRate: 10,
  powerOffSec: 60
}
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 168,
  result: 'ok',
  data: [
    20, 0, 244, 1, 250, 0,
     0, 0,   0, 0,   0, 0,
     0, 0,   0, 0
  ]
}
{
  infusionDropCount: 20,
  targetSumFlowRate: 500,
  targetFlowRate: 250,
  correctionFactor: 0
}
writeCommandWait data Uint8Array(1) [ 1 ]
writeCommandWait array Uint8Array(17) [
  1, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
notifyData {
  commandId: 161,
  result: 'ok',
  data: [
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
notifyData {
  commandId: 160,
  result: 'ok',
  data: [
     13,  5,   0,  0, 252, 11,
      0, 12,  57,  2,  65,  0,
    209,  0, 141, 15
  ]
}
writeCommandWait data Uint8Array(1) [ 0 ]
writeCommandWait array Uint8Array(17) [
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,
  0, 0, 0
]
Pulse Data {"sequenceNumber":1293,"pulse":3068,"status":0,"error":{"outRange":false,"changeSetting":false,"overSumFlow":false,"lowInstantFlow":false,"highInstantFlow":false,"shutdownBattery":false,"lowBat
tery":false,"isError":false},"instantFlowRate":569,"sumFlowRate":65,"averageFlowRate":209,"batteryVoltage":3981}
notifyData {
  commandId: 161,
  result: 'ok',
  data: [
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0,
    0, 0, 0, 0
  ]
}
{
  sequenceNumber: 1293,
  pulse: 3068,
  status: 0,
  error: {
    outRange: false,
    changeSetting: false,
    overSumFlow: false,
    lowInstantFlow: false,
    highInstantFlow: false,
    shutdownBattery: false,
    lowBattery: false,
    isError: false
  },
  instantFlowRate: 569,
  sumFlowRate: 65,
  averageFlowRate: 209,
  batteryVoltage: 3981
}
connect_1804ed3b3654: 3.105s
program: 9.736s
on obniz loop
scan: 6.241s
monitor
{
  effectiveInstantFlowRate: 30,
  finishJudgmentSec: 60,
  effectiveIntegratedFlowRate: 10,
  powerOffSec: 60
}

{
  infusionDropCount: 20,
  targetSumFlowRate: 500,
  targetFlowRate: 250,
  correctionFactor: 0
}

2022-10-02T02:03:01.000Z

{
  movingAverage: 30,
  lowVoltage: 3400,
  shutdownVoltage: 3300,
  offsetSec: 0
}
true

{
  sequenceNumber: 3288,
  pulse: 141,
  status: 8,
  error: {
    outRange: false,
    changeSetting: false,
    overSumFlow: false,
    lowInstantFlow: true,
    highInstantFlow: false,
    shutdownBattery: false,
    lowBattery: false,
    isError: true
  },
  instantFlowRate: 87,
  sumFlowRate: 164,
  averageFlowRate: 113,
  batteryVoltage: 3921
}
connect_1804ed3b3654: 5.627s
program: 11.869s
on obniz loop
scan: 6.273s
monitor

{
  effectiveInstantFlowRate: 40,
  finishJudgmentSec: 50,
  effectiveIntegratedFlowRate: 20,
  powerOffSec: 120
}

{
  infusionDropCount: 30,
  targetSumFlowRate: 400,
  targetFlowRate: 200,
  correctionFactor: 10
}

2022-10-02T02:23:00.000Z
{
  movingAverage: 20,
  lowVoltage: 3500,
  shutdownVoltage: 3400,
  offsetSec: 1
}

false
{
  sequenceNumber: 3856,
  pulse: 1185,
  status: 8,
  error: {
    outRange: false,
    changeSetting: false,
    overSumFlow: false,
    lowInstantFlow: true,
    highInstantFlow: false,
    shutdownBattery: false,
    lowBattery: false,
    isError: true
  },
  instantFlowRate: 83,
  sumFlowRate: 193,
  averageFlowRate: 108,
  batteryVoltage: 3909
}
connect_1804ed3b3654: 6.956s
program: 13.231s

デバイスが電源切れたパターン