Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors and Comments #80

Closed
wants to merge 18 commits into from
Closed

Conversation

AEFeinstein
Copy link

Shouldn't have any functional changes

adam and others added 13 commits October 11, 2018 08:04
Commented hpatimer.c
Commented user_main.c
Cleaned up configurable struct
Added #define for SAVE_LOAD_KEY
Added custom command information in README.md
Added custom_commands.h
Added functions to check for and get
Added hpaRunning to hpatimer.c, removed hpa_running from user_main.c
Made sure variables have initial values
@AEFeinstein AEFeinstein mentioned this pull request Dec 17, 2018
@cnlohr
Copy link
Owner

cnlohr commented Dec 17, 2018

uuhh... mind looking at those conflicts, @AEFeinstein ?

@cnlohr
Copy link
Owner

cnlohr commented Dec 17, 2018

Aah just saw your note in #77 ... I will look into this soon.

@cnlohr
Copy link
Owner

cnlohr commented May 22, 2019

@AEFeinstein Can you pull and refresh? Or should this be closed?

@AEFeinstein
Copy link
Author

Created AEFeinstein#2, will manually merge in the near future.

@AEFeinstein
Copy link
Author

@cnlohr, do you really need image.elf-0x00000.bin checked in?

@AEFeinstein
Copy link
Author

Pulled and refreshed

@cnlohr
Copy link
Owner

cnlohr commented May 23, 2019

@AEFeinstein Can you test colorchord desktop edition based on your changes here?

@bbkiwi
Copy link
Contributor

bbkiwi commented May 24, 2019

I've just compared @cnlohr master on a nodemcu with @AEFeinstein PR. Both seem to work with no major problems. Compatible with my recent changes. Tried with and without SORT_NOTES and APPROXNORM. I like @AEFeinstein handling of the configuration parameters. I vote to accept the PR. I will be fixing a few bugs and have additional output options. It will easier if I work with on this new code.

I get no warnings compiling @cnlohr, but get these after the PR

~/82XX-projects/colorchord/embedded8266 (testAEF) $ make all
/home/bill/esp-open-sdk/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -mlongcalls -Os -I/home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/include -Iesp82xx/include -I. -Iesp82xx/fwsrc -Iuser -I../embeddedcommon -DUSE_OPTIMIZE_PRINTF -DMFS_PAGE_OFFSET=532480 -DICACHE_FLASH -DDISABLE_CHARRX -DWS2812_FOUR_SAMPLE -DSOFTAP_CHANNEL=6 -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878 -DSLOWTICK_MS=50 -DVERSSTR='"Version: 8d82a-dev - Build Fri, May 24 2019, 17:34:29 +1200 with -DUSE_OPTIMIZE_PRINTF -DMFS_PAGE_OFFSET=532480 -DICACHE_FLASH -DDISABLE_CHARRX -DWS2812_FOUR_SAMPLE -DSOFTAP_CHANNEL=6 -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878 -DSLOWTICK_MS=50"' -g esp82xx/fwsrc/uart.c esp82xx/fwsrc/esp82xxutil.c esp82xx/fwsrc/flash_rewriter.c esp82xx/fwsrc/http.c esp82xx/fwsrc/commonservices.c esp82xx/fwsrc/http_custom.c esp82xx/fwsrc/mdns.c esp82xx/fwsrc/mfs.c user/custom_commands.c user/user_main.c user/ws2812_i2s.c user/hpatimer.c user/adc.c ../embeddedcommon/DFT32.c ../embeddedcommon/embeddednf.c ../embeddedcommon/embeddedout.c -flto -Wl,--relax -Wl,--gc-sections -nostdlib -L/home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib -Lesp82xx/libgcc_stripped.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libmain.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libssl.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libupgrade.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libnet80211.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libwpa.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libphy.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libcrypto.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libc.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libespnow.a /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib/libpp.a esp82xx/libgcc_stripped.a -T /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/ld/eagle.app.v6.ld -T /home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/ld/eagle.rom.addr.v6.ld -Wl,-Map,output.map -B/home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/lib -o image.elf
user/user_main.c: In function 'user_init':
user/user_main.c:270:2: warning: passing argument 1 of 'ets_timer_disarm' discards 'volatile' qualifier from pointer target type [enabled by default]
os_timer_disarm(&some_timer);
^
In file included from user/user_main.c:13:0:
/home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:66:6: note: expected 'struct ETSTimer *' but argument is of type 'volatile struct ETSTimer *'
void ets_timer_disarm(os_timer_t *ptimer);
^
user/user_main.c:271:2: warning: passing argument 1 of 'ets_timer_setfn' discards 'volatile' qualifier from pointer target type [enabled by default]
os_timer_setfn(&some_timer, (os_timer_func_t *)myTimer, NULL);
^
In file included from user/user_main.c:13:0:
/home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:67:6: note: expected 'struct ETSTimer *' but argument is of type 'volatile struct ETSTimer *'
void ets_timer_setfn(os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg);
^
user/user_main.c:272:2: warning: passing argument 1 of 'ets_timer_arm_new' discards 'volatile' qualifier from pointer target type [enabled by default]
os_timer_arm(&some_timer, 100, 1);
^
In file included from user/user_main.c:13:0:
/home/bill/82XX-projects/colorchord/embedded8266/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:65:6: note: expected 'struct ETSTimer *' but argument is of type 'volatile struct ETSTimer *'
void ets_timer_arm_new(os_timer_t *ptimer, uint32_t time, bool repeat_flag, bool ms_flag);
^
PATH=/home/bill/esp-open-sdk/xtensa-lx106-elf/bin:/home/bill/bin:/home/bill/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/bill/esp-open-sdk/xtensa-lx106-elf/bin /home/bill/esp-open-sdk/esptool/esptool.py elf2image image.elf
esptool.py v1.2

