请选择 进入手机版 | 继续访问电脑版

MiniDSO产品技术交流  迷你示波器-袖珍示波器-示波器探头-

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2728|回复: 7

[The 3rd party resources] Tetris for TS100, scripting system and more!

[复制链接]

1

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
发表于 2017-7-9 10:59:04 | 显示全部楼层 |阅读模式
Wrote Tetris for TS100: https://github.com/joric/ts100tris
There's also a scripting branch I just started and I'm currently trying to figure out how to implement screen autorotation. I need some help with an accelerometer - it seems that coordinates other than X don't change at all (Y and Z are static in 2.17), also there's a problem how to differentiate left and right tilt. I think there's a bug in the accelerometer handling code. Has anyone managed to get proper 3d values from it? Also I know I can switch between screen orientations in the menu but I'd love to see the accelerometer-driven autorotation feature in the stock firmware, will it ever be rolled out? Thanks.

回复

使用道具 举报

1

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
 楼主| 发表于 2017-7-9 22:57:28 | 显示全部楼层
[i = s] posts by joric in 2017-7-9 23:40 Edit

[i = s] posts by joric in 2017-7-9 23:13 Edit  

Found accelerometer mod that correcly shows all three coordinates (replace stock MMA8652FC.* with its ones): Firmware of TS100 single button operation(accelerated sensors application). Looks like tilt can be determined using its Get_XYZDrt function, e.g. own_sprintf(str,"%d %d %d", Get_XYZDrt(AXIS_X), Get_XYZDrt(AXIS_Y), Get_XYZDrt(AXIS_Z)) shows "1 1 0" with left tilt and "1 0 0" with right tilt. I suggest adding these accelerometer fixes in the next firmware release. I've personally got a working screen autorotation in this branch: https://github.com/joric/ts100tris/tree/autorotate
回复 支持 反对

使用道具 举报

1

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
 楼主| 发表于 2017-7-10 01:05:24 | 显示全部楼层
After examination looks like all the difference is riight here:

  1. @@ -170,8 +185,8 @@
  2.                  gY_value.Byte.lo = value[3];
  3.                  gZ_value.Byte.hi = value[4];
  4.                  gZ_value.Byte.lo = value[5];
  5. -                return 1;
  6.              }
  7. +            return 1;
  8.          } else
  9.              return 0;
  10.      }
复制代码


This teeny tiny change enables all the 3 dimensions. There's no change in initialization or the reading sequence, just that. I guess someone has broken it by mistake a long while ago.
回复 支持 反对

使用道具 举报

1

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
 楼主| 发表于 2017-7-10 01:18:01 | 显示全部楼层
Forgot to add, axis direction (e.g. Y) can be obtained as "return gY_value.Byte.hi>0x7f ? 1:0;" The mod above uses it as a separate function but the stock firmware just ditches it. I guess it would be much more convenient to work with signed values but ofc it's up to Celery@minidso.
回复 支持 反对

使用道具 举报

0

主题

35

帖子

45

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
45
发表于 2017-7-11 11:03:55 | 显示全部楼层
You're very creative!  The (x, y) coordinates that are being obtained are to determine whether or not to move it, so the value that you get is just an approximate, it's not exactly a 3d value.
回复 支持 反对

使用道具 举报

0

主题

35

帖子

45

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
45
发表于 2017-7-11 11:12:23 | 显示全部楼层
joric 发表于 2017-7-10 01:18
Forgot to add, axis direction (e.g. Y) can be obtained as "return gY_value.Byte.hi>0x7f ? 1:0;" The  ...

Well, it's something that can be tried by approximations.
Some processing is done through the coordinates to determine whether to move left or right.
回复 支持 反对

使用道具 举报

1

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
 楼主| 发表于 2017-7-11 12:05:10 | 显示全部楼层
Not when someone has deliberately removed the sign from the number, no. There's no possible way to determine if you touched the zero and turned back right after or crossed the zero and went to the other side. Aanyway, there's no need to guess because signs are obtainable it's just API that's shitty.
回复 支持 反对

使用道具 举报

0

主题

35

帖子

45

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
45
发表于 2017-7-11 15:21:17 | 显示全部楼层
The acceleration sensor model is MMA8652FC
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|MiniDSO产品技术交流 迷你示波器-袖珍示波器-示波器探头- ( 粤ICP备07030012号 )

GMT+8, 2019-11-22 18:00 , Processed in 0.223727 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表