Search found 5956 matches

by pythoncoder
Tue Jun 28, 2016 10:29 am
Forum: General Discussion and Questions
Topic: Bitwise Assignment Operator
Replies: 22
Views: 17922

Re: Bitwise Assignment Operator

That was the mechanism I had in mind in my post of 23rd June, albeit applied to a class not subclassed from int. Subclassing from built-in types is only partially supported in MicroPython https://github.com/micropython/micropython/wiki/Differences so it's questionable whether Guido's approach would ...
by pythoncoder
Sun Jun 26, 2016 6:57 am
Forum: WiPy and CC3200 boards
Topic: DAQ Trigger Setup and Control
Replies: 7
Views: 8194

Re: DAQ Trigger Setup and Control

I'm no expert on the WiPy so I can't answer your main point, but the circular buffer in _addData_ looks wrong to me. Try this:

Code: Select all

curPos = 0
def _addData_(timer):
	global curPos
	dataArray[curPos] = adcPin()
	curPos += 1 # fix modular arithmetic
	curPos %= numPnts
by pythoncoder
Fri Jun 24, 2016 3:53 pm
Forum: Programs, Libraries and Tools
Topic: Astral port/alternative
Replies: 7
Views: 9141

Re: Astral port/alternative

Looking at my code again it was originally ported from Javascript. The original source website has disappeared into /dev/null but I've put a copy here http://hinch.me.uk/riset.html . You can run the code to check the results of your port. Also if you examine the Javascript you'll see code for civil,...
by pythoncoder
Fri Jun 24, 2016 7:29 am
Forum: Programs, Libraries and Tools
Topic: Astral port/alternative
Replies: 7
Views: 9141

Re: Astral port/alternative

@patvdleer I've posted it here http://hinch.me.uk/lunarmath.c It doesn't support twilight phases. There is a lot of code concerned with lunar calculations which you can obviously eliminate, and you'll need to adjust the latitude and longitude for your location. If you decide to port it to Python, my...
by pythoncoder
Fri Jun 24, 2016 5:32 am
Forum: General Discussion and Questions
Topic: Bitwise Assignment Operator
Replies: 22
Views: 17922

Re: Bitwise Assignment Operator

Perhaps what's needed is an enhancement to Python syntax enabling the slice notation to be applied to integers stm.mem16[stm.GPIOA + stm.GPIO_ODR][14] = 1 stm.mem16[stm.GPIOA + stm.GPIO_ODR][14:18] = 0b1011 >>> a = 0 >>> a[10:12] = 0b11 >>> hex(a) >>> '0xc00' I doubt you'd get it past Guido ;) Or Da...
by pythoncoder
Thu Jun 23, 2016 4:09 pm
Forum: Drivers for External Components
Topic: (WIP) Sitronix ST7735 TFT Display
Replies: 31
Views: 40744

Re: (WIP) Sitronix ST7735 TFT Display

wrt fonts one technique I found quite useful is to store bitmap images of antialiased fonts on the sd card... There is a potential performance issue here: performing a file random access for every character can be slow. I've used this approach for driving ePaper displays where the device is inheren...
by pythoncoder
Thu Jun 23, 2016 3:39 pm
Forum: Programs, Libraries and Tools
Topic: Astral port/alternative
Replies: 7
Views: 9141

Re: Astral port/alternative

I have some C code for calculating sun rise and set times which I can provide if you wish. It calculates to an accuracy on the order of +- a minute, which is probably better than you need. One option is to port it to Python to run on the target (which should be easy). Alternatively adapt it to creat...
by pythoncoder
Thu Jun 23, 2016 8:47 am
Forum: General Discussion and Questions
Topic: problem with reboot by reboot button or ctrl D
Replies: 1
Views: 2402

Re: problem with reboot by reboot button or ctrl D

Have you altered boot.py or main.py? It sounds as if it might be executing a program.
by pythoncoder
Thu Jun 23, 2016 8:06 am
Forum: General Discussion and Questions
Topic: Bitwise Assignment Operator
Replies: 22
Views: 17922

Re: Bitwise Assignment Operator

You could define a class in Python such that code like a = InstanceOfMyClass() a[12] = True would set bit 12 of some underlying hardware register. I don't think it would be remotely as efficient as the code you cited: stm.mem16[stm.GPIOA + stm.GPIO_ODR] ^= BIT14 The const() declaration means that th...
by pythoncoder
Wed Jun 22, 2016 8:35 am
Forum: ESP8266 boards
Topic: Does big number calculate has bug in ESP8266 board?
Replies: 2
Views: 3388

Re: Does big number calculate has bug in ESP8266 board?

My guess (and it is just a guess: I don't use Windows) is that it's a terminal artefact. It looks to me as if Hyperterm is set to 80 columns and isn't handling line wrap. It displays 80 characters correctly, but then puts subsequent characters in the rightmost column, repeatedly overwriting column 8...