Here is the space used:

with PR and SORT=1 and APPROXNORM=1:
section size addr
.data 1302 1073643520
.rodata 3724 1073644832
.bss 43064 1073648560
.irom0.text 219792 1075904512
.text 29716 1074790400
.comment 5520 0
.xtensa.info 56 0
Total 408605
with PR and SORT=0 and APPROXNORM=1
.text 29652 1074790400
Total 408289
with PR and SORT=0 and APPROXNORM=0
.text 29684 1074790400
Total 408682

@AEFeinstein
Copy link
Author

I made some variables volatile because they were used inside and outside interrupts, but I guess the compiler isn't thrilled with that. I should be able to clean up those warnings with some casting later today.

@AEFeinstein
Copy link
Author

Fixed the volatility thing. I'm getting this warning too:

user/ws2812_i2s.c:466:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  ~0b1000100010001000, ~0b1000100010001100, ~0b1000100011001000, ~0b1000100011001100,
  ^
user/ws2812_i2s.c:466:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:466:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:466:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:467:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  ~0b1000110010001000, ~0b1000110010001100, ~0b1000110011001000, ~0b1000110011001100,
  ^
user/ws2812_i2s.c:467:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:467:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:467:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:468:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  ~0b1100100010001000, ~0b1100100010001100, ~0b1100100011001000, ~0b1100100011001100,
  ^
user/ws2812_i2s.c:468:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:468:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:468:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:469:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  ~0b1100110010001000, ~0b1100110010001100, ~0b1100111011001000, ~0b1100110011001100,
  ^
user/ws2812_i2s.c:469:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:469:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
user/ws2812_i2s.c:469:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]

The code it's whining about seems perfectly reasonable though. 16 binary digits in a uint16_t looks good to me

static const uint16_t bitpatterns[16] = {
	~0b1000100010001000, ~0b1000100010001100, ~0b1000100011001000, ~0b1000100011001100,
	~0b1000110010001000, ~0b1000110010001100, ~0b1000110011001000, ~0b1000110011001100,
	~0b1100100010001000, ~0b1100100010001100, ~0b1100100011001000, ~0b1100100011001100,
	~0b1100110010001000, ~0b1100110010001100, ~0b1100111011001000, ~0b1100110011001100,
};

@bbkiwi
Copy link
Contributor

bbkiwi commented May 29, 2019

I had noticed this warning when trying @cnlohr master which has #define LUXETRON at line 55 in ws2812_i2s.c which then defines INVERT. You won't get this if comment out the #define LUXETRON (which I did in my tests, (it should be in ccconfig.h or user.cfg). Maybe (???) the compiler views 0b1000100010001000 as negative, so warns when trying to bitwise invert it. Explicitly writing the inverted values should get rid of the warning.

static const uint16_t bitpatterns[16] = { 0b0111011101110111, ...

@AEFeinstein
Copy link
Author

AEFeinstein commented May 29, 2019 via email

@bbkiwi
Copy link
Contributor

bbkiwi commented May 29, 2019

Appending u didn't work.
This get rid of the warnings
static const uint16_t bitpatterns[16] = { 0b0111011101110111, 0b0111011101110011, 0b0111011100110111, 0b0111011100110011, 0b0111001101110111, 0b0111001101110011, 0b0111001100110111, 0b0111001100110011, 0b0011011101110111, 0b0011011101110011, 0b0011011100110111, 0b0011011100110011, 0b0011001101110111, 0b0011001101110011, 0b0011000100110111, 0b0011001100110011, };

I forgot to include ccconfig.h in my last PR. So I've done that and made the above fix in a new PR.

@AEFeinstein
Copy link
Author

AEFeinstein commented May 29, 2019 via email

@bbkiwi
Copy link
Contributor

bbkiwi commented May 29, 2019

PR #91 will make the changes, or you can fix it in your's and Charles can ignore mine.

@AEFeinstein
Copy link
Author

#91 is already up, so lets just use that

@cnlohr
Copy link
Owner

cnlohr commented Sep 27, 2019

Closing PR based on comments.

@cnlohr cnlohr closed this Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